-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 27.09.2011 06:27, schrieb Baishampayan Ghose:
>> i wasn't really trying to achieve anything useful - just messing 
>> around and see where i get.
>> 
>> 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))?
> 
> This is how I would write it -
> 
> (defrecord Point [x y z])
> 
> ;;; Only needed in pre Clojure 1.3.0 ;;; In Clojure 1.3.0, ->Point
> will be generated automatically ;; (defn ->Point ;;   [x y z] ;;
> (Point. x y z))
> 
> (defn gen-points [n] (let [random (java.util.Random.) random-int
> #(.nextInt random) random-point #(apply ->Point (repeatedly 3
> random-int))] (repeatedly n random-point)))
> 
> Hope this helps.
> 
> Regards, BG
> 

yes it does :)

- -- 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOght3AAoJENRtux+h35aG+AIP/j3ufGpS74wSSDv1RyAJjx2V
S7cdRuF4U00tanW1OAn/PYY93iT0wcXBgKowuo/jD9+C0TV5K7/he33KeSRrJCnb
vLEq8B1Um4JOc1V7MZZBaqtIfJcaQ3s5fcPtPdITX97dX79A3WSItU3/Fc+UYC2i
eF7p99dNLToF2KQhQPZ0Wb37gyIit/XExWiuTx8FIkNzLsL/cPQFMJpcG5Thw9pF
6EKImZOH2A6zOgO68nbynxV4D2vOW7VKkJb7B61XgRILf9bfLqspg/GmEeXaBTrp
gNXSbE7AFAHp6bA08nvydfr9H68z1H53i79mLxlDVXsq3MjGiHVddDa1SaG9SwwV
Vt7K0IndKqFonoI5WUj9CRnxWDoDhy35zwSolJOZhAjSSBHDdZCa9fa0BUU5HXu6
15z3RTG9nOk6OIQJeJiKNGaHtPdplJ0ugHFCDhLpsQZoG8z6QWT6n6BxDwRU9w3i
bEobBms8PqEsTWf1MmwJxLPyA/UC0wVKNiMdqheyydVZ/siGJzXN6fgJYFFUXPhT
KElmSJPeV6Ee56GG2ttDFSSblP+At2Kv3zJZQqUnbEhiu6a3L6ofrybTkaUjASWK
KXcnTYEy/ARi2lc+lD39pgM9YKJOOvgX9f3cGFe8mi4B1nZ5nlzrciyN3eJy8QaL
/MJvl1yQRxdWqQX1xLsQ
=vR6l
-----END PGP SIGNATURE-----

-- 
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