<div dir="ltr">I figured out.. Thank you so much.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 7, 2016 at 5:51 PM, Magnus Therning <span dir="ltr"><<a href="mailto:magnus@therning.org" target="_blank">magnus@therning.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
Jeon-Young Kang writes:<br>
<br>
> For pattern matching.. I implemented like this.<br>
><br>
> compareName a (Person name age)<br>
> | (a == name) = age<br>
><br>
> but, I got stuck how to apply pattern matching for the two lists.<br>
> i.e., both names and persons are lists.<br>
><br>
> I really appreciate your advice..<br>
<br>
</span>Something like this works:<br>
<br>
map age $ filter (\ p -> (name p) `elem` names) persons<br>
<br>
/M<br>
<span class=""><br>
--<br>
Magnus Therning OpenPGP: 0x927912051716CE39<br>
email: <a href="mailto:magnus@therning.org">magnus@therning.org</a> jabber: <a href="mailto:magnus@therning.org">magnus@therning.org</a><br>
twitter: magthe <a href="http://therning.org/magnus" rel="noreferrer" target="_blank">http://therning.org/magnus</a><br>
<br>
</span>Finagle's Fifth Law:<br>
Always draw your curves, then plot your readings.<br>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>