This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: a minor random nit
- To: Bill Schottstaedt <bil at ccrma dot stanford dot edu>
- Subject: Re: a minor random nit
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 10 Feb 2000 17:49:58 +0100
- Cc: guile at sourceware dot cygnus dot com
- Cc: djurfeldt at nada dot kth dot se
- References: <200002101501.HAA23742@cmn14.stanford.edu>
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