On Fri, Jun 7, 2013 at 11:13 PM, Matt Smith <matt.smith...@gmail.com> wrote:
> (-> '([1 2] [3 4] [5]) > (partial map first) > flatten > ) Because this becomes (flatten (partial '([1 2] [3 4] [5]) map first)) I think I understand how you thought; "(partial map first) becomes a function, then I call this function with '([1 2] [3 4] [5]) which gives me what I want!". That is not how it works, -> simple rearranges the forms, see the documentation: http://clojuredocs.org/clojure_core/clojure.core/-> What you want is ->> http://clojuredocs.org/clojure_core/clojure.core/->> Hope that's understandable. Jonathan On Fri, Jun 7, 2013 at 11:13 PM, Matt Smith <matt.smith...@gmail.com> wrote: > Newbie question here. This code: > > (println (flatten(map first '([1 2] [3 4] [5])))) > > > > > (def mapfirst (partial map first)) > (println > (-> '([1 2] [3 4] [5]) > mapfirst > flatten > )) > > > > > (println > (-> '([1 2] [3 4] [5]) > (partial map first) > flatten > )) > > prints out: > >> (1 3 5) >> (1 3 5) >> () > > > Could someone help me understand why the last println does not print (1 3 > 5) > > thx. > > -- > -- > 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. > > > -- -- 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.