Re: [q-lang-users] "listof" surprises
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2007-05-13 11:34:01
|
Hi Marco, ma...@ma... wrote: > I just got burned by this unexpected (for me, of course) behavior of > list comprehension. Given the program > > delta X X = 1; > delta _ _ = 0 otherwise; > tabulate N M F = [[F I J : I in [1..N]] : J in [1..M]]; > eye N = tabulate N N delta; > > then (eye 2) evaluates to [[0,0],[0,0]] instead of [[1,0],[0,1]] as I > would have imagined. Yes, your imagination is certainly right. ;-) [delta I J : I in [1..2], J in [1..2]] does the right thing, so it seems to be an issue with the nested listof. Maybe a bug crept in there when the matching semantics were slightly changed in Q 7.1, so that the nested listof now gets evaluated too early. I'll look into it, thanks for the report! Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |