Re: [stack] map fusion

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Aug 1, 2008, at 10:01 AM, William Tanksley, Jr wrote:

>> This seems to be yet another argument against n-ary combinators where
>> the quotation is not called a fixed number of times.
>
> _This_ I don't understand. What does that mean?

I mean that in languages like Factor, allowing the quotation given to  
'map' to use any amount of the stack can make things difficult -- even  
if that quotation is appropriately balanced (e.g. 2 -> 2, 3 -> 3,  
etc). Ideally, it would be nice to have '[F] map [G] map -> [F G] map'  
be applicable in the general case, but it isn't unless you restrict  
'F' and 'G' to only using one element. Of course, given that Factor  
allows unrestricted side effects, there are other issues to deal with  
anyway.

At least from an optimization standpoint, this is not an issue in a  
language like 5th because "quotations" are supplied directly, stack  
effects are always statically determinable, and side effects are  
tracked on the type level. Still, it may be useful to offer both 'map'  
and 'map*' so that certain optimizations (like map fusion) can be  
guaranteed to the programmer more simply.

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