15 Sep
2005
15 Sep
'05
10:38 p.m.
What is the meaning of xxs@(x:xs) in the code below? I understand that x:xs is a list /head:tail/ but a tuple of (x:xs) does not make sense. main = print (take 1000 hamming) hamming = 1 : map (2*) hamming ~~ map (3*) hamming ~~ map (5*) hamming where xxs@(x:xs) ~~ yys@(y:ys) -- To merge two streams: | x==y = (x : xs~~ys) -- if the heads are common, take that | x<y = (x : xs~~yys) -- otherwise, take the smaller one | x>y = (y : xxs~~ys) -- and proceed to merge the rest Thanks, Joel