[Haskell-beginners] question about list comprehension or creating array
Ching-Chao Chang
CChang at geodigmcorp.com
Mon Jan 17 16:29:27 CET 2011
Hi,
I want to create an immutable array like this
In .hs file
e = [1,2,3]
a = array [1,3] [(i,v) | i<-[1..3], v<-e]
I expect the output to be
"array (1,3) [(1,1),(2,2),(3,3)]"
But I got
"array (1,3) [(1,3),(2,3),(3,3)]"
Why is that? Can anyone tell me how to get the output that I expect?
Thanks a lot,
cchang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110117/6e6451a9/attachment.htm>
More information about the Beginners
mailing list