Re: [Haskell-cafe] Parsing words with parsec

2007-03-31 Thread Paolo Veronelli
On Friday 30 March 2007 06:59, Stefan O'Rear wrote: Anyway, I think parsec is *far* too big a hammer for the nail you're trying to hit. In the end , the big hammer solution has become parseLine = fmap (map fst. filter snd) $ many parser where parser = do w - option (,False) parseAWord

Re: [Haskell-cafe] sending from Gmail (was Parsing words with parsec)

2007-03-30 Thread Paolo Veronelli
On Friday 30 March 2007 11:44, Bayley, Alistair wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paolino I'd start by not sextuple-posting, it just sextuples the ugliness ;-) Mhh, still I don't see any them in my inbox mails , probably something buggy in gmail

Re: [Haskell-cafe] sending from Gmail (was Parsing words with parsec)

2007-03-30 Thread Paolo Veronelli
On Friday 30 March 2007 11:54, Dougal Stanton wrote: On 30/03/07, Bayley, Alistair [EMAIL PROTECTED] wrote: Mhh, still I don't see any them in my inbox mails , probably something buggy in gmail configuration, sorry :/. Are you expecting to see your sent message eventually arrive in

Re: [Haskell-cafe] Arrays performance

2007-01-04 Thread Paolo Veronelli
Quoting Paolo Veronelli [EMAIL PROTECTED]: I paste new version in case you care give me some moe suggestion. import Data.Maybe import Data.List import Data.Array.Diff import System.Environment import Control.Arrow import Control.Monad import Random inc l i = l // [(i,l!i + 1)] switch l i

Re: [Haskell-cafe] Arrays performance

2007-01-03 Thread Paolo Veronelli
Quoting Udo Stenzel [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: It isn't, but not for the reasons you might suspect. You're using 'nub', which is quadratic, and your 'coupage' is also quadratic because it uses 'lookup' on a list, which is linear, a linear number of times. You can get this

[Haskell-cafe] Arrays performance

2007-01-01 Thread paolo . veronelli
Good year everyone. I'm timing the following script.I'm not expert to evaluate th O'ness of this code, I hope someone can do it. The program clusters n integers in m buckets based on their distance. Anyway I thing should be linear.So I timed som executions changing the first arg. First

[Haskell-cafe] Giving up imperative habits....

2004-07-10 Thread paolo veronelli
Usually I tend not to give much information to a subroutine intending to restrict its liberty of touching the calling information. So if I have an instance Inst which should be changed by an outside-Inst computation Sub and I'm calling Sub with Sub(I'),I try to build the story so that Sub

[Haskell-cafe] In relation to shuffling

2004-07-08 Thread paolo veronelli
Most of my imperative pieces of software find their answers by touching around in some space of solutions and my favourite approximation algorithms use random distributions. Is it haskell the wrong languages for those, as I'm obliged to code them inside Monads loosing the benefits of lazyness?

[Haskell-cafe] A binary tree

2004-07-04 Thread paolo veronelli
I want to build a binary tree where each leaf is a string of L and R defining their position from the top This should be done without context isn't it? data Tree a = Fork (Tree a) (Tree a) | Leaf a deriving Show t =Leaf treeGrower :: Tree a - Tree a treeGrower (Leaf a )= treeGrower (Fork (Leaf

[Haskell-cafe] Pruning the tree

2004-07-04 Thread paolo veronelli
Now I have my infinite tree inf t =Leaf 1 treeGrower :: Tree String- Tree String treeGrower (Leaf a )= treeGrower (Fork (Leaf (a++1)) (Leaf (a++2))) treeGrower (Fork l r) = Fork (treeGrower l) (treeGrower r) data Tree a = Fork (Tree a) (Tree a) | Leaf a deriving Show inf=treeGrower t I'd like to

[Haskell-cafe] newbie problems

2004-07-03 Thread paolo veronelli
I'd like to have a simple definition of the meanings of 'type' and 'data' and maybe a clarifing example on their use. I've read the Zipper doc on he wiki ,but I can't make it work on n-ary trees,and most of all they are not any clear the performance hits on using more complex 'data'

Re: [Haskell-cafe] newbie problems

2004-07-03 Thread paolo veronelli
On Sat, 3 Jul 2004 17:57:04 +0100 (BST), MR K P SCHUPKE [EMAIL PROTECTED] wrote: The zipper should work on n-ary trees. all the zipper does is store the tree as (Context,Subtree) What is the meaning of storing in haskell? Imagine I put numbers in the leaves... you could do something like data

[Haskell-cafe] My old chess player

2004-07-01 Thread paolo veronelli
Ok Crypt Master give the hint to pronounce something ,because I feel a complete stupid in front of Functional Programming' though I'm a trained imperative one. I've read the nice paper www.cs.chalmers.se/~rjmh/Papers/whyfp.html and remember may years ago the hard job done to make my chess