[Haskell-cafe] Autrijus Tang interviewed by Perl.com
joelr1 at gmail.com
Thu Sep 15 10:38:46 EDT 2005
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*)
xxs@(x:xs) ~~ yys@(y:ys) -- To merge two streams:
| x==y = (x : xs~~ys) -- if the heads are common,
| x<y = (x : xs~~yys) -- otherwise, take the smaller one
| x>y = (y : xxs~~ys) -- and proceed to merge the rest
More information about the Haskell-Cafe