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

Fix rendering of VFun in Shonkier.Pretty #37

Closed
gallais opened this issue Mar 24, 2020 · 3 comments
Closed

Fix rendering of VFun in Shonkier.Pretty #37

gallais opened this issue Mar 24, 2020 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers shonkier Everything related to the language

Comments

@gallais
Copy link
Member

gallais commented Mar 24, 2020

At the moment we dump the LocalEnv' a and print the raw clauses. This is
of course buggy, cf. anonymous.gold where the result of evaluating:

{ x -> { y -> x }}('hi)

is printed as

{y -> x}

instead of

{y -> 'hi}

We can:

  • either print an explicit substitution (adding let-bindings to the
    language would even allow us to make these valid syntax)

  • or perform the substitution before printing the clauses

@gallais gallais added bug Something isn't working shonkier Everything related to the language good first issue Good for newcomers labels Mar 24, 2020
@pigworker
Copy link
Contributor

I'm in favour of adding at least a non-recursive let to the language.

It's worth considering first class environments...

@pigworker
Copy link
Contributor

pigworker commented Mar 24, 2020

Sicko that I am, I kind of want to write explicit environments with a surface syntax uncannily like js objects. E.g.,

{x:5, y:['a 'b 'c]}

which is sugar for

[['x|5] ['y|['a 'b 'c]]]

Syntactically, environments are invoked by application syntax, just like all the other forms of contextualisation. So

{x:5}(x+x)

should yield 10.

Further bikesheddery about whether these things should be comma-separated (they could be space-separated) and whether we might choose =, not : (anything but ->) is welcome.

One should also note that {} currently means the function which evaluates its arguments, then throws a match exception. I'd suggest that {} is more useful as the empty environment.

@pigworker
Copy link
Contributor

But perhaps "explicit environments" should be its own issue.

As you might imagine, I have played this game before...in the 1990s...in my peculiar dialect of Logo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers shonkier Everything related to the language
Projects
None yet
Development

No branches or pull requests

2 participants