I just got bit by (clojure.contrib.lazy-seqs/combinations) returning
nil, not [[]] as I expected.  I could see arguments for either being
the "correct" output, but let me give my case for [[]].

In my mind, asking what the output of (combinations) should be is
completely analogous to asking what the value of 0^0 should be.
Either 0 or 1 seems defensible, but the accepted answer is 1 (for
reasons I won't go into here).  Similarly, Clojure (*) ==> 1.

If you don't see the connection, note that for all non-empty seqs of
seqs "args",
(= (count (apply combinations args)) (apply * (map count args))).

If (= (combinations) [[]]), then this would hold always.  Plus, this
is what would make it work in my application.  I can go into more
details if you like, but the basic idea use case is finding the set of
all allowed variable bindings, given a possible set of possible values
for each variable.  If there are no variables, this set should consist
of the single "empty binding" rather than "no bindings possible".

Will anyone sign off on adding this as a clojure.contrib issue?

Thanks,
Jason

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