Newsgroups: comp.lang.lisp
From: "WJ" <w_a_x_...@yahoo.com>
Date: 4 May 2012 10:27:22 GMT
Local: Fri, May 4 2012 6:27 am
Subject: Re: Anti-Loop
WJ wrote:
(for/fold
> WJ wrote: > > The low, loopy way:
> > (defparameter random (loop repeat 100 collect (random 10000)))
> > (loop for i in random
> > ==>
> > The high way:
> > (setq random (rand 10000 100))
> > (append
> > ==>
> Racket:
> (define +random+ (map random (make-list 100 10000)))
> (map (lambda (x) (eval `(,@x +random+)))
> ==>
([mini 10000] [maxi -1] [sum 0] [evens 0] [odds 0]) ([n +random+]) (values [min mini n] [max maxi n] [+ sum n] [+ evens (if (even? n) 1 0)] [+ odds (if (odd? n) 1 0)])) You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||