Re: [Haskell-cafe] Help with c2hs, structs and typedefs?

2009-03-08 Thread Magnus Jonsson
In C, if you don't typedef the struct, the name of the struct is "struct my_iovec_2", not "my_iovec_2". I don't know much about the haskell FFI, but maybe this is the problem? (by the way, why does "reply" default to replying to the sender, not the mailing list?) On Sun, Mar 8, 2009 at 1:25 PM, A

Re: [Haskell-cafe] Is Template Haskell a suitable macro language?

2007-04-24 Thread Magnus Jonsson
I have the same problem too when using Haskell. The more I try to enforce static guarantees the more I get lots of datatypes that are similar except for one or two constructors. The best way I have found to avoid this is to simply give up on some of the static guarantees and just use one datatyp

[Haskell-cafe] Haskore microtonal support

2006-09-14 Thread Magnus Jonsson
On Thu, 14 Sep 2006, Henning Thielemann wrote: On Thu, 14 Sep 2006, Magnus Jonsson wrote: Now even more interestingly, my program also deals with music! :) I'm generating microtonal midi files. I use it for very much the same purpose as you do (although my program is not yet finished).

Re: [Haskell-cafe] Optimization problem

2006-09-14 Thread Magnus Jonsson
Thanks Bruno. However I think this is still O(n*m). As far as I understand your code it is a longwinded way to say "[b | (a,b) <- input, b == myChannelOfInterest]". This is fine if you are only interested in one channel, and for that case I agree it's O(n), but if you are interested in many d

Re: [Haskell-cafe] Re: Optimization problem

2006-09-14 Thread Magnus Jonsson
Thanks Bertran for your solution. I have difficulty understanding it so I can't comment on it right now but I'll try to have a look at it. Do you know of any article that explains this technique, starting from very simple examples? /Magnus On Thu, 14 Sep 2006, Bertram Felgenhauer wrote: I w

Re: [Haskell-cafe] Optimization problem

2006-09-14 Thread Magnus Jonsson
On Thu, 14 Sep 2006, Henning Thielemann wrote: Interestingly we use such a routine in Haskore for splitting a sequence of notes into sequences of notes of equal instruments. It's implemented rather the same way like your version. It's 'slice' in http://darcs.haskell.org/haskore/src/Haskore/Ba

Re: [Haskell-cafe] Optimization problem

2006-09-14 Thread Magnus Jonsson
On Thu, 14 Sep 2006, Ketil Malde wrote: Magnus Jonsson <[EMAIL PROTECTED]> writes: splitStreams::Ord a=>[(a,b)]->[(a,[b])] splitStreams [(3,x),(1,y),(3,z),(2,w)] [(3,[x,z]),(1,[y]),(2,[w])] [...] But is there any way to write it such that each element is touched only

Re: [Haskell-cafe] Optimization problem

2006-09-13 Thread Magnus Jonsson
On Thu, 14 Sep 2006 [EMAIL PROTECTED] wrote: Any approach, even sieving, will struggle with infinite lists, won't it? (take 2 . snd . head . splitStreams) [(i, i) | i <- [0..]] Yes, if you expect two messages but only one comes then you'll wait forever, true. Regards, Tom ___

Re: [Haskell-cafe] Optimization problem

2006-09-13 Thread Magnus Jonsson
treams :: Ord a => [(a,b)] -> [(a,[b])] splitStreams = Map.toList . splitStreamsMap It fails to return a value on this test: take 2 $ snd $ head $ splitStreams (map (\x -> (0 ,x)) [1..]) / Magnus On Thu, 14 Sep 2006, Twan van Laarhoven wrote: Magnus Jonsson wrote: Dear Haskell Cafe, W

[Haskell-cafe] Optimization problem

2006-09-13 Thread Magnus Jonsson
once? Or at least an O(n*log(m)) algorithm? Any takers? / Magnus Jonsson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe