I don't know how this would translate to Factor, but in Scheme I
always liked this library:
http://mumble.net/~campbell/darcs/foof-loop/foof-loop.txt

On Fri, Jul 17, 2009 at 8:55 PM, Slava Pestov<[email protected]> wrote:
> On Fri, Jul 17, 2009 at 10:11 AM, Darrin Thompson<[email protected]> wrote:
>> I got a lot more work done in factor when I quit worrying about
>> generators and just used combinators to do the same work. I think in
>> many cases the compiler manages to optimize out intermediate lists,
>> etc.
>
> The compiler does not optimize out intermediate data structures;
> there's no deforestation optimization or anything like that. Immutable
> tuples can get unboxed in some cases but that's about it.
>
>> Maybe "Stream Fusion" ideas from Haskell would be a better fit in Factor 
>> anyway?
>
> Yes, fusion would be a great optimization since it would speed up code
> like this,
>
> [ .. ] map [ ... ] map [ ... ] filter [ ... ] reduce
>
> I'm not sure how this could be implemented in the current compiler,
> though. At the very least it would need analysis to determine that the
> loop bodies are side effect free.
>
> Perhaps an easier approach would be to write some kind of DSL using
> macros that performs loop fusion for you, sort of like Common Lisp
> 'series', instead of trying to infer intent from general-purpose
> iterative code? Anyone want to give this a shot?
>
> Slava
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to