Re: [Haskell-cafe] Newbie question about tuples

2007-07-22 Thread Andrew Coppin
Donald Bruce Stewart wrote: Yeah, there's some known low level issues in the code generator regarding heap and stack checks inside loops, and the use of registers on x86. But note this updated paper, http://www.cse.unsw.edu.au/~chak/papers/CLPKM07.html Add another core to your machine and

Re: [Haskell-cafe] Newbie question about tuples

2007-07-15 Thread Peter Verswyvelen
Donald: Yeah, there's some known low level issues in the code generator regarding heap and stack checks inside loops, and the use of registers on x86. But note this updated paper, http://www.cse.unsw.edu.au/~chak/papers/CLPKM07.html Add another core to your machine and it is no longer 4x

Re: [Haskell-cafe] Newbie question about tuples

2007-07-15 Thread Donald Bruce Stewart
bf3: Donald: Yeah, there's some known low level issues in the code generator regarding heap and stack checks inside loops, and the use of registers on x86. But note this updated paper, http://www.cse.unsw.edu.au/~chak/papers/CLPKM07.html Add another core to your machine and it is no

Re: [Haskell-cafe] Newbie question about tuples

2007-07-15 Thread Andrew Coppin
Donald Bruce Stewart wrote: bf3: Maybe this is yet another newbie stupid question, but do you mean that GHC does automatic multi-threading? (Haskell seems very suitable for that) Otherwise adding an extra core does not really help does it? No, though that would be nice! You do have to

Re: [Haskell-cafe] Newbie question about tuples

2007-07-15 Thread Donald Bruce Stewart
andrewcoppin: Donald Bruce Stewart wrote: bf3: Maybe this is yet another newbie stupid question, but do you mean that GHC does automatic multi-threading? (Haskell seems very suitable for that) Otherwise adding an extra core does not really help does it? No, though that would be nice!

RE: [Haskell-cafe] Newbie question about tuples

2007-07-15 Thread Peter Verswyvelen
Add another core to your machine and it is no longer 4x slower :) Add 15 more cores and its really no longer 4x slower : Maybe this is yet another newbie stupid question, but do you mean that GHC does automatic multi-threading? (Haskell seems very suitable for No, though that would be nice!

Re: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Lukas Mai
Am Freitag, 13. Juli 2007 15:03 schrieb peterv: You see, in C++ I can write: [snip] So basically a wrapper around a fixed-size array of any length. Implementations of (+), (-), dot, length, normalize, etc... then work on vectors of any size, without the overhead of storing the size, and

Re[2]: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Bulat Ziganshin
Hello Donald, Saturday, July 14, 2007, 6:01:21 AM, you wrote: don't forget that laziness by itself makes programs an orders of magnitude slower :) Or orders of magnitude faster, depending on your data structure. :) compared to naive implementation - yes, it's possible. compared to handmade

Re[4]: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Bulat Ziganshin
] Sent: Friday, July 13, 2007 6:43 PM To: peterv Cc: 'Lukas Mai'; haskell-cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Newbie question about tuples Hello peterv, Friday, July 13, 2007, 5:03:00 PM, you wrote: think the latest compilers are much better). Now when implementing something like

Re: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Andrew Coppin
Lukas Mai wrote: You may be interested in http://okmij.org/ftp/Haskell/number-parameterized-types.html Thanks for that! It's all fascinating stuff... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: Re[4]: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Peter Verswyvelen
Thanks Bulat, but now you scattered my hopes that GHC would magically do all these optimizations for me ;-) I must say that although the performance of Haskell is not really a concern to me, I was a bit disappointed that even with all the tricks of the state monad, unboxing, and

Re: Re[4]: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Donald Bruce Stewart
bf3: Thanks Bulat, but now you scattered my hopes that GHC would magically do all these optimizations for me ;-) I must say that although the performance of Haskell is not really a concern to me, I was a bit disappointed that even with all the tricks of the state monad, unboxing, and

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Lukas Mai
Am Donnerstag, 12. Juli 2007 20:14 schrieb Andrew Coppin: The only thing the libraries provide, as far as I can tell, is the fact that tuples are all Functors. (In other words, you can apply some function to all the elements to get a new tuple.) I think that's about it. I doubt you can use

