reorganizing/naming args with partial
From what I can tell, `partial` goes 'in order'. As such, you can't pass it a fn that takes 1 args and the 2nd...nth args. In Python, at least, you can explicitly name positional arguments, e.g. def my_func(x, y, z): return x + y * z p -- 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.
reorganizing/naming args with partial
(Accidentally hit 'enter' prematurely :( ) From what I can tell, `partial` goes 'in order'. As such, you can't pass it a fn that takes 1 args and the 2nd...nth args. In Python, at least, you can explicitly name positional arguments, e.g. def my_func(x, y, z): return x + y * z p = partial(my_func, 1, 2) p2 partial(my_func, y=3, z=4) Is there a similar thing in Clojure? Or is the answer suck it up and use anonymous functions, you baby? -- 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.
Re: reorganizing/naming args with partial
On Friday, October 24, 2014 10:27:58 AM UTC-4, Sam Raker wrote: (Accidentally hit 'enter' prematurely :( ) From what I can tell, `partial` goes 'in order'. As such, you can't pass it a fn that takes 1 args and the 2nd...nth args. In Python, at least, you can explicitly name positional arguments, e.g. def my_func(x, y, z): return x + y * z p = partial(my_func, 1, 2) p2 partial(my_func, y=3, z=4) Is there a similar thing in Clojure? Or is the answer suck it up and use anonymous functions, you baby? Both. There's #(my-func % 3 4), which is actually shorter than partial(my_func, y=3, z=4) and means the same thing and is an anonymous function. So suck it up. :) -- 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.