This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: a minor random nit


Bill Schottstaedt <bil@ccrma.stanford.edu> writes:

> > guile> (random 0)
> > standard input:1:1: In procedure random in expression (random 0):
> > standard input:1:1: Wrong type argument in position 1: 0
> > ABORT: (wrong-type-arg)
> 
> It's actually an out-of-range error, not a type error;

Yes.

> and it's my humble opinion that (random 0) should return 0.

Hmm...  Is that a good idea?

Naturally, (random 1) should return 0, but, it seems to me that if
`random' gets called with argument 0, it's probably due to faulty
program logic.

My guess is actually that throwing an error for 0 can catch bugs.

/mdj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]