[Haskell-cafe] Process properties as global values

2004-07-04 Thread Volker Wysk
Hi I'm just wondering, why haven't process properties (such as the command line arguments, or the parent process id), which are inherently global, been made global values in the Haskell standard? You could avoid needlessly carrying around these values, you wouldn't need to lift some functions

[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] Using Product Algebraic types

2004-07-04 Thread Crypt Master
Hi My question is how do I select or work with product Alhebraic types ? Let you give you some context: I need to be able to work with a list of items whos structure is onyl partially know. That is at the level of this module I dont care about what rest of it is. So I have this: type Fitness

[Haskell-cafe] Question on Exercise from SOE

2004-07-04 Thread Crypt Master
Hi Not looking to get flamed, just offering my opinion. I got the SOE first, and while I like the higher level of it, the way he thinks etc... I found it hard to learn haskell from it. I just recieved Haskell: The Craft of cuntional Programming this weekend, and have made huge leaps forward

Re: [Haskell-cafe] A binary tree

2004-07-04 Thread Sven Panne
paolo veronelli wrote: 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? I'm not sure what you mean with context here, but anyway... data Tree a = Fork (Tree a) (Tree a) | Leaf a deriving Show t

Re: [Haskell-cafe] Question on Exercise from SOE

2004-07-04 Thread wilkes joiner
I strongly recommend Yet Another Haskell Tutorial by Hal Daume III et al.  in conjuction or prior to CFP book.  It's really helped clear some things ups for me. It seems more pragmatic and less academic than the other learning haskell resources. Here's the link -

RE: [Haskell-cafe] Using Product Algebraic types

2004-07-04 Thread Stefan Holdermans
Crypt Master, CM I need to be able to work with a list of items whos CM structure is onyl partially know. That is at the level CM of this module I dont care about what rest of it is. CM So I have this: type Fitness = Integer data Population a = Population [Fitness a] Well, first of

Re: [Haskell-cafe] Process properties as global values

2004-07-04 Thread Alastair Reid
I'm just wondering, why haven't process properties (such as the command line arguments, or the parent process id), which are inherently global, been made global values in the Haskell standard? You could avoid needlessly carrying around these values, you wouldn't need to lift some functions

[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

Re: [Haskell-cafe] Process properties as global values

2004-07-04 Thread Georg Martius
On Sun, 4 Jul 2004 19:17:53 +0100, Alastair Reid [EMAIL PROTECTED] wrote: I'm just wondering, why haven't process properties (such as the command line arguments, or the parent process id), which are inherently global, been made global values in the Haskell standard? You could avoid needlessly

RE: [Haskell-cafe] Using Product Algebraic types

2004-07-04 Thread Crypt Master
Hi Man, your a genius :-) Thanks for the help , still dijesting it. Interestingly enough I was playing with how to use sacnl1 just before I got this message from you, but as you mentioned I was battling with kind errors so I never got to test my idea besides on paper. Am I correct in assuming

Re: [Haskell-cafe] Process properties as global values

2004-07-04 Thread David Menendez
Alastair Reid writes: I'm just wondering, why haven't process properties (such as the command line arguments, or the parent process id), which are inherently global, been made global values in the Haskell standard? You could avoid needlessly carrying around these values, you wouldn't

RE: [Haskell-cafe] Using Product Algebraic types

2004-07-04 Thread Stefan Holdermans
Crypt Master, data Population a = Population [(Fitness, a)] CM Am I correct in assuming that your definition of CM Popoulation is now using tuple and not product types ? Yes, you are. If you really want to use a new product, you can of course: data FitnessProd a = FProd Fitness a

Re: [Haskell-cafe] Question on Exercise from SOE

2004-07-04 Thread Andrei de A. Formiga
I have to second that... even having previous experience with other functional languages and some other books on the subject, Yet Another Haskell Tutorial was a very good read. I am waiting to see the parts that remain to be finished. --- []s, Andrei de A. Formiga --- wilkes joiner [EMAIL

Re: [Haskell-cafe] Using Product Algebraic types

2004-07-04 Thread Sven Panne
David Menendez wrote: [...] If that turned out to be a performance bottleneck, you could factor out pair and write f directly: [...] ... or directly complain to your compiler supplier if the compiler in question does not do this simple transformation for you. :-) sigh I always get a bad feeling

Re: [Haskell-cafe] Process properties as global values

2004-07-04 Thread Alastair Reid
Sorry, but why does [making process properties global values] not break the purity? If i call a function, that depends on global parameters twice within different environments it behaves different. The argument goes that purity is concerned with what happens in a single run of the program

Re: [Haskell-cafe] Using Product Algebraic types

2004-07-04 Thread David Menendez
Sven Panne writes: David Menendez wrote: [...] If that turned out to be a performance bottleneck, you could factor out pair and write f directly: [...] or directly complain to your compiler supplier if the compiler in question does not do this simple transformation for you. :-)

Re: [Haskell-cafe] Pruning the tree

2004-07-04 Thread Clive Brettingham-Moore
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 Welcome to Haskell programming -