Python style.

Fredrik Aronsson d98aron at dtek.chalmers.se
Thu May 11 13:41:40 EDT 2000


In article <8feld6$8h8$1 at nnrp1.deja.com>,
	Andrew Cooke <andrew at andrewcooke.free-online.co.uk> writes:
> In article <8feioj$fei$1 at nyheter.chalmers.se>,
>   d98aron at dtek.chalmers.se (Fredrik Aronsson) wrote:
>> Well, using Haskells syntax, I would suggest
>> map((\a,b,c -> a+b+c), p,q,r)
> 
> what's that funny backslash for?
> 

\ is like lambda:

Perhaps it was chosen to look like the mathematical expression:
\
 \
/ \a b c.a+b+c

Haskell has a lot of nifty features and very nice syntax. Have anyone 
written a comparison?
Here is the original problem solved in Haskell anyway:

list1 = [ 1,2,3,4,5,6 ]
list2 = [ 6,5,4,3,2,1 ]

zipWith (-) list1 list2

(well, if you want print it nicely, you probably need
putStr (unlines (map show (zipWith (-) list1 list2)))
instead)

/Fredrik



More information about the Python-list mailing list