[Haskell-cafe] Re: What I learned from my first serious attempt low-level Haskell programming

2007-04-11 Thread Lennart Augustsson
OK, so there are few extra costs for unknown tail calls. First, there might be a pipeline stall if the jump address isn't loaded into a register far enough in advance before the jump. Second, you need to pass information about the number of arguments in the caller. And finally, you need to

Re: [Haskell-cafe] Compiling GHC

2007-04-11 Thread Andrew Appleyard
On 30/03/2007, at 4:36 pm, Chris Witte wrote: cp -rp ./../include/* /usr/local/include/mingw cp: cannot stat `./../include/*': No such file or directory The source paths for these copies are derived from the path of the gcc binary ($GccDir). Did you call configure with '--with-gcc=C:/

[Haskell-cafe] Re: What I learned from my first serious attempt low-level Haskell programming

2007-04-11 Thread Simon Marlow
Lennart Augustsson wrote: So then tail calls should be very cheap when most of the arguments don't change. Yes, but the problem tends to be the arguments that change, and the fact that they are passed on the stack. A C loop would keep the loop-carried variables in registers. On x86_64 you

[Haskell-cafe] Re: Weaving fun

2007-04-11 Thread Bas van Dijk
Thanks for all the wonderful solutions. I put them into one module so other people can try it out: http://hpaste.org/1338 Thanks, Bas van Dijk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: hackage.haskell.org

2007-04-11 Thread Simon Marlow
David Waern wrote: I'd like to set up a Trac for Haddock on hackage.haskell.org. Who should I contact? Let's hold off on this for now. I don't think Haddock warrants a full Trac of its own just yet, the overheads of managing a Trac are pretty high compared to editing the text file called

Re: [Haskell-cafe] Compiling GHC

2007-04-11 Thread Chris Witte
On 4/11/07, Andrew Appleyard [EMAIL PROTECTED] wrote: The source paths for these copies are derived from the path of the gcc binary ($GccDir). Did you call configure with '--with-gcc=C:/ Mingw/bin/gcc.exe'? I received those errors when I forgot to do that. Yep that fixed that. Thanks. I

Re: [Haskell-cafe] Weaving fun

2007-04-11 Thread Chris Kuklewicz
I have a simply recursive solution that operates efficiently... Bas van Dijk wrote: Hello, For my own exercise I'm writing a function 'weave' that weaves a list of lists together. For example: weave [[1,1,1], [2,2,2], [3,3]] == [1,2,3,1,2,3,1,2] weave [[1,1,1], [2,2], [3,3,3]] ==

Re: [Haskell-cafe] A convenient way to deal with conditional function composition?

2007-04-11 Thread Maxime Henrion
Chris Kuklewicz wrote: Nicolas Frisby wrote: Not portably. [EMAIL PROTECTED]:~$ ghc-6.4.2 -e '( (foo++) `Data.Monoid.mappend` (bar++) ) END' foobarEND [EMAIL PROTECTED]:~$ ghc-6.6 -e '( (foo++) `Data.Monoid.mappend` (bar++) ) END' fooENDbarEND -- 6.6 sources instance

[Haskell-cafe] GHC 6.6 hangs

2007-04-11 Thread Gleb Alexeyev
Dmitry Antonyuk (lomeo) came up with a piece of code that hung GHC 6.6: newtype Foo a = Foo (Foo a - a) bar x@(Foo f) = f x baz = bar (Foo bar) See the original discussion (in Russian) at: http://lomeo.livejournal.com/35674.html ___ Haskell-Cafe

Re: [Haskell-cafe] GHC 6.6 hangs

2007-04-11 Thread Neil Mitchell
Hi Dmitry Antonyuk (lomeo) came up with a piece of code that hung GHC 6.6: It's a documented bug in GHC: http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc GHC's inliner can be persuaded into non-termination using the standard way to encode recursion via a data type

[Haskell-cafe] Re: hackage.haskell.org

2007-04-11 Thread David Waern
David Waern wrote: I'd like to set up a Trac for Haddock on hackage.haskell.org. Who should I contact? Let's hold off on this for now. I don't think Haddock warrants a full Trac of its own just yet, the overheads of managing a Trac are pretty high compared to editing the text file

Re: [Haskell-cafe] Re: hackage.haskell.org

2007-04-11 Thread Neil Mitchell
Let's hold off on this for now. I don't think Haddock warrants a full Trac of its own just yet, the overheads of managing a Trac are pretty high compared to editing the text file called TODO in the root of the Haddock source tree :-) What do you think of the Google bug tracker? Neil and I

[Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread kynn
Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm told.) Based on this one would think that it would be much easier to learn Haskell than to learn Perl, but my

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Donald Bruce Stewart
kynnjo: Perhaps Haskell will never lend itself to something like a Perl one-liner, but still I wish that there were books on Haskell that focused on making Haskell useful to the learner as quickly as possible... If such already exist and I've missed it, please let me know. There's some

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread riccardo cagnasso
My opinion is that learnin haskell is difficult is just for the fact that when you learn programming, you probably begin with C / C++ or some other procedural/OO programming language, so you get used to think in these ways, and when you have to switch to functional paradigm, you find it

[Haskell-cafe] Re: GHC 6.6 hangs

2007-04-11 Thread Gleb Alexeyev
Neil Mitchell wrote: It's a documented bug in GHC: http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc GHC's inliner can be persuaded into non-termination using the standard way to encode recursion via a data type Thanks Neil! Sorry for the noise, I should have

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Mark T.B. Carroll
Sorry to hear of your struggles. There has been a lot of work lately on writing Haskell tutorials but there's still a long way to go, unfortunately, as I discovered when I tried recently to find the collection of sample code fragments on the wiki that I'm sure are around somewhere. I had the

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Thomas Hartman
I am also coming at haskell from a perl background. While there is some truth to what you say, I do think haskell can be used for keeping simple things simple in a way similar to perl. Though you have to search harder since the documentation / tutorials seem to be more optimized for making hard

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Dave Feustel
-Original Message- From: Mark T.B. Carroll [EMAIL PROTECTED] Sent: Apr 11, 2007 10:18 AM To: kynn [EMAIL PROTECTED] Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Why Perl is more learnable than Haskell Sorry to hear of your struggles. There has been a lot of work lately on

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread brad clawsie
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote: Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm told.) i find that don's haskell hacking blog has

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread riccardo cagnasso
The post on dons' blog about the cpu scaler is a great example on how haskell can easily used in the day-to-day hacking! 2007/4/11, brad clawsie [EMAIL PROTECTED]: i find that don's haskell hacking blog has been written with the daily hacker in mind:

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Alex Queiroz
Hallo, On 4/11/07, riccardo cagnasso [EMAIL PROTECTED] wrote: The post on dons' blog about the cpu scaler is a great example on how haskell can easily used in the day-to-day hacking! Just read it, it's a very nice post. I'm not afraid of math, but it's a relief to see some code I can

[Haskell-cafe] Left-factoring with Parsec

2007-04-11 Thread Joel Reymont
Suppose I have expr = expr : expr : expr. Can the above be left-factored to fail on empty input so that my parser doesn't go into a loop? Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread John Velman
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote: Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm told.) Based on this one would think that it would

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread David Tolpin
If you first language is LISP probably you find easy Haskell and difficult pearl. Hi, my first programming language is lisp (that is, the language I am most fluent in -- recently Common Lisp, earlier Scheme) and I find Haskell a problematic programming language (this is a fresh experience

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread jim burton
kynn wrote: Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm told.) [snip] May I ask why you want to learn it so much, if you find it so hard? I'm

Re: [Haskell-cafe] Left-factoring with Parsec

2007-04-11 Thread Lennart Augustsson
I presume your grammar has other clauses for expr, otherwise the loop is inevitable. Assuming you have other clauses you can always left-factor. Here's how those of us with weak memory can remember how to do it: Say that you have expr ::= expr : expr : expr | b Let's call the part

[Haskell-cafe] Skipping keywords with Parsec

2007-04-11 Thread Joel Reymont
Is there a way to have any Parsec combinator skip a certain set of keywords? I tried lexeme = P.lexeme lexer . (skip ) but I don't think lexeme is called for every keyword. Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe

[Haskell-cafe] Re: Skipping keywords with Parsec

2007-04-11 Thread Joel Reymont
Just in case I wasn't clear enough, I'm asking about skipping keywords represented by the skip combinator that can be located anywhere within the input. I do know about skipMany and skipMany1, in fact skip is defined in terms of these. On Apr 11, 2007, at 9:04 PM, Joel Reymont wrote: Is

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Brandon Michael Moore
On Wed, Apr 11, 2007 at 02:21:41PM +0100, Will Newton wrote: On 4/11/07, kynn [EMAIL PROTECTED] wrote: Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm

[Haskell-cafe] Weaving fun

2007-04-11 Thread Dominic Steinitz
I've been dying to do this all day but work and then family intervened. Dominic. import Data.List weave = unfoldr f where f ([],_,_) = Nothing f (x:xs,[],zs) = Just (x,([],[],[])) f (x:xs,ys,zs) = Just (x,(ys,zs,xs))

Re: [Haskell-cafe] Weaving fun

2007-04-11 Thread Chris Kuklewicz
You are correct, my weave did hide the list in the explicit composition of closure(s). I can be even more declarative and let the closure construction be implicit in weave' below... (and this message should be literate Haskell) weave' uses a fixed point and pairs to tie the knot declaratively:

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread David Tolpin
Hi, I'm guessing you're not doing it the right way. cvs -d :pserver:[EMAIL PROTECTED]:/srv/CVSROOT co SYRENE/src By using types, you implementation becomes a lot more readable. Being readable is not enough for being readable aloud. And I think a lot of people here will disagree with

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Tomasz Zielonka
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote: Perl is a large, ugly, messy language filled with quirks and eccentricities, while Haskell is an extremely elegant language whose design is guided by a few overriding ideas. (Or so I'm told.) Based on this one would think that it would

[Haskell-cafe] Re: Why Perl is more learnable than Haskell

2007-04-11 Thread Ryan Dickie
I thought I could resist this thread but I'll bite =:-() The first language i learned was basic. No real functions, simple step by step instructions. I then learned hypercard, c, c++, python, assembly, vhdl, and too many others! Now i've decided to learn haskell. I view it as a mathematicians

[Haskell-cafe] Google SoC - student allocations

2007-04-11 Thread Malcolm Wallace
Although there is still about one hour before Google officially publish the final tally of accepted Summer of Code projects, I think I now can safely reveal the 9 projects chosen for haskell.org, since we have no outstanding conflicts with other mentoring orgs. We received 64 proposals in total.

[Haskell-cafe] Matlab in Haskell

2007-04-11 Thread oleg
Ryan Dickie wrote: I also hate matlab to death. Is there any possibility of using haskell as a replacement using ghci? Yes. The strongly typed linear algebra project (Vectro) does exactly that. With an added guarantee that attempting to add or multiply matrices of inappropriate sizes is a type

Re: [Haskell-cafe] Re: Why Perl is more learnable than Haskell

2007-04-11 Thread Dan Mead
Ah... there really needs to be more literature written on switching to the functional paradigm, IMHO. That is really these guys haven't had an easy time with it. On 4/11/07, Ryan Dickie [EMAIL PROTECTED] wrote: I thought I could resist this thread but I'll bite =:-() The first language i

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Thomas Conway
On 4/11/07, riccardo cagnasso [EMAIL PROTECTED] wrote: If you first language is LISP probably you find easy Haskell and difficult pearl. I must say I agree here. I spent 10 years programming in prolog before I tried haskell. Most of my problems with haskell are because it has a rather opaque

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread kynn
riccardo cagnasso wrote: My opinion is that learnin haskell is difficult is just for the fact that when you learn programming, you probably begin with C / C++ or some other procedural/OO programming language... Actually, my first language was Scheme; I loved it, and I aced the class,

[Haskell-cafe] Haskell Weekly News: April 12, 2007

2007-04-11 Thread Donald Bruce Stewart
--- Haskell Weekly News http://sequence.complete.org/hwn/20070412 Issue 60 - April 12, 2007 --- Welcome to issue 60 of HWN, a weekly newsletter

[Haskell-cafe] k-minima in Haskell

2007-04-11 Thread raghu vardhan
What's the best way to implement the following function in haskell: Given a list and an integer k as input return the indices of the least k elements in the list. The code should be elegant and also, more importantly, must not make more than the minimum O(k*length(list)) number of operations. R

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread Donald Bruce Stewart
mrvr84: What's the best way to implement the following function in haskell: Given a list and an integer k as input return the indices of the least k elements in the list. The code should be elegant and also, more importantly, must not make more than the minimum

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Brandon S. Allbery KF8NH
On Apr 11, 2007, at 23:10 , kynn wrote: rather pragmatic. I have not been able to find enough support in Haskell for everyday tasks (e.g. read a stream from a socket; parse it into a simple The stuff in Network (not Network.Socket) gives you a Handle, which you can treat more or less

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread Stefan O'Rear
On Thu, Apr 12, 2007 at 08:58:33AM +0530, raghu vardhan wrote: What's the best way to implement the following function in haskell: Given a list and an integer k as input return the indices of the least k elements in the list. The code should be elegant and also, more importantly, must not make

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread Stefan O'Rear
On Wed, Apr 11, 2007 at 08:38:48PM -0700, Stefan O'Rear wrote: On Thu, Apr 12, 2007 at 08:58:33AM +0530, raghu vardhan wrote: What's the best way to implement the following function in haskell: Given a list and an integer k as input return the indices of the least k elements in the list.

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread Stefan O'Rear
On Wed, Apr 11, 2007 at 09:20:12PM -0700, Tim Chevalier wrote: On 4/11/07, Stefan O'Rear [EMAIL PROTECTED] wrote: If you want to be really explicit about it, here is a sort that will work: sort [] = [] sort l@(x:_) = filter (x) l ++ filter (==x) l ++ filter (x) l (A stable quicksort,

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread raghu vardhan
And just to remind people, the question is to find the indices and not the numbers themselves. For example on input '3, [10,9,8,..., 3,2,1]' the output must be '[9,8,7]'. - Original Message From: Stefan O'Rear [EMAIL PROTECTED] To: raghu vardhan [EMAIL PROTECTED] Sent: Wednesday, 11

[Haskell-cafe] c2hs on mac

2007-04-11 Thread Ruben Zilibowitz
Hi, I am having trouble building c2hs on Mac OS X. I noticed that Darwinports has a port for this, but I'd like to install it without using Darwinports because I already have ghc compiled and installed on my system. Does anyone know how to get c2hs to work on the mac (or why it doesn't

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread ajb
G'day all. Quoting raghu vardhan [EMAIL PROTECTED]: What's the best way to implement the following function in haskell: Given a list and an integer k as input return the indices of the least k elements in the list. The code should be elegant and also, more importantly, must not make more

Re: [Haskell-cafe] c2hs on mac

2007-04-11 Thread Duncan Coutts
On Thu, 2007-04-12 at 15:20 +1000, Ruben Zilibowitz wrote: Hi, I am having trouble building c2hs on Mac OS X. I noticed that Darwinports has a port for this, but I'd like to install it without using Darwinports because I already have ghc compiled and installed on my system. Does

Re: [Haskell-cafe] k-minima in Haskell

2007-04-11 Thread raghu vardhan
There seems to be some confusion about the question. There are two key things to keep in mind here: 1) You must make at most O(k*n) comparisons (in the worst case) if the list has length n. 2) The output must be the indices and not the numbers themselves. So, any algorithm that sorts is no