Re: [stack] sweetening concatenative syntax
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Mar 6, 2008, at 9:06 PM, John Nowak wrote:
> You must've missed my response to you earlier where I gave this
> translation:
>
> map = swap
> []
> [rot dup 2dip swap map cons]
> unlist
>
>> map = [] [ bury over i rot map cons ] unlist
>
> Small point: You forgot the initial swap to put the list on top of the
> stack. The type system would've saved you of course.
Oh crap. We're both wrong. In particular, if the list is null, neither
of us remembered to pop the function. I also put in a swap for no
reason. We both forgot to place a null back on top in the empty case
too. Oi!
This should work:
map = swap ; put the list on top
[pop null] ; remove 'f', restore the null
[rot dup 2dip map cons] ; i swear this works now
unlist
Perhaps this series of errors is just another argument for lambda
expressions and types. :) Considering the multitude of errors, I'd say
it's a pretty strong one...
- John