Re: [stack] Applicative Syntax == Concatenative Syntax
Robbert van Dalen <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
That's really very interesting and inventive - I like it a lot!
but I wouldn't trust such expressions with the correct counting of
parenthesis, i.e:
Add(2,Add(3,4)))
... oops, 1 closing parenthesis to many...
But I'm sure the curry function can be extended somehow (or that '('
could be redefined to do something more intelligent) to catch such
errors.
On Jan 16, 2007, at 5:49 PM, Christopher Diggins wrote:
> Consider if we were to define our stack-based (concatenative)
> functions as quotations such as:
>
> define Add { [+] }
>
> We can define the open paranthesis, close paranthesis, and comma as
> follows:
>
> define ( { }
> define , { curry }
> define ) { curry eval }
>
> This allows us to write:
>
> Add(2, 3)
>
> Which leaves the value 5 on the stack just as we would like to see.
>
> I've implemented this in the most recent version of Cat (which I have
> posted at http://www.cat-language.com/cat.zip , but haven't officially
> announced yet).
>
> --
> http://www.cdiggins.com
>
>