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

Pattern matching #39

Open
zot opened this issue Jul 8, 2012 · 1 comment
Open

Pattern matching #39

zot opened this issue Jul 8, 2012 · 1 comment
Milestone

Comments

@zot
Copy link
Owner

zot commented Jul 8, 2012

Type assertions work, but more general patterns would be nice. This is a decent way to allow extending definitions.

@zot
Copy link
Owner Author

zot commented Nov 1, 2012

destructor functions can take a nested structure and return a list of values in order

structures are

struct(type partsList)
var
lit(value)

the structure for f x::[a [b c] | d] would be: struct('cons' [var struct('cons' [struct('cons' [var struct('cons' var lit(nil))]) var])]

the structure for f x::(person name addr) would be struct('person' [var var])

structures could be type[ ... ] or (type ...), with [] standing for just a cons

Patterns could work in lets, as well

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

No branches or pull requests

1 participant