More suitable data structure needed

2002-08-21 Thread Dr Mark H Phillips
Hi, Consider the following data structure, effectively of type [[(Int,Int)]]: (2,5) (1,3) (2,0) (2,5) (1,2) (1,1) (1,0) (2,5) (3,1) (1,5) (2,4) (2,0) (1,5) (1,4) (1,3) (1,1) (1,0) (1,5) (1,4) (2,2) (1,0) (1,5) (1,4) (1,2) (2,1) (1,5) (2,3) (1,2) (1,0) (1,5) (2,3) (2,1) (1,5) (1,3) (2,2) (1,1)

Re: More suitable data structure needed

2002-08-21 Thread Dr Mark H Phillips
On Wed, 2002-08-21 at 16:52, Hal Daume III wrote: I would consider using a prefix trie. Unfortunately, such a structure is not built in to Haskell. Thanks for this! It seems that this kind of data structure is what I am looking for. [begin aside] It seems a pity that one needs to give

Re: More suitable data structure needed

2002-08-22 Thread Dr Mark H Phillips
On Wed, 2002-08-21 at 17:50, Dylan Thurston wrote: This is the same as one way of representing search trees, called a trie. Two representations in Haskell are: data Trie a = Trie [(a, Trie a)] I touched on the following in my response to Hal Daume's email, but it's probably worth asking

where block local to a guard?

2002-09-16 Thread Dr Mark H Phillips
doing something wrongly, or is there a good reason why where isn't allowed to be used in this way? Thanks, Mark. -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling solutions - www.austrics.com Level 2, 50 Pirie Street, Adelaide SA 5000, Australia Phone +61 8

Re: where block local to a guard?

2002-09-17 Thread Dr Mark H Phillips
Thanks for the explanation! On Tue, 2002-09-17 at 19:07, Brian Boutel wrote: You can't do this because where clauses are not part of the expression syntax. If they were, expressions like let a=b in c where d=e or if a then b else c where d=e whould be ambiguous, unless you

Good layout style? (was: Re: where block local to a guard?)

2002-09-17 Thread Dr Mark H Phillips
On Wed, 2002-09-18 at 01:26, Hamilton Richards wrote: You can get the effect you're after by using let-expressions: functn :: Int - Int functn i | i5 = let t = functn (i-2) in t * i | i0 = let t = functn (i-1) in t * i | otherwise = 1 'where' is part

Behaviour of div mod with negative arguments?

2002-09-25 Thread Dr Mark H Phillips
the unary - has weak binding? -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling solutions - www.austrics.com Level 2, 50 Pirie Street, Adelaide SA 5000, Australia Phone +61 8 8226 9850 Fax +61 8 8231 4821 Email [EMAIL PROTECTED

Best recursion choice for penultimax

2002-11-24 Thread Dr Mark H Phillips
= (m,p) | mq = (p,m) | otherwise = (p,q) where (p,q) = maxpenmax ms How do I work out which is best to use? Is there one clear winner, or will they each have pros and cons? Thanks, Mark. -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling

RE: Best recursion choice for penultimax

2002-11-25 Thread Dr Mark H Phillips
20180 your penultimax2 746610344 your penultimax3 860513782 Hope this helps (or at least, is entertaining :-) Yes. Thanks! Mark. -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling solutions - www.austrics.com Level 2, 50

Re: Best recursion choice for penultimax

2002-11-25 Thread Dr Mark H Phillips
. Is there documentation on List.hs, along the lines of the A Tour of the Haskell Prelude? Thanks, Mark. -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling solutions - www.austrics.com Level 2, 50 Pirie Street, Adelaide SA 5000, Australia Phone +61 8 8226 9850 Fax

Function composition and currying

2003-07-16 Thread Dr Mark H Phillips
. -- Dr Mark H Phillips Research Analyst (Mathematician) AUSTRICS - smarter scheduling solutions - www.austrics.com Level 2, 50 Pirie Street, Adelaide SA 5000, Australia Phone +61 8 8226 9850 Fax +61 8 8231 4821 Email [EMAIL PROTECTED] ___ Haskell

Re: Function composition and currying

2003-07-25 Thread Dr Mark H Phillips
Thanks to all the people who responded to my question! The solution from Wolfgang Jeltsch: (f.).g was what I was after. But the other responses were useful also. Thanks! Mark. On Thu, 2003-07-17 at 09:57, Dr Mark H Phillips wrote: Hi, Hopefully this is a simple question. I am wanting

Re: Combining distinct-thread state monads?

2004-01-08 Thread Dr Mark H Phillips
Hi Wolfgang, Thanks for your informative reply. At first I didn't understand it, but a search on StateT lead me to the paper Monad Transformers and Modular Interpreters by Liang, Hudak and Jones, which clarified some of the ideas for me. The state transformer approach seems to have advantageous

Re: Combining distinct-thread state monads?

2004-01-08 Thread Dr Mark H Phillips
On Tue, 2004-01-06 at 22:58, Graham Klyne wrote: I'm not an expert in this, but I think what you are proposing is possible, to a point, possibly assuming that your monads have associated functions to combine and separate the monadic parts. Thanks for the below illustration of how this