On Thursday, October 27, 2016 at 6:24:19 PM UTC-4, Marek Kubica wrote:
>
>
> But that is rather verbose and naming the `coll` argument is kinda
> pointless, so you can simplify it to
>
> #(map str/lower-case %)
>
> And as you see, have a function which calls a function (`map`) with
> the first n arguments (in this case 1) pre-set (`str/lower-case`).
> Therefore you can use `partial` do do just that:
>
> (partial map str/lower-case)
>
> All of these functions are equivalent and you can use them in the
> `comp` call. There are some stylistic disagreements whether `#()` or
> `partial` is nicer, but that's a story for another time :)
>
Thanks, it's helpful to consider the anonymous function literal version of
the `map` with `str/lower-case` function. I think that also highlights why
the first function in the `comp` doesn't use `partial` and instead uses
`#()', because of the position of the variable argument:
#(str/split % #"(?<=[a-z])(?=[A-Z])")
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.