skaller wrote:
> On Sun, 2006-09-03 at 18:56 -0700, Erick Tryzelaar wrote:
>
>   
>> The only (minor) problem with the _ctor_list is that we're actually 
>> creating an array of PU items, and passing it into the list. John, can 
>> felix optimize away the array in this situation?
>>     
>
> No. As mentioned in prior post, all these things are general
> executable statements. In general, there is no other
> way to build a list, so this isn't a problem. You have
> to have code to make heap nodes and initialise them,
> no matter what.
>
> the real problem is that the construction is loop
> invariant .. but won't be lifted out of a loop
> or recursion (unless you lift it manually).
>   

What if we invert the "add" function for lists? Such as:

fun add[T] (x:list[T], y:T):list[T] => Cons (x, y);
noinline fun add[T] (x:T, y:list[T]):list[T] => rev$ Cons (y, rev x);

This would then make this used the optimal path:

Empty[int] + 4 + 3 + 2 + 1

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to