Re: [stack] language hierarchy
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Dec 10, 2007, at 7:30 PM, William Tanksley, Jr wrote:
>> You would have problems in Cat because of the fact that you can't
>> write:
>> 1 2 [define f { 3 4 }]
>
> Clearly, the 'define' part of Cat is not itself concatenative. That's
> okay; Joy has a non-concatenative superset. So does every other
> practical concatenative language. The only way around that is to use
> dynamically scoped definitions.
The language I'm working on has define (spelled 'def') as a normal
function with type "A (B -> C) sym -> A". This allows one to define
new functions without special syntax:
(sqr swap sqr + sqrt) :hypot def
This has the downside that functions cannot make use of explicit
recursion (as hypot isn't defined until def is called, and hence the
quote can't make use of it), but this restriction is in place anyway
due to the type system.
- John