|Subject:||Re: [Chicken-users] Re: A few questions|
|Date:||Thu, 31 Jan 2008 21:37:51 -0500|
On Thu, 31 Jan 2008, John Cowan wrote:> Elf scripsit:sure, min 0, max 1.
>>> (define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
>> in this case, 0. this entire _expression_ should have been removed by the
>> compiler and replaced by #f, though.
> Okay, make it (random 2) then, smartass.
however, youre forgetting to check that the element exists
before car'ing. i may be under a mistaken impression, but when working with
rest lists, i thought that one should always check size before trying to grab
elements. such restrictions are part of why i say its easy... if one
omits this, its a bit harder, but will also crash in other ways from incorrect
|[Prev in Thread]||Current Thread||[Next in Thread]|