<div dir="auto">Hi,<div dir="auto">between the arguments of a function,</div><div dir="auto">ys@(y:yss)</div><div dir="auto">would mean that we call that argument ys, we call its head y and its tail yss. In your case the tail is replaced by _ , because is never used inside the function.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il mer 27 gen 2021, 07:02 Lawrence Bottorff <<a href="mailto:borgauf@gmail.com">borgauf@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm looking at <a href="https://wiki.haskell.org/99_questions/Solutions/8" target="_blank" rel="noreferrer">this</a> and wondering how the "as pattern" actually is working<div><br></div><div>compress (x:ys@(y:_))<br>    | x == y    = compress ys<br>    | otherwise = x : compress ys<br>compress ys = ys</div><div><br></div><div>I'm sure it's just some version of my stab at eliminating consecutive duplicates in a list</div><div><br></div><div>compress :: Eq a => [a] -> [a]<br>compress [] = []<br>compress [x] = [x]<br>compress (x:y:xs) = if x == y then compress (y:xs) else x : compress (y:xs)</div><div><br></div><div>only smarter. Could someone walk me through the (x:ys@(y:_)) part?</div><div><br></div><div>LB<br><div><br></div><div><br></div></div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>