[Haskell-cafe] stateful walk through a tree?

2007-02-19 Thread David Tolpin
Hi, I am looking for help in design of a stateful tree walker. I have a tree-like data structure (an AST for a small language) for which there is a general stateful walk procedure. That is, each node type is an instance of a walker class, and the walk function is monadic: class Walker a where

Re: [Haskell-cafe] speeding up fibonacci with memoizing

2007-02-19 Thread Stefan O'Rear
On Mon, Feb 19, 2007 at 08:47:39AM +0100, Mikael Johansson wrote: On Sun, 18 Feb 2007, Yitzchak Gale wrote: Besides memoizing, you might want to use the fact that: fib (2*k) == (fib (k+1))^2 - (fib (k-1))^2 fib (2*k-1) == (fib k)^2 + (fib (k-1))^2 Or, you know, go straight to the

RE: [Haskell-cafe] FFI basics

2007-02-19 Thread Simon Peyton-Jones
| Thanks to everyone for all the help! Everything | is working for me now. It turns out that the main | detail I was missing was exactly what commands | to type to compile it, and how to use it in GHCI. | Pretty important detail, actually. | | Alistair - yes, there are a few simpler pages about |

Re: [Haskell-cafe] speeding up fibonacci with memoizing

2007-02-19 Thread Bertram Felgenhauer
Stefan O'Rear wrote: Prior art trumps all. (by a few %) granted it doesn't do much memoizing anymore :) gs ajb f d u, it, z s n [snip] Nice. I took the opportunity to polish my generic linear recurrence module somewhat and test its speed. It does quite well I think: using

[Haskell-cafe] Re: stateful walk through a tree?

2007-02-19 Thread apfelmus
David Tolpin wrote: I am looking for help in design of a stateful tree walker. I think that you can use Data.Traversable to great effect. Related to that are Control.Applicative and Data.Foldable. The papers that are mentioned in the Haddocks explain what these modules do and what they are

[Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Donald Bruce Stewart
Following recent discussion about a cross-implementation performance benchmark suite, based on nofib, I've gone and combined nofib with the great language shootout programs, and rewritten the build system to support cross implementation measurements. The result is: nobench

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Neil Mitchell
Hi Dons, nobench http://www.cse.unsw.edu.au/~dons/nobench.html Yhc is consistently half the speed of nhc, whereas in our tests, its typically 20% faster. Can you make sure you've built Yhi with -O (scons type=release should do it). I opened a bug just a few days ago, because I

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Ketil Malde
Donald Bruce Stewart wrote: Following recent discussion about a cross-implementation performance benchmark suite, based on nofib, I've gone and combined nofib with the great language shootout programs, and rewritten the build system to support cross implementation measurements. Great work!

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Dougal Stanton
Quoth Ketil Malde, nevermore, Wouldn't it be better to benchmark a more idiomatically correct codebase? I suppose the ideal way to do it would be benchmarks for the (1) idiomatic and (2) the highly tuned implementations. Then the compiler writers can push 1 towards 2, while the pesky shootout

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Felipe Almeida Lessa
On 2/19/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: results are quite interesting. The most recent run is available: http://www.cse.unsw.edu.au/~dons/nobench/bench.results http://www.cse.unsw.edu.au/~dons/nobench/bench.log Maybe I'm missing something, but how can ghci beat ghc

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Donald Bruce Stewart
felipe.lessa: On 2/19/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: results are quite interesting. The most recent run is available: http://www.cse.unsw.edu.au/~dons/nobench/bench.results http://www.cse.unsw.edu.au/~dons/nobench/bench.log Maybe I'm missing something, but how

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Donald Bruce Stewart
ithika: Quoth Ketil Malde, nevermore, Wouldn't it be better to benchmark a more idiomatically correct codebase? I suppose the ideal way to do it would be benchmarks for the (1) idiomatic and (2) the highly tuned implementations. Then the compiler writers can push 1 towards 2, while

[Haskell-cafe] GHCi and multi-line support ?

2007-02-19 Thread Dunric
Is it possible to write multi-line definitions in GHC interactive interpreter ? (like in Python interp. ?) When I try to write f.E. if-then-else in more then 1 line I get the following error: interactive:1:30: parse error (possibly incorrect indentation)

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Donald Bruce Stewart
Ketil.Malde: Donald Bruce Stewart wrote: Following recent discussion about a cross-implementation performance benchmark suite, based on nofib, I've gone and combined nofib with the great language shootout programs, and rewritten the build system to support cross implementation measurements.

Re: [Haskell-cafe] Recursion in Haskell

2007-02-19 Thread kahl
For absorbing the functional style of programming (which is what you really should be working on at this point), For functional style and the reasoning attitude associated with lazy functional programming, the following book is a good introduction: @Book{Bird-2000, author = {Richard

Re: [Haskell-cafe] GHCi and multi-line support ?

2007-02-19 Thread Jules Bean
Dunric wrote: Is it possible to write multi-line definitions in GHC interactive interpreter ? (like in Python interp. ?) When I try to write f.E. if-then-else in more then 1 line I get the following error: interactive:1:30: parse error (possibly incorrect indentation) It would be quite

Re: [Haskell-cafe] GHCi and multi-line support ?

2007-02-19 Thread Neil Mitchell
Hi Is it possible to write multi-line definitions in GHC interactive interpreter ? (like in Python interp. ?) As it happens, it is possible to do with WinHugs, I've just never turned it on by default. If there is massive need I'll polish this feature up and put it in the next builds.

RE: [Haskell-cafe] questions about core

2007-02-19 Thread Simon Peyton-Jones
| I am trying to get a deeper understanding of core's role in GHC and | the compilation of functional languages in general. So far I have You can find lots of stuff here http://hackage.haskell.org/trac/ghc/wiki/Commentary. At the bottom is a link to a lot of GHC-related papers. | - Exactly

RE: [Haskell-cafe] GHC throws IOError on Win32 when there is no console

2007-02-19 Thread Simon Peyton-Jones
Would it be worth opening a Trac bug report or feature request for this? And/or documenting the unexpected behaviour; perhaps here http://haskell.org/haskellwiki/GHC/GUI_programming ? Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Duncan |

Re: Re[2]: [Haskell-cafe] Why do I have to specify (Monad m) here again?

2007-02-19 Thread David House
On 18/02/07, Marc Weber [EMAIL PROTECTED] wrote: Do I still miss a point? I think Yitzchak's explanation of this was pretty good, so I recommend you check that out. You should also make sure you read Sebastian's argument, whose line of thought is similar to the one I'm going to try to develop.

[Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread Melissa O'Neill
Sorry, I'm a little late to this thread, but the topic of sieve [] = [] sieve (x:xs) = x : sieve [y | y - xs, y `mod` x /= 0] (as posted by Rafael Almeida) is somewhat dear to my heart, as I wrote a paper about it last summer and sent it in to JFP. Still waiting for a reply though. Let's

Re: [Haskell-cafe] A new code search engine

2007-02-19 Thread Mathew Mills
lang:haskell seems to work just fine for me. On 2/14/07, Adam Peacock [EMAIL PROTECTED] wrote: On 2/14/07, Stephane Bortzmeyer [EMAIL PROTECTED] wrote: http://www.krugle.com/ Unlike Google, you can specify Haskell as a language. It is true that you can't directly specify the programming

Re: [Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread Nicolas Frisby
You took my quote entirely out of context. In particular, you omitted the rest of the sentence but I'm sure that day will come. My statement was no excuse by any stretch of the imagination--I was initially confused when I saw it in your post and then a bit offended. The original intent of my

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Matthew Naylor
Hi all, GHC v Hugs v Yhc v NHC v ... ...Hacle Clean! I shoved 5 of the benchmarks that Donald used through Hacle, and compiled the outputs using version 2.1 of the Clean compiler. Results are below. As for the other examples, Hacle doesn't like non-Haskell98 and translates

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Stefan O'Rear
On Mon, Feb 19, 2007 at 08:12:14PM +, Matthew Naylor wrote: Hi all, GHC v Hugs v Yhc v NHC v ... ...Hacle Clean! I shoved 5 of the benchmarks that Donald used through Hacle, and compiled the outputs using version 2.1 of the Clean compiler. Results are below. Submit

[Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread apfelmus
Melissa O'Neill wrote: FWIW, another way to write this code (without needing to think about how fold bails early) is primes = 2: [x | x −[3,5..], all (\p − x `mod` p 0) (factorsToTry x)] where factorsToTry x = takeWhile (\p − p*p = x) primes Well, you certainly thought of the fact

Re: [Haskell-cafe] LambdaVM (was Re: Lambada and connecting Haskell to a Weblogic server)

2007-02-19 Thread Daniil Elovkov
Hello Brian I wrote you on this just some hours ago, before I had looked through haskell-cafe! That's an interesting coincidence! Anyway, moving my questions here. 1. How easy is it to interoperate with Java code (call methods, pass Java objects) for Haskell code run by LambdaVM rts? And vice

Re: Re[2]: [Haskell-cafe] Why do I have to specify (Monad m) here again?

2007-02-19 Thread Marc Weber
Hi David. I see that its useful to add complete type signatures without letting the compiler add stuff magically. This is why I've tried to write the final question down under a new topic wether it would be useful to be able to write down partial type signatures where browsing coders know that

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread Neil Mitchell
Hi Well, he was willing to make concessions for Yhc brokenness (wrt importing System.Environment - yhc's System doesn't export getArgs like the Report says it should (first tangible result of nofib: the Yhc team has fixed it)) The second tangible result should be that Yhc runs faster than

Re: [Haskell-cafe] ANNOUNCE: nobench: Haskell implementaion benchmarks. GHC v Hugs v Yhc v NHC v ...

2007-02-19 Thread David House
On 19/02/07, Neil Mitchell [EMAIL PROTECTED] wrote: The second tangible result should be that Yhc runs faster than nhc. Our internal testing originally showed a 20% speedup over nhc - something seems to have gone wrong to slow down Yhc, so we are working to fix this. Hopefully in a few days Yhc

Re: [Haskell-cafe] FFI basics

2007-02-19 Thread Yitzchak Gale
Simon Peyton-Jones wrote: Yitz, Please do make time to do this! This is the moment, while it is still fresh in your mind. Of course, you are correct. Thanks for the push. I am a bit busy with work, but the information is not lost. I'll have it up soon. Regards, Yitz

Re: [Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread Yitzchak Gale
Hi Melissa, I enjoyed your article. I especially like your trick of starting with p*p. You wrote: Which seems reasonable, until you realize that every prime p we come up with is still considered by k deleteOrd filters, where k is the number of primes that preceeded it. It is true that I have

[Haskell-cafe] Re: Recursion in Haskell

2007-02-19 Thread Benjamin Franksen
P. R. Stanley wrote: Chaps, is there another general pattern for mylen, head or tail? mylen [] = 0 mylen (x:xs) = 1 + mylen (xs) head [] = error what head? head (x:xs) = x tail [] = error no tail tail (x:xs)= xs There are of course stylistic variations possible, e.g. you can use case

Re: [Haskell-cafe] Recursion in Haskell

2007-02-19 Thread Matthew Brecknell
P. R. Stanley: is there another general pattern for mylen, head or tail? mylen [] = 0 mylen (x:xs) = 1 + mylen (xs) head [] = error what head? head (x:xs) = x tail [] = error no tail tail (x:xs)= xs Benjamin Franksen: Another very common 'pattern' is to factor the recursion into a

[Haskell-cafe] ANNOUNCE: Derangement version 0.1.0

2007-02-19 Thread dgriffi3
This is the inital version of a very small library, mostly using the functional graph library, to find a derangement of a set, or rather a list. A derangement of a set is a permutation with no fixed points, like many constrained matching problems it is susceptible to solution via a Max-flow

[Haskell-cafe] Re: Genuine Eratosthenes sieve [Was: Optimization fun]

2007-02-19 Thread Melissa O'Neill
apfelmus wrote: I think that the `mod`-algorithm counts as sieve, it just does a bad job at organizing the crossing off. I'd say that it might count as a sieve, but *algorithmically* it is not The Sieve of Eratosthenes. If you abstract away the algorithmic details to a mathematical

Re: [Haskell-cafe] Re: Does laziness make big difference?

2007-02-19 Thread Nick
apfelmus, Cool! I really like your examples! Thank you. Nick. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] our worst unsafePerformIO nightmares are upon us!

2007-02-19 Thread Clifford Beshers
Nicolas Frisby wrote: http://www.thinkgeek.com/geektoys/cubegoodies/86b8/ Now you can really show your coders why unsafePerformIO is to be avoided! On the contrary, seems like a little more non-determinism would really make that thing into an effective weapon. ;-)