From: William James
Subject: Re: Calling lisp functions
Date: 
Message-ID: <gnujig02c3c@enews5.newsguy.com>
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)))

From: Marco Antoniotti
Subject: Re: Calling lisp functions
Date: 
Message-ID: <c559f039-4a2f-4d1a-b171-4e28fe4a2117@p13g2000yqc.googlegroups.com>
On Feb 23, 5:40 pm, "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)))


Call them from C.

Cheers
--
Marco
From: DanL
Subject: Re: Calling lisp functions
Date: 
Message-ID: <9b602b84-47dd-4ac0-aba5-1e996872208d@e24g2000vbe.googlegroups.com>
On Feb 23, 5:40 pm, "William James" <> wrote:
> Clojure:
>
> (defn random-10 []
>   (for (_ (range 10)) (rand)))

(defun random-10 ()
  (mapping ((_ (scan-range :below 10))) (random 1.0)))

(defun random-10 ()
  (subseries (mapping () (random 1.0)) 0 10))
From: William James
Subject: Re: Calling lisp functions
Date: 
Message-ID: <gnvg982fjj@enews2.newsguy.com>
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)))
From: Marco Antoniotti
Subject: Re: Calling lisp functions
Date: 
Message-ID: <3d65a627-270c-47eb-8dc7-8dee489d34da@x38g2000yqj.googlegroups.com>
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