[#39432] require and case — Martin Stannard <martin@...>

17 messages 2002/05/02

[#39463] RE: require and case — "Berger, Daniel" <djberge@...>

> --- Erik Bagfors <erik@bagfors.nu> wrote:

32 messages 2002/05/02
[#39699] Re: require and case — "Baptiste Lepilleur" <gaiacrtn@...> 2002/05/06

I confirm this behavior. I stumbled on something similar on ruby 1.6.7

[#39700] Re: require and case — ts <decoux@...> 2002/05/06

>>>>> "B" == Baptiste Lepilleur <gaiacrtn@free.fr> writes:

[#39718] Re: require and case — Dave Thomas <Dave@...> 2002/05/06

ts <decoux@moulon.inra.fr> writes:

[#39735] Re: require and case — matz@... (Yukihiro Matsumoto) 2002/05/06

Hi,

[#39534] dynamically assigning instance variables — "Berger, Daniel" <djberge@...>

Hi all,

25 messages 2002/05/03
[#39547] Re: dynamically assigning instance variables — harryo@... (Harry Ohlsen) 2002/05/04

wconrad@yagni.com wrote in message news:<20020503220050.GA443@pluto>...

[#39565] Re: dynamically assigning instance variables — Jean-Hugues ROBERT <jean_hugues_robert@...> 2002/05/04

Hello,

[#39568] Class methods defined in a module, how-to ? — Jean-Hugues ROBERT <jean_hugues_robert@...> 2002/05/04

[#39585] Ruby vs. Java vs. Native trivia — ser@... (Sean Russell)

Hi,

18 messages 2002/05/04

[#39657] newbie Q: how to strip blank lines from file? — Stewart Midwinter <stewart@..._midwinter.ca>

Well, I've spent a few days reading about Ruby, and want to try my first

11 messages 2002/05/06

[#39723] WWW.RUBYCONF.ORG — Christine Hall <return@...>

15 messages 2002/05/06

[#39796] Result of I need your experience - classification and comparison of languages — yvan.radenac@... (Yvan Radenac)

Hi,

21 messages 2002/05/07

[#39809] 'Ultimate' FreeRIDE ? — "Euan Mee" <xlucid@...>

[Note: This is a post to the FreeRIDE developers mailing list, which I have

16 messages 2002/05/07
[#39871] Re: 'Ultimate' FreeRIDE ? — Lothar Scholz <llothar@...> 2002/05/08

On Tue, 07 May 2002 20:52:06 GMT, "Euan Mee"

[#39821] non-alphabetic character in symbol — kwatch@... (kwatch)

Hi,

14 messages 2002/05/08

[#39887] Thread#join doesn't accept a timeout? — Dossy <dossy@...>

Hi,

27 messages 2002/05/09
[#39961] RE: Thread#join doesn't accept a timeout? — "Nathaniel Talbott" <nathaniel@...> 2002/05/09

Dossy [mailto:dossy@panoptic.com] wrote:

[#39968] Re: Thread#join doesn't accept a timeout? — Dossy <dossy@...> 2002/05/09

On 2002.05.10, Nathaniel Talbott <nathaniel@talbott.ws> wrote:

[#39898] cgi params api — patrick-may@... (Patrick May)

One thing that I don't like is the way cgi forces you to treat every

93 messages 2002/05/09
[#40032] Re: cgi params api — patrick-may@... (Patrick May) 2002/05/10

patrick-may@monmouth.com (Patrick May) wrote in message news:<3b3ad3b4.0205091447.5b00ce98@posting.google.com>...

[#40037] Re: cgi params api — Jean-Hugues ROBERT <jean_hugues_robert@...> 2002/05/10

At 02:23 11/05/2002 +0900, you wrote:

[#40049] Re: cgi params api — Wakou Aoyama <wakou@...> 2002/05/10

On Sat, May 11, 2002 at 03:27:13AM +0900,

[#40052] Re: cgi params api — Jean-Hugues ROBERT <jean_hugues_robert@...> 2002/05/10

At 05:56 11/05/2002 +0900, you wrote:

[#40137] Re: cgi params api — patrick-may@... (Patrick May) 2002/05/12

Wakou Aoyama <wakou@fsinet.or.jp> wrote in message news:<20020511121152.GA29832%wakou@fsinet.or.jp>...

[#40139] Re: cgi params api — Sean Chittenden <sean@...> 2002/05/12

> > If you access reqs['key'], then you'll always get a non-array object.

[#40144] Re: cgi params api — Dossy <dossy@...> 2002/05/12

On 2002.05.12, Sean Chittenden <sean@chittenden.org> wrote:

[#40148] Re: cgi params api — David Alan Black <dblack@...> 2002/05/12

Hello --

[#40159] Re: cgi params api — Dossy <dossy@...> 2002/05/12

On 2002.05.12, David Alan Black <dblack@candle.superlink.net> wrote:

[#40162] Re: cgi params api — Wakou Aoyama <wakou@...> 2002/05/12

On Mon, May 13, 2002 at 01:37:40AM +0900,

[#40191] Re: cgi params api — Dossy <dossy@...> 2002/05/13

On 2002.05.13, Wakou Aoyama <wakou@fsinet.or.jp> wrote:

[#40194] Re: cgi params api — David Alan Black <dblack@...> 2002/05/13

Hello --

[#40197] Re: cgi params api — Dossy <dossy@...> 2002/05/13

On 2002.05.13, David Alan Black <dblack@candle.superlink.net> wrote:

[#40198] Re: cgi params api — David Alan Black <dblack@...> 2002/05/13

Hi --

[#40203] Re: cgi params api — Dossy <dossy@...> 2002/05/13

On 2002.05.13, David Alan Black <dblack@candle.superlink.net> wrote:

[#40209] Re: cgi params api — Dave Thomas <Dave@...> 2002/05/13

Dossy <dossy@panoptic.com> writes:

[#40222] Re: cgi params api — Dossy <dossy@...> 2002/05/13

On 2002.05.13, Dave Thomas <Dave@PragmaticProgrammer.com> wrote:

[#40228] Re: cgi params api — Wakou Aoyama <wakou@...> 2002/05/13

On Tue, May 14, 2002 at 12:59:37AM +0900,

[#40229] Re: cgi params api — Dossy <dossy@...> 2002/05/13

On 2002.05.14, Wakou Aoyama <wakou@fsinet.or.jp> wrote:

[#40250] Re: cgi params api — Wakou Aoyama <wakou@...> 2002/05/13

Hi,

[#40291] Re: cgi params api — Dossy <dossy@...> 2002/05/14

On 2002.05.14, Wakou Aoyama <wakou@fsinet.or.jp> wrote:

[#40322] Re: cgi params api — Wakou Aoyama <wakou@...> 2002/05/14

Hi,

[#40377] Re: cgi params api — patrick-may@... (Patrick May) 2002/05/15

Dossy <dossy@panoptic.com> wrote in message news:<20020514172939.GL14145@panoptic.com>...

[#40387] Re: cgi params api — Dossy <dossy@...> 2002/05/15

On 2002.05.15, Patrick May <patrick-may@monmouth.com> wrote:

[#40389] Re: cgi params api — David Alan Black <dblack@...> 2002/05/15

Hello --

[#40390] Re: cgi params api — Dossy <dossy@...> 2002/05/15

On 2002.05.15, David Alan Black <dblack@candle.superlink.net> wrote:

[#40394] Re: cgi params api — David Alan Black <dblack@...> 2002/05/15

Hello --

[#40004] Ruby Conference 2002: Call for Presenters — David Alan Black <dblack@...>

Ruby Conference 2002: Call for Presenters

25 messages 2002/05/10
[#40009] Re: Ruby Conference 2002: Call for Presenters — Jim Menard <jimm@...> 2002/05/10

David Alan Black <dblack@candle.superlink.net> writes:

[#40043] Premature end of script headers — ccos <ccos@...> 2002/05/10

hello,

[#40015] BUG! Platform independent? sockets and select — "Kontra, Gergely" <kgergely@...>

Hi!

12 messages 2002/05/10

[#40099] OT:is software eng an art? — ptkwt@...1.aracnet.com (Phil Tomson)

I signed up for a free seminar that's being held at a grad school nearby

34 messages 2002/05/11

[#40105] Re: OT:is software eng an art? — "Radu M. Obad磚 <whizkid@...>

Mind me... but I feel like stating my oppinions regarding this issue. I

30 messages 2002/05/11

[#40180] What is Ruby for? — "Steve Merrick" <Steve.Merrick@...>

Or even 'Why <insert scripting language of your choice>'? I know it's me

35 messages 2002/05/13

[#40346] ANN: REXML 2.3.3 — Sean Russell <ser@...>

Getting tired of the upgrades yet?

50 messages 2002/05/14
[#40407] Re: ANN: REXML 2.3.3 — Sean Russell <ser@...> 2002/05/15

<posted & mailed>

[#40412] RE: ANN: REXML 2.3.3 — "Rich Kilmer" <rich@...> 2002/05/15

I'll weigh in here...

[#40418] RE: ANN: REXML 2.3.3 — David Alan Black <dblack@...> 2002/05/15

Hi --

[#40426] Re: ANN: REXML 2.3.3 — Bob Hutchison <hutch@...> 2002/05/15

On 5/15/02 12:53 PM, "David Alan Black" <dblack@candle.superlink.net> wrote:

[#40440] Re: ANN: REXML 2.3.3 — Tobias Reif <tobiasreif@...> 2002/05/15

Bob Hutchison schrieb:

[#40397] ANN: Programmierung in Ruby — juergen.katins@... (Juergen Katins)

The translation of *Programming Ruby* by Dave Thomas and Andy Hunt is

31 messages 2002/05/15

[#40525] Metaclasses... — "Hal E. Fulton" <hal9000@...>

Hello, all...

15 messages 2002/05/16

[#40559] what's the calling method name? — Yohanes Santoso <ruby-talk@...>

Hello all,

27 messages 2002/05/17
[#40566] Re: what's the calling method name? — John Carter <john.carter@...> 2002/05/17

On Fri, 17 May 2002, Yohanes Santoso wrote:

[#40577] Re: what's the calling method name? — Yohanes Santoso <ruby-talk@...> 2002/05/17

John Carter <john.carter@tait.co.nz> writes:

[#40647] Re: what's the calling method name? — Yohanes Santoso <ruby-talk@...> 2002/05/18

Yohanes Santoso <ruby-talk@jenny-gnome.dyndns.org> writes:

[#40735] Re: what's the calling method name? — wconrad@... 2002/05/19

On Sat, May 18, 2002 at 06:16:29PM +0900, Yohanes Santoso wrote:

[#40782] Re: what's the calling method name? — nobu.nokada@... 2002/05/20

Hi,

[#40571] Shifting array element & regex on array element — Yohanes Santoso <freeride-devel@...>

In implementing a buffer gap mechanism, I was wondering if there is

10 messages 2002/05/17

[#40635] Ruby regex question — Dossy <dossy@...>

Maybe this is Perl envy, maybe I'm just doing something wrong.

28 messages 2002/05/18
[#40664] Re: Ruby regex question — Mike Stok <mike@...> 2002/05/18

In article <20020518152610.GJ9684@panoptic.com>, Dossy wrote:

[#40673] Re: Ruby regex question — Dossy <dossy@...> 2002/05/18

On 2002.05.19, Mike Stok <mike@stok.co.uk> wrote:

[#40687] RubyEclipse released — "Adam Williams" <awilliams@...>

First release of the highly anticipated (maybe just by me) Ruby IDE. Get it

32 messages 2002/05/19
[#40720] Re: [ANN] RubyEclipse released — Han Holl <han@...> 2002/05/19

Adam Williams wrote:

[#40741] RE: [ANN] RubyEclipse released — "Adam Williams" <awilliams@...> 2002/05/19

Okay. So I probably need to work on some documentation.

[#40723] are there unit tests for cgi.rb? — patrick-may@... (Patrick May)

if so, where could I find them?

27 messages 2002/05/19
[#40806] Re: are there unit tests for cgi.rb? — Tobias Reif <tobiasreif@...> 2002/05/20

Wakou Aoyama wrote:

[#40812] Re: are there unit tests for cgi.rb? — Wakou Aoyama <wakou@...> 2002/05/20

On Tue, May 21, 2002 at 12:27:46AM +0900,

[#40902] method_missing is cool (was: are there unit tests for cgi.rb?) — Ian Macdonald <ian@...> 2002/05/21

On Tue 21 May 2002 at 01:00:22 +0900, Wakou Aoyama wrote:

[#40778] automatic documentation: using tests in addition to / instead of comments — Tobias Reif <tobiasreif@...>

Hi,

40 messages 2002/05/20
[#40788] Re: [RDoc etc] automatic documentation: using tests in addition to / instead of comments — Dave Thomas <Dave@...> 2002/05/20

Tobias Reif <tobiasreif@pinkjuice.com> writes:

[#40826] DBI access to mysql auto_increment record numbers? — Brad Cox <bcox@...> 2002/05/20

How do you get the auto_increment record number for mysql in

[#40887] Re: [RDoc etc] automatic documentation: using tests in addition to / instead of comments — Sean Russell <ser@...> 2002/05/21

Man, how did I miss this thread?

[#40889] Re: [RDoc etc] automatic documentation: using tests in addition to / instead of comments — Paul Brannan <pbrannan@...> 2002/05/21

On Wed, May 22, 2002 at 12:14:05AM +0900, Sean Russell wrote:

[#40875] Memory consumption. — Erik Terpstra <erik@...>

Is there some method that tells me how much memory a certain object

14 messages 2002/05/21

[#40978] Re: Stymied by Ruby's garbage collector — Art Taylor <ataylor@...>

Is there a particular kind or kinds of object being created in huge numbers?

25 messages 2002/05/22
[#40986] Re: Stymied by Ruby's garbage collector — Bob Hutchison <hutch@...> 2002/05/22

On 5/22/02 4:07 PM, "Art Taylor" <ataylor@fortpoint.com> wrote:

[#41085] OS independent scripts, system calls on Windows and Linux — Tobias Reif <tobiasreif@...>

Hi,

19 messages 2002/05/24

[#41102] RE: OS independent scripts, system calls on Windows and Linux — "Morris, Chris" <chris.morris@...>

> All these incompatibility issues are why I want to talk about an RCR.

29 messages 2002/05/24
[#41105] Re: OS independent scripts, system calls on Windows and Linux — Tobias Reif <tobiasreif@...> 2002/05/24

Morris, Chris wrote:

[#41266] Re: OS independent scripts, system calls on Windows and Linux — Dennis Newbold <dennisn@...> 2002/05/28

On Fri, 24 May 2002, Tobias Reif wrote:

[#41352] Infinity (?!) — ptkwt@...1.aracnet.com (Phil Tomson)

I didn't know there was an Infinity value in Ruby, just found it today:

34 messages 2002/05/30

[#41434] Ruby jobs — Tobias Reif <tobiasreif@...>

Hi,

23 messages 2002/05/31
[#41475] RE: Ruby jobs — <james@...> 2002/05/31

>

[#41510] Finding all applications — Chris Gehlker <gehlker@...>

In trying to add drag and drop scripting to RubyStudio and the first task is

40 messages 2002/05/31
[#41561] Re: Finding all applications — Sean Russell <ser@...> 2002/06/01

Jim Menard wrote:

[#41564] Re: Finding all applications — nobu.nokada@... 2002/06/01

Hi,

[#41575] Re: Finding all applications — Chris Gehlker <gehlker@...> 2002/06/02

On 6/1/02 11:33 AM, "nobu.nokada@softhome.net" <nobu.nokada@softhome.net>

[#41576] RE: Finding all applications — "Mike Campbell" <michael_s_campbell@...> 2002/06/02

>> ruby -r find -e 'Find.find("/"){|f| puts f if f[/\.app$/]}'

[#41578] Re: Finding all applications — Chris Gehlker <gehlker@...> 2002/06/02

On 6/1/02 5:20 PM, "Mike Campbell" <michael_s_campbell@yahoo.com> wrote:

[#41579] Re: Finding all applications — Dossy <dossy@...> 2002/06/02

On 2002.06.02, Chris Gehlker <gehlker@fastq.com> wrote:

[#41586] Re: Finding all applications — Chris Gehlker <gehlker@...> 2002/06/02

On 6/1/02 7:44 PM, "Dossy" <dossy@panoptic.com> wrote:

Fixes for the new step methods in the range.c & numeric.c

From: <chr_rippel@...>
Date: 2002-05-06 12:37:14 UTC
List: ruby-talk #39681
Hi,

an included patch for the step method in range.c is a simple
bug-fix - for example

---
class Class
  alias succ superclass
end

# currently throws an exception complaining that succ for nil
# is undefined
(Fixnum..Object).step(2) {|x| p x }
---

The patch for the step method in numeric.c adds a sequence 
end point adjustment strategy - #step_fuzzyness measures the
``fuzzyness'' of step-length additions around the end-point
and adds a safety margin (there exist probably much better 
step_fuzzyness measures) - in pure Ruby:  

---
class Float
    def test_step(b,s)
      n = ((b - self)/ s).round
      last = n*s + self
      
      fuzzyness = step_fuzzyness(n,s)
      if (s > 0 && last > b + fuzzyness) || \
         (s < 0 && last < b - fuzzyness)
         n-=1
         last = n*s + self
      end
      
      if (last - b).abs < fuzzyness
        last = b
      end
        
      (n-1).times {|i| yield i*s + self }
      yield last
	self
    end
    
    EPSILON = 2.0**(-43)
    def step_fuzzyness(n, s)
      tmp = ((n-1)..(n+1)).collect do |i| 
       ((i*s + self - ((i-1)*s + self)) - s).abs
      end
      tmp.push s.abs*EPSILON
      2*tmp.max
    end
end


# with this patch on my machine ...
M = 52343
T = 12418.979
K = 20300012
L = 15673

p b = (K/T)                  # => 1634.595887
p e = (-L*M + K)/T           # => -64423.31749
p s = -M/T                   # => -4.214758717
p err = M/T * (2.0**(-40))# => 3.677147842e-12

# with this patch on my machine

last = nil
b.step(e,s) {|last| }
p e - last       # => 0.0

b.step(e+err,s) {|last| }
p (e+err) - last # => -4.214758717

b.step(e-err,s) {|last| }
p (e-err) - last # => -7.275957614e-12


# a bigger error is necessary to demonstrate
# fuzzyness in pure Ruby 

p err = M/T * (2.0**(-38.00))

b.test_step(e,s) {|last| }
p e - last       # => 0.0

b.test_step(e+err,s) {|last| }
p (e+err) - last # => -4.214758717

b.test_step(e-err,s) {|last| }
p (e-err) - last # => -1.455191523e-11
---


/Christoph

Attachments (2)

range.patch (1.11 KB, text/x-diff)
--- range.c.1.34	Fri May  3 18:44:42 2002
+++ range.c	Fri May  3 00:23:28 2002
@@ -71,7 +71,7 @@
     VALUE obj;
 {
     VALUE beg, end, flags;
-    
+
     rb_scan_args(argc, argv, "21", &beg, &end, &flags);
     /* Ranges are immutable, so that they should be initialized only once. */
     if (rb_ivar_defined(obj, id_beg)) {
@@ -304,26 +304,21 @@
     else {			/* generic each */
 	VALUE v = b;
 	long lim = NUM2LONG(step);
-	long i;
+	long i = lim;
 
 	if (lim <= 0) {
 	    rb_raise(rb_eArgError, "step can't be <= 0");
 	}
-	if (EXCL(range)) {
-	    while (r_lt(v, e)) {
-		if (r_eq(v, e)) break;
-		rb_yield(v);
-		for (i=0; i<lim; i++) 
-		    v = rb_funcall(v, id_succ, 0, 0);
-	    }
-	}
-	else {
-	    while (r_le(v, e)) {
+	for(;NUM2INT(rb_funcall(v, id_cmp, 1, e)) < 0; v = rb_funcall(v, id_succ, 0, 0))
+		if (i == lim) {
+			rb_yield(v);
+			i = 1;
+		} else {
+			i++;
+		}
+	if (!(EXCL(range)) && (i == lim) && \
+	    (v == e || NUM2INT(rb_funcall(v, id_cmp, 1, e)) == 0)) {
 		rb_yield(v);
-		if (r_eq(v, e)) break;
-		for (i=0; i<lim; i++) 
-		    v = rb_funcall(v, id_succ, 0, 0);
-	    }
 	}
     }
     return range;
numeric.patch (2.53 KB, text/x-diff)
--- numeric.c.1.47	Fri May  3 19:02:33 2002
+++ numeric.c	Sun May  5 12:17:11 2002
@@ -224,7 +224,7 @@
 	return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
     else if(isnan(value))
 	return rb_str_new2("NaN");
-    
+
     avalue = fabs(value);
     if (avalue == 0.0) {
 	fmt = "%.1f";
@@ -234,13 +234,13 @@
 	while (d1 < 1.0) d1 *= 10.0;
 	d1 = modf(d1, &d2);
 	if (d1 == 0) fmt = "%.1e";
-    }    
+    }
     else if (avalue >= 1.0e10) {
 	d1 = avalue;
 	while (d1 > 10.0) d1 /= 10.0;
 	d1 = modf(d1, &d2);
 	if (d1 == 0) fmt = "%.1e";
-    }    
+    }
     else if ((d1 = modf(value, &d2)) == 0) {
 	fmt = "%.1f";
     }
@@ -641,7 +641,7 @@
 
 static VALUE flo_is_nan_p(num)
      VALUE num;
-{     
+{
 
   double value = RFLOAT(num)->value;
 
@@ -650,7 +650,7 @@
 
 static VALUE flo_is_infinite_p(num)
      VALUE num;
-{     
+{
   double value = RFLOAT(num)->value;
 
   if (isinf(value)) {
@@ -662,12 +662,12 @@
 
 static VALUE flo_is_finite_p(num)
      VALUE num;
-{     
+{
   double value = RFLOAT(num)->value;
 
   if (isinf(value) || isnan(value))
     return Qfalse;
-  
+
   return Qtrue;
 }
 
@@ -762,6 +762,25 @@
     return flo_truncate(rb_Float(num));
 }
 
+
+static double
+step_fuzzyness(n,a,b,c)
+	long  n;
+	double a,b,c;
+{
+	/* eps = 2^(-43)  */
+	const double eps = 1.136868377e-13;
+	double n0 = (n-2)*c + a;
+	double n1 = (n-1)*c + a;
+	double n2 = (n)*c + a;
+	double n3 = ((n)+1)*c + a;
+	/* max-macro is not universal */
+	#define fuzzy_max(a,b)    (((a) > (b)) ? (a) : (b))
+	return 2*fuzzy_max(fuzzy_max(fabs(n1-n0-c),fabs(n2-n1-c)),\
+	                   fuzzy_max(fabs(n3-n2-c),fabs(c)*eps));
+}
+
+
 static VALUE
 num_step(argc, argv, from)
     int argc;
@@ -798,17 +817,32 @@
 	}
     }
     else if (TYPE(from) == T_FLOAT || TYPE(to) == T_FLOAT || TYPE(step) == T_FLOAT) {
-	const double epsilon = 2.2204460492503131E-16;
 	double beg = NUM2DBL(from);
 	double end = NUM2DBL(to);
 	double unit = NUM2DBL(step);
-	double n = (end - beg)/unit;
-	long i;
+	double fuzzy,last;
+	long   n,i;
+	n = floor((end - beg)/unit + 0.5);
+
+	if (n < 0) {
+		return from;
+	}
+	fuzzy = step_fuzzyness(n,beg,end,unit);
+	last = n* unit + beg;
 
-	n = floor(n + n*epsilon) + 1;
-	for (i=0; i<n; i++) {
-	    rb_yield(rb_float_new(i*unit+beg));
+	if ((unit > 0.0 && last > end + fuzzy) || (unit < 0.0 && last < end - fuzzy)) {
+		n--;
+		last = n*unit + beg;
 	}
+	if (fabs(last - end) < fuzzy) {
+		last = end;
+	}
+
+	for (i = 0; i<n; i++) {
+		rb_yield(rb_float_new(i*unit + beg));
+	}
+	rb_yield(rb_float_new(last));
+
     }
     else {
 	VALUE i = from;

In This Thread

Prev Next