-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) randomI
> 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
This:
randomPoint #(apply new point (repeatedly 3 randomInt))
does not work, but is almost what you want. It doesn't work because new is
a macro, and apply only works with functions as the first arg.
Using the following two lines, first to define a function, then to use it
with apply, seems lik
On Mon, Sep 26, 2011 at 5:33 PM, Dennis Haupt 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
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
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 (
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
i don't have the magic eye to spot the parenthesis-errors yet
Am 25.09.2011 22:15, schrieb Mark Rathwell:
>> (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt
>> rand))] ((map (print) (iterate ((nextInt "dummy") 0)
>
> extra parenthesis
> (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))]
> ((map (print) (iterate ((nextInt "dummy") 0)
extra parenthesis in three places, and the first argument to iterate
is a function, not a long:
(let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))]
(map print
On Mon, Sep 26, 2011 at 1:21 AM, Dennis Haupt wrote:
> (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))]
> ((map (print) (iterate ((nextInt "dummy") 0)
>
>
> the error is:
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> clojure.lang.IFn (NO_SOURCE_FILE:0
On Sun Sep 25 21:51 2011, Dennis Haupt wrote:
> (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))]
> ((map (print) (iterate ((nextInt "dummy") 0)
>
>
> the error is:
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> clojure.lang.IFn (NO_SOURCE_FILE:0)
>
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
(let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))]
((map (print) (iterate ((nextInt "dummy") 0)
the error is:
java.lang.ClassCastException: java.lang.Integer cannot be cast to
clojure.lang.IFn (NO_SOURCE_FILE:0)
why does it want
10 matches
Mail list logo