-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal -<<
(distribute
)
#407
Comments
Few more examples (defun -avg (values)
(->> (-<< values
((apply #'+)
(funcall (-compose #'float #'length))))
(apply #'/))) (-avg (-iota 10)) 4.5 (defun -min-avg-and-max (values)
(-<< values
(-min -avg -max))) (-min-avg-and-max (-iota 10)) (0 4.5 9) |
If there is an existing elegant way of doing |
May be it shouldn't be a macro (defmacro -<< (x forms)
`(list ,@(->> forms
(--map `(->> ,x ,it))))) just a defun like so (defun -<< (x fs)
(->> fs
(--map (funcall it x)))) You can close this bug if you want (or leave it open), I may keep adding note as I refine my thinking. For now, this The idea of
I have used this variation of |
There is a similar request to this one at -<< / swiss-arrows?. This request seems to be independent of that note ... ( I don't use Haskell, or Clojure or Common Lisp even, so my comments here are not influenced by (or un-informed about) what passes for norm in those languages.)
I think
For a concrete use case, think of generating colors in HSLUV space. First level of In other words, when you nest As a side-note, I "vaguely" recollect there being a counterpart to |
Proposal to introduce
-<<
(distribute
)-<<
looks like a fork in the pipeline, with the samearg
getting fed in to multipleforms
.With the above definition, the form
expands to
and evaluates to
Here is a non-trivial example,
evaluates to
Two
<<
in-<<
signifies that two>>
-s are used in it macro expansion. So,-<<
distribute at the last position.The text was updated successfully, but these errors were encountered: