Skip to content
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

Convenience of function call matching #11

Open
quasilyte opened this issue Jan 7, 2018 · 0 comments
Open

Convenience of function call matching #11

quasilyte opened this issue Jan 7, 2018 · 0 comments

Comments

@quasilyte
Copy link
Collaborator

Currently, it's somewhat inconvenient to match call expressions that have nested call expressions.

a(b(c(x), y), z)
=
(call f (call g (call c x) y) z)

At least partially, #10 solves this issue:

a(b(c(x), y), z)
(call f (call g (call c)))
(expr "a(b(c(x), y), z)")

But that will not work if any of those call expressions need any advanced features.

Some lisps solve this problem by threading macros.

(f (g (c x) y) z)
=
(->> (c x) (g y) (f z))        ;; "thread last"
(as-> (c x) $ (g y $) (f x $)) ;; "thread as"

It does not make code shorter, but helps to avoid excessive nesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant