
22 Dec
2008
22 Dec
'08
1:28 a.m.
Am Sonntag, 14. Dezember 2008 15:35 schrieb Neil Mitchell:
I am fairly certain someone could write the necessary magic so:
do {'a' ~> 1; 'b' ~> 2}
becomes a map without any changes to the language at all. It seems like throwing syntax at a problem should be a last resort. I often do:
let (*) = (,) in ['a' * 1, 'b' * 2]
I find that quite elegant as an associative list, which you can then convert to a map, a hash table, use as an associative list etc.
I also think that those who are looking for Haskell will have their mind so blown by lazy evaluation that keeping their maps similar isn't so necessary :-)
Thanks
Neil
+1