Re: [stack] recursion is too hard

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Mar 12, 2009, at 5:04 AM, Chris Double wrote:

> On Thu, Mar 12, 2009 at 7:35 PM, John Nowak <[email protected]>  
> wrote:
>> The problem is that all calls to 'F' except the first see the values
>> meant to be later consed onto the list from previous calls of 'F'.
>
> So is this the issue whereby you want the quotation passed to 'map' in
> the Factor example below to be able to access the values on the stack
> to use in the calculation?

Yes; or at least not have access to intermediate states of its own  
computation.

> 5 { 1 2 3 } [ over + ] map nip
> => { 6 7 8 }
>
> Combinators require that calls to the quotation can't see
> implementation details on the stack and this makes them hard to write?
> Of so, I agree and I often fall back to locals to implement them (in
> Factor).

Not sure how locals would fix this particular problem. In the example  
I gave, the function provided was already pulled in via substitution.  
Maybe you can give an example so I can understand what you mean.

- 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.