Hi,
Am 28.12.2008 um 03:22 schrieb Mark Volkmann:
Here's a related problem. I have a sequence of strings and I'd like to
print each on a separate line. I know that this isn't the answer:
(force (map println results))
I'm not sure what else to try.
(doseq [x (range 3)] (println x))
(doseq [
Meikel's example works fine for strings:
user=> (doseq [s ["hi" "mum" "love u"]] (println s))
hi
mum
love u
nil
As does your map:
user=> (dorun (map println ["hi" "mum" "love u"]))
hi
mum
love u
nil
--~--~-~--~~~---~--~~
You received this message because yo
Here's a related problem. I have a sequence of strings and I'd like to
print each on a separate line. I know that this isn't the answer:
(force (map println results))
I'm not sure what else to try.
On Sat, Dec 27, 2008 at 10:12 AM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 26.12.2008 um 21:43 schrie
Hi,
Am 26.12.2008 um 21:43 schrieb Mark Volkmann:
(for [x (range 3)] (println x))
for is not a looping construct. for is a list comprehension.
For side effects as above use doseq.
(doseq [x (range 3)] (println x))
Sincerely
Meikel
smime.p7s
Description: S/MIME cryptographic signature
On Fri, Dec 26, 2008 at 10:43 PM, Mark Volkmann
wrote:
>
> Why does
>
> (for [x (range 3)] (println x))
>
> output
>
> (0
> nil 1
> nil 2
> nil)
>
> when run in the REPL instead of
>
> 0
> 1
> 2
This is because println returns nil every time it's run.
user=> (println "test")
test
nil
user=>
Al
On Fri, 26 Dec 2008 14:43:23 -0600
"Mark Volkmann" wrote:
>
>Why does
>
>(for [x (range 3)] (println x))
>
>output
>
>(0
>nil 1
>nil 2
>nil)
>
>when run in the REPL instead of
>
>0
>1
>2
>
>and nothing at all when run from a script?
>
The seq of nils is the return value of `(for ...)'. It is pr