NP. Many of us are only too happy to help folks new to Clojure get over these humps and become productive! :)
On Tue, Jul 16, 2013 at 6:57 PM, Keith Maynard <kpmayn...@gmail.com> wrote: > Wow!!!! Awesome Sean, I dropped your code in and it worked immediately!!!! > > It's quite a challenge figuring out the various idioms in all these amazing > languages. Thanks for clearing up my attempt at a multimethod :) > > Regards, > > Keith > > On Tuesday, July 16, 2013 6:03:14 PM UTC-4, Sean Corfield wrote: >> >> On Tue, Jul 16, 2013 at 2:16 PM, Keith Maynard <kpma...@gmail.com> wrote: >> > (defn perms >> > ( [] [[]]) >> >> This is not pattern matching in Clojure. It defines an alternative >> arity version of the function so that (perms) would return [[]]. >> >> > ([xs] >> > >> > (for [x xs p (perms (removeFirst x xs))] (cons x p)) ) >> > >> > ) >> >> You need something like this: >> >> (defn perms >> [xs] >> (if (seq xs) >> (for [x xs p (perms (removeFirst x xs))] (cons x p)) >> [[]])) >> >> -- >> Sean A Corfield -- (904) 302-SEAN >> An Architect's View -- http://corfield.org/ >> World Singles, LLC. -- http://worldsingles.com/ >> >> "Perfection is the enemy of the good." >> -- Gustave Flaubert, French realist novelist (1821-1880) > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.