|Subject:||Re: [Chicken-users] optimizing mutually recursive loops|
|Date:||Mon, 16 Feb 2009 18:09:56 +0100|
Alaric Snell-Pym wrote:
Some would say that the matrix multiply should just be written in C and FFIed.
In fact, most would just (use blas) or such. But I understand it was just an example.
Concurrent Clean, a Haskell-like purely functional language that, unlike Haskell, implements mutating operations using uniqueness typing.
I'm wondering whether we could apply a similar idea to Chicken. Do you think there is any space for improvement, where we could somehow reduce GC by declaring stuff as unique? I know I'm just hand-waving at this point, I need to think more about it.
Any complex imperative algorithm involves a certain number of nested control structures, and before long, you need to add a single extra arc to that.
This is quite true and I've found Scheme's named let an excellent syntax for this kind of algorithm. You can just write the loops in the natural order of variable declaration, and then jump back and forth as you need: "Oh, I'll just restart with the 2nd outer loop here: (loop- row x (+ y 1))."
In fact, I've been writing "named loops" in other languages too, where the language lets me do it... which means, if it has a syntax for lambdas. But they never come out as nicely as in Scheme.
But written as a state machine, such extra control flow arcs are easy to add. I've been meaning for some time to experiment with writing Scheme macros that implement a state machine language designed for ease of use, and experimenting with using them.
Nice! Do you have any prototype we could play with, or ideas we could discuss?
|[Prev in Thread]||Current Thread||[Next in Thread]|