On Nov 6, 12:51 pm, Daniel Janus <nath...@gmail.com> wrote:
> As another example, consider multiplying the first 42 elements of a
> list of numbers by 42, and leaving the rest unchanged. It's much more
> straightforward for me to write (and then read)
>
> (iter (for x in lst)
>      (for i from 0)
>      (collect (if (< i 42) (* x 42) x)))

How about this version?
user=> (def lst [1 2 3 4 5 6 7 8])
user=> (concat (map #(* % 42) (take 4 lst)) (drop 4 lst))
(42 84 126 168 5 6 7 8)

Don't get me wrong - I like the macro - just pointing out how I'd
write this particular use case.


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