Re: [stack] map fusion

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Aug 1, 2008, at 12:44 PM, Christopher Diggins wrote:

> On Fri, Aug 1, 2008 at 12:33 PM, Daniel Ehrenberg  
> <[email protected]> wrote:
>
>> In its fusion optimization, the compiler can just use this
>> information, rather than change the kind of program that the user
>> writes.
>
> That is a valid point. However, one of the benefits of being able to
> manipulate the concatenative program syntactically while preserving
> meaning is now lost.

This is essentially the point I was trying to make. How strong of a  
point it is I am not sure.

> There is a precedence for such a naming system in Scheme. Effectively
> "map*" is a version with side-effects. We could perhaps call it
> "map!".

I think you need to be careful here. 'map*' acts strangely because it  
is really some sort of map/fold combination. (I've not checked my  
dictionary to figure out exactly what sort of morphism it is.)

I had a related discussion with Slava last night where he took issue  
with the characterization of 'map*' as having side effects. Instead,  
he preferred to talk more meaningfully about the additional stack  
elements as loop-carried dependencies. You can find the discussion  
here (luckily, it began right around midnight):

    http://bespin.org/~nef/logs/concatenative/08.08.01

How come you never make it onto IRC chris? You're leaving me all alone  
in my type system and rewriting interests...

> For Cat which was intended for use as an intermediate language
> at least, the goal of being able to apply simply term rewriting to the
> syntax of a program (e.g. identify "[f] map [g] map" and rewrite it
> without analysis) was really quite appealing.

How far along have you gotten on this? At least in my opinion, it is  
an open question as to if function-level rewrite rules are a  
worthwhile addition to other means of optimization. Their biggest  
appeal to me isn't in their power (which likely isn't that great  
compared to more advanced methods), but rather in their simplicity  
which enables guarantees of optimization to be simply conveyed to  
users of a language. Of course, such rules are useful for other things  
like as proving program equality.

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