Re: [Haskell-cafe] Graphical graph reduction
2008/2/22 <[EMAIL PROTECTED]>: > Does anybody know if such a tool exists? I'd be grateful for pointers if it > does. I very much doubt that I'm the first person who has thoughts like > this, but then again, who knows. People who really know Haskell might think > this is too trivial a task to really be worth spending time on. > > If nothing similar exists, I was thinking about creating such a tool (i.e. > an interpreter with additional graph-displaying features) for a very, very > small subset/dialect of Haskell. I would probably be lazy (no pun intended) > and start right away with abstract syntax trees to avoid lexing and parsing > and such. My language of implementation would be SML, using references as > the edges of the graph. > > Any ideas/comments would be welcome. > Rather than spending time on a project specifically to do this, it seems like a great addition to GHCi's still mostly theoretical debugger. I'll understand if you don't want to take on such a project right now, though. I'm not aware of any program that does exactly what you're asking for, but I'm attaching a lambdabot interaction for your reading pleasure. I believe it will speak for itself. < Baughn> > let fibs = 1 : 1 : zipWith (+) fibs (tail fibs) in fibs :: [Expr] < lambdabot> [1,1,1 + 1,1 + (1 + 1),1 + 1 + (1 + (1 + 1)),1 + (1 + 1) + (1 + 1 + (1 + (1 ... 1 -- In a demon-haunted world, science is a candle in the dark http://dresdencodak.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
Hello dainichi, Friday, February 22, 2008, 6:55:54 PM, you wrote: > If nothing similar exists, I was thinking about creating such a > tool (i.e. an interpreter with additional graph-displaying features) not exactly this, but now i'm reading introduction into Q language [1] which says on p.11 "The interpreter has a built-in symbolic debugger which allows you to execute a reduction sequence step by step: ...", so you may use it to demonstrate how reductions work. Q by itself is rather interesting language - haskell-like syntax, dynamic, eager with good support for laziness. btw, this manual is probably better than we have for Haskell, i've seen programmers who thinks that Haskell is hard to learn and Q is simple and may be it's just due to its manual which takes into account typical learning problems and explains "obvious" things (which are really obvious only for seasoned FP programmers) [1] http://switch.dl.sourceforge.net/sourceforge/q-lang/qnutshell-0.5.pdf -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
dainichi wrote: > > Now to the point: Wouldn't it be great if I had a visual tool that > visually > showed me the graph while the above evaluation unfolded? I could use it to > show some of my co-workers to whom laziness is a mystery, what it's all > about. > Check out http://thyer.name/lambda-animator/. Requires Java. Explores several forms of laziness and them some. -- View this message in context: http://www.nabble.com/Graphical-graph-reduction-tp15637156p15649433.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
I think HOPS is what you are looking for http://www.cas.mcmaster.ca/~kahl/HOPS/ It may advertize itself otherwise, but the main thing you 'see' when running programs in fully explicit mode is exactly all the graph reductions. Jacques ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
Is there any place that can we download the HOPS program itself? It unfortunately doesn't seem available from that page. On 24/02/2008, Jacques Carette <[EMAIL PROTECTED]> wrote: > I think HOPS is what you are looking for > > http://www.cas.mcmaster.ca/~kahl/HOPS/ > > > It may advertize itself otherwise, but the main thing you 'see' when > running programs in fully explicit mode is exactly all the graph reductions. > > > Jacques > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graphical graph reduction
On 2/24/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > (define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs) > nth n (x:xs) = if n == 0 then x else nth (n-1) xs I'm guessing it's some kind of lisp variant? (define nth (lambda (n xs) (cond ((consp xs) (if (= n 0) (head xs) (nth (- n 1) (tail xs (t nil))) -- Taral <[EMAIL PROTECTED]> "Please let me know if there's any further trouble I can give you." -- Unknown ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe