msp-strath / Mary

Mary is the successor of Marx, a content delivery and assessment engine based on markdown and git
17 stars 1 forks source link

Fix rendering of VFun in Shonkier.Pretty #37

Closed gallais closed 4 years ago

gallais commented 4 years ago

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:

pigworker commented 4 years ago

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

It's worth considering first class environments...

pigworker commented 4 years ago

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 commented 4 years ago

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.