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

Implement destructuring-bind #31

Open
hrs opened this issue Sep 27, 2015 · 3 comments
Open

Implement destructuring-bind #31

hrs opened this issue Sep 27, 2015 · 3 comments

Comments

@hrs
Copy link
Owner

hrs commented Sep 27, 2015

It'd be slick if we could perform a destructuring-bind when binding variables. Something like:

(destructuring-bind (a (b c) d) '(1 (2 3) 4)
    (list a b c d)) # => '(1 2 3 4)

I think §18 of On Lisp has some good stuff on destructuring. We could probably implement this as a macro in the standard library.

@hrs
Copy link
Owner Author

hrs commented Oct 1, 2015

We might also think about building a more general pattern-matching system, like:

(match some-expression
  ((a (a b) . rest) (do-something a b))
  (else (do-something-else some-expression)))

We could also do destructuring in function definitions, let blocks, etc.

Maybe these are all special cases of a more general Binder?

@hrs
Copy link
Owner Author

hrs commented Oct 1, 2015

Racket also has a terrific-looking library for pattern matching. Maybe we should check it out for inspiration?

@hrs hrs mentioned this issue Oct 1, 2015
@hrs
Copy link
Owner Author

hrs commented Oct 23, 2015

On second thought, while I think full-blown argument-list pattern-matching would be pretty cool, that's a whole separate issue that Blueprint might never implement. Let's keep this issue scoped to just implementing a destructuring-bind macro.

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