Re: [stack] sweetening concatenative syntax

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Mar 6, 2008, at 8:01 PM, William Tanksley, Jr wrote:

> John Nowak <[email protected]> wrote:
>
>> Lambdas don't have anything to do with
>> it; they just let you write it in a way that makes it look more like
>> pattern matching. You can write it without variables if you prefer.
>> You can even write it with just one variable which is actually nicer:
>>
>>    f map = []
>>            [xs -> f i xs f map cons]
>>          unlist
>
> Okay, so the challenge is to write that entirely without variables
> (i.e. without the benefit of lambdas). Let's try.

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.

> Arguably no worse than yours; the body of my definition contains six
> words, matching yours if we don't count your lambda and its variable
> (beating it otherwise).

This seems like a poor way of measuring how easy it is to read and  
write code. At least in my case, I know I wrote the pointful version  
in about 15 seconds. It took me over a minute to write the pointfree  
version. (Perhaps I just need more practice.) I also think the  
pointful version is easier to read, although we can certainly disagree.

- John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.