Skip to content

Convenience of function call matching #11

@quasilyte

Description

@quasilyte

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions