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

Allow pattern-overloading to work with paired abstractions #9

Open
mn200 opened this issue Sep 5, 2011 · 3 comments
Open

Allow pattern-overloading to work with paired abstractions #9

mn200 opened this issue Sep 5, 2011 · 3 comments

Comments

@mn200
Copy link
Member

mn200 commented Sep 5, 2011

When parsing, the system doesn't do a paired β-reduction, and when printing, it doesn't recognise the term as an abstraction, and so fails to do any useful pattern-matching.

@ghost ghost assigned mn200 Sep 5, 2011
@mn200
Copy link
Member Author

mn200 commented Oct 23, 2014

For example, it would be nice to be able to do

overload_on("Foo", ``λ(x,y). x + y * 2``)

and then have occurrences of the pattern get printed as, e.g.,

Foo(3,z+1)

If one typed Foo p, then the printer would probably come back with

(λ(x,y). Foo(x,y)) p

but I don’t think that’s a big problem.

@acjf3
Copy link
Contributor

acjf3 commented Mar 23, 2016

This seems to have been implemented.

@acjf3 acjf3 closed this as completed Mar 23, 2016
@mn200 mn200 reopened this Mar 23, 2016
@mn200
Copy link
Member Author

mn200 commented Mar 23, 2016

This session shows that things are still not quite right:

> overload_on("Foo", ``λ(x,y). x + y * 2``);
val it = (): unit
> ``2 + 3 * 2``;
val it = ``2 + 3 * 2``: term
> ``Foo(2,3)``;
val it = ``Foo (2,3)``: term
> dest_term it;
val it = COMB (``λ(x,y). x + y * 2``, ``(2,3)``): lambda

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

2 participants