Coming from the Ruby and JavaScript worlds, I am used to having  
functions that normalize their arguments, such as the "$" function in  
various JavaScript libraries. Other library functions tend to  
automatically call "$" for you, so you don't have to remember whether  
to do it or not.

One analog in Clojure is functions that work on seqs (or seq-ables).  
In general, I would rather not have to remember, and assume that most  
functions call seq internally if they need to.

To make this concrete, should the following function from  
clojure.contrib.seq-utils call seq on its arg? As written, you cannot  
call it with an associative collection unless you remember to wrap it  
in a seq:

(defn rand-elt
   "Return a random element of this seq"
   [s]
   (nth s (rand-int (count s))))

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