On Mon, Sep 26, 2011 at 5:33 PM, Dennis Haupt <d.haup...@googlemail.com> wrote:
> now i'm here:
> (defrecord point [x y z])
> (defn genPoints [n]
>  (let [random (new Random)
>        randomInt #(.nextInt random)
>        randomPoint #(new point (randomInt) (randomInt) (randomInt))]
>    (repeatedly n randomPoint)))
>
> is there a way to avoid writing (randomInt)(randomInt)(randomInt) and
> instead something like (magic (repeatedly 3 randomInt))?

I'm not sure if this the best way, but it would work.

(eval `(new point ~@(take 3 (repeatedly #(rand-int 10)))))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to