[Haskell-cafe] Graphical graph reduction

dainichi at gmail.com dainichi at gmail.com
Sun Feb 24 18:46:20 EST 2008


Thank you all for showing interest and responding.

> Check out http://thyer.name/lambda-animator/. Requires Java.

Wow, this is SUCH a cool tool. Best discovery in a long time! I think
I need to brush up on my lambda-calculus, because it took me some time
to figure out what settings to use to get something similar to
Haskell. Function strategy "substitute by name", Argument strategy
"call by need" and Reduce to "weak head normal form" seem to work OK,
though.

One issue, though. When trying out my infinite-list-of-fibs example, I
have an auxiliary function

(define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs)))))

and this is not behaving the way I want, i.e. like the Haskell function

nth n (x:xs) = if n == 0 then x else nth (n-1) xs

because it doesn't do pattern matching, i.e. it doesn't force the
argument to be evaluated until it fits the x:xs pattern. I can't
figure out to simulate this eager pattern in the lisp that the
lambda-animator uses. This means that if I e.g. do a (nth 8 fibs) in
the animator, I get a long string of tail's before it actually starts
expanding the fibs list...

Anyway, on the side, I also started working on this myself in SML New
Jersey. (Sorry, this will probably make me unpopular here on
Haskell-cafe, but the ability to use references was just too tempting,
and I'm not too experienced with purely functional data structures).
My approach isn't as general, though, I don't have lambda's and
apply's in my syntax tree. I just have functions there as nodes, and
then the application of them has to be implemented as reduction rules.
This approach does make the graph a bit less messy to look at, though.
Also, since I implement the reduction rules myself, the pattern
matching problem described above isn't a problem.

> I think HOPS is what you are looking for
> http://www.cas.mcmaster.ca/~kahl/HOPS/

Yes, HOPS looks very promising. However, I cannot find the download
link either. And Kahl hasn't replied to my email yet.

Again, thank you all for replying.
Kai


More information about the Haskell-Cafe mailing list