CodyReichert / awesome-cl

A curated list of awesome Common Lisp frameworks, libraries and other shiny stuff.
https://awesome-cl.com
Other
2.48k stars 184 forks source link

arrow-macros threading macros #80

Closed vindarel closed 5 years ago

vindarel commented 6 years ago

with very nice ones, like some->> which returns nil if a form in the middle evaluates to nil (so like a monad).

There's cl-arrows, but less complete.

Harleqin commented 6 years ago

Cl-arrows has the advantage of being very simple and having very few dependencies. It does not need a code walker, for example, which seems to be a source of build breakage for arrow-macros.

The disadvantage is that the diamonds only work in the outermost form of each step. If you need it deeper, I think the best way would be to implement and use as->, just to avoid the need for a code walker.

(Disclaimer: I was involved in the current state of cl-arrows.)

vindarel commented 6 years ago

Thanks. Is the code walker necessary for the some-> macros, or is the lack of it in cl-arrows only due to demand and time ?

Harleqin commented 6 years ago

The code walker is needed for -<> and -<>> to find the location of <> in the next form or, if it is not there, use the appropriate default position. Cl-arrows doesn't do that and instead only looks for <> at the outermost level of the next form.

The lack of some-> etc. is mostly because the maintainer doesn't seem to be notified of pull requests. I might try to reach him in the next days.

There is a pull request open for &> and &>>, which is just like some->. I am unsure whether this shouldn't use the now established name. The implementation of some-> and as-> should be rather trivial.