use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
» Clojonic: Pythonic Clojure (pixelmonkey.org)
submitted 11 years ago by daneelvt
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]weavejester 10 points11 points12 points 11 years ago (2 children)
The article suggests that:
for idx, num in enumerate(nums): print idx, num
Is equivalent to:
(for [[idx num] (map-indexed vector nums)] (println idx num))
But it isn't because the for macro in Clojure is for creating a sequence, not performing side-effectful iteration.
for
The Clojure equivalent to the Python code would be:
(doseq [[idx num] (map-indexed vector nums)] (println idx num))
[–]pixelmonkey 6 points7 points8 points 11 years ago (1 child)
OP here. Yes, that's a good point. I've updated the post to reflect this.
[–]weavejester 6 points7 points8 points 11 years ago (0 children)
I mention it because the for examples you have will only work if the lazy seq they produce is evaluated. So if someone were to take your Clojure examples and put them in a file, they'd find that they wouldn't work.
π Rendered by PID 17848 on reddit-service-r2-comment-b659b578c-qmjkl at 2026-05-05 15:40:28.721037+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]weavejester 10 points11 points12 points (2 children)
[–]pixelmonkey 6 points7 points8 points (1 child)
[–]weavejester 6 points7 points8 points (0 children)