Functions like (+), (*), (-), (and probably more) should support
sequences as parameters.

The current way to accomplish this (without implementing your own sum
using reduce) seems to be:
> (apply + (map #(. Math pow 2 %) (range 10)))
... which has to generate the sequence first.

Instead, you should be able to use
> (+ (map #(. Math pow 2 %) (range 10)))
... which could consume a lazy sequence without generating it.

Also, this would let you check if a sequence was sorted by using
> (< (range 10))
.. which would be pretty elegant =)

Thanks,
Stu
--~--~---------~--~----~------------~-------~--~----~
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
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