On Wed, 6 Aug 2003, Fredrik Petersson wrote:
Hi there! Iam new to the list so feel free to shout at me when i do wrong! :) Software-designer from sweden, likes fast bikes and metal, thats me, and hi to you all!
Yeah ok to the problem, i have this stupid code, [c | (c,i) <- l]
Where (c,i) are a tuple from a (Char,Int) and l is a [(Char,Int)] So far everthings nice but i would like to cast the c to a Sting and add : in front,
List comprehensions are overrated =) How about this: concatMap ( (':':) . (:[]) . fst ) [('d',3),('f',3)] concatMap maps a function to each element and then concatenates the list. So the function will first use fst to extract the first element from a tuple, then it will use (:[]) on the result to create a singleton list of the element, then it will use (':':) which will add ':' to the front of the list... Now what's not clear about THAT =) (okay so maybe list comprehensions would be clearer in this case)
How do you TypeCast in haskell?
BWUAHAHAHA!! HAHAHAA! *tears* =) -- ---------------------------------------- | Sebastian Sylvan | | ICQ: 44640862 | | Tel: 073-6818655 / 031-812 817 | | | | | | Hard Work Often Pays Off After Time | | But Laziness Always Pays Off Now! | ----------------------------------------