RE: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread peterv
://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.ht ml... Well at least I hope so :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lukas Mai Sent: Friday, July 13, 2007 09:20 To: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Newbie question

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Jonathan Cast
On Friday 13 July 2007, peterv wrote: I'm beginning to see that my old implementation in C++ clutters my Haskell design. You see, in C++ I can write: // A vector is an array of fixed-length N and elements of type T templatetypename T, int N struct Vector { T Element[N]; friend T

RE: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread peterv
* possible? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Cast Sent: Friday, July 13, 2007 16:21 To: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Newbie question about tuples On Friday 13 July 2007, peterv wrote: I'm beginning to see

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Jules Bean
peterv wrote: with guaranteed termination, of course Just out of curiosity (not Haskell related): I always get confused when people speak about guaranteed termination; what about the halting problem? In which context can one check for guaranteed termination, as the halting problem says it's

Re[2]: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Bulat Ziganshin
Hello peterv, Friday, July 13, 2007, 5:03:00 PM, you wrote: think the latest compilers are much better). Now when implementing something like this in Haskell, I would guess that its laziness would allow to interleave many of the math operations, reordering them to be as optimal as possible,

RE: Re[2]: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread peterv
PROTECTED] Sent: Friday, July 13, 2007 6:43 PM To: peterv Cc: 'Lukas Mai'; haskell-cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Newbie question about tuples Hello peterv, Friday, July 13, 2007, 5:03:00 PM, you wrote: think the latest compilers are much better). Now when implementing

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Andrew Coppin
Lukas Mai wrote: Am Donnerstag, 12. Juli 2007 20:14 schrieb Andrew Coppin: The only thing the libraries provide, as far as I can tell, is the fact that tuples are all Functors. (In other words, you can apply some function to all the elements to get a new tuple.) I think that's about it. I

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Andrew Coppin
peterv wrote: with guaranteed termination, of course Just out of curiosity (not Haskell related): I always get confused when people speak about guaranteed termination; what about the halting problem? In which context can one check for guaranteed termination, as the halting problem says

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Jules Bean
Andrew Coppin wrote: Lukas Mai wrote: Am Donnerstag, 12. Juli 2007 20:14 schrieb Andrew Coppin: The only thing the libraries provide, as far as I can tell, is the fact that tuples are all Functors. (In other words, you can apply some function to all the elements to get a new tuple.) I think

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Donald Bruce Stewart
bulat.ziganshin: Hello peterv, Friday, July 13, 2007, 5:03:00 PM, you wrote: think the latest compilers are much better). Now when implementing something like this in Haskell, I would guess that its laziness would allow to interleave many of the math operations, reordering them to be

[Haskell-cafe] Newbie question about tuples

2007-07-12 Thread peterv
Hi, I have a couple of questions about tuples. Q1) Is it possible to treat a tuple of N elements in a generic way? So instead of writing functions like lift1 e1, lift2 (e1,e2), lift3 (e1,e2,e3) just one function liftN that works on tuples of any length? Q2) (Maybe related to Q1) Can I convert

Re: [Haskell-cafe] Newbie question about tuples

2007-07-12 Thread Benja Fallenstein
Hi Peter, 2007/7/12, peterv [EMAIL PROTECTED]: Q1) Is it possible to treat a tuple of N elements in a generic way? So instead of writing functions like lift1 e1, lift2 (e1,e2), lift3 (e1,e2,e3) just one function liftN that works on tuples of any length? Q2) (Maybe related to Q1) Can I convert

Re: [Haskell-cafe] Newbie question about tuples

2007-07-12 Thread Andrew Coppin
peterv wrote: Hi, I have a couple of questions about tuples. Q1) Is it possible to treat a tuple of N elements in a generic way? So instead of writing functions like lift1 e1, lift2 (e1,e2), lift3 (e1,e2,e3) just one function liftN that works on tuples of any length? The only thing the

Re: [Haskell-cafe] Newbie question about tuples

2007-07-12 Thread Henning Thielemann
On Thu, 12 Jul 2007, Andrew Coppin wrote: peterv wrote: Q3) Suppose I want to declare an instance of Num on all tuple types having (Num instances) as elements; is this possible? I tried instance Num a = Num (a,a) where . but this fails I also tried

Re: [Haskell-cafe] Newbie question about tuples

2007-07-12 Thread Jonathan Cast
peterv wrote: Hi, I have a couple of questions about tuples. Q1) Is it possible to treat a tuple of N elements in a generic way? So instead of writing functions like lift1 e1, lift2 (e1,e2), lift3 (e1,e2,e3) just one function liftN that works on tuples of any length? If you have instances