Hi, I originally interpreted Erik's reply to mean -> Instead of `#(last (sort %&))` do `#((comp last sort) %&)`. This works without any issue.
Herwig's suggestion was about replacing the entire anonymous function with `(comp last sort vec)`. The example you gave `((comp last sort) 3 2 1)`, even if we make it `((comp last sort vec) 3 2 1)`, it will throw an error about `vec` being called with too many parameters. For it to work with variable args, as Herwig said in his reply to me, we need a function that can return a sequence from a varargs. `vector` or `list would work, not `vec`. It should be `((comp last sort list) 3 2 1)`. Please correct me if I am understanding this wrong. On Thursday, 13 August 2015 16:13:24 UTC+5:30, Tassilo Horn wrote: > > Amith George <strid...@gmail.com <javascript:>> writes: > > >> That's not the same function as #(last (sort %&)) > >> The equivalent would be (comp last sort vec) > > > > Could you please explain why is the `vec` needed? From what I > > understand, we are expected to treat the variadic args argument as a > > seq, nothing more. > > With ((comp last sort) 3 2 1), sort will be called as > > (apply sort (list 3 2 1)) > > which essentially is > > (sort 3 2 1). > > Hovever, sort is no varargs function but wants a collection. > > Bye, > Tassilo > -- 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/d/optout.