On Feb 24, 1:50 am, "William James" <·········@yahoo.com> wrote:
> William James wrote:
> > Francogrex wrote:
>
> > > (defun random-10 () (loop repeat 10 collect (random 1.0) into
> > > rndtemp finally (return (values (setf rnd rndtemp)))))
>
> > Ruby:
>
> > def random_10
> > Array.new(10){ rand }
> > end
>
> > Clojure:
>
> > (defn random-10 []
> > (for (_ (range 10)) (rand)))
>
> (defn random-10 []
> (take 10 (repeatedly rand)))
(defun rantom-10 () (lazy-seq:take 10 (lazy:repeatedly 'random)))
Which, let's not forget, I can call from C in ECL etc etc. We are
still waiting for the semantically equivalent Ruby version.... :)
But wait! Since you got as far as Clojure, maybe you can start
posting actual Communist Lisp (not that that will save you from the
request of posting the Ruby lazy calling library.... :) )
Cheers
--
Marco