Thanks a lot for this.<div><br></div><div>Just to clarify (and ignoring the flip, which I can solve by rewriting the checkNum function) - is this an example of currying?</div><div><br></div><div>M<br><div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, 22 Apr 2016 22:30 Francesco Ariis, <<a href="mailto:fa-ml@ariis.it">fa-ml@ariis.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Apr 22, 2016 at 10:20:19PM +0100, Matt Williams wrote:<br>
> I am looking for something like:<br>
><br>
> list1 = [1,2,3,4,5,6]<br>
> list2 = [1,2,3,4,5,6]<br>
><br>
> map checkNum list1 list2<br>
><br>
> to return:<br>
><br>
> [(1,[1]),(2[3,4,5]),(6,[3])<br>
><br>
> (I have tried to simplify this a little, so my apologies if it looks<br>
> pointless - the real function is useful)<br>
><br>
> Any help would be appreciated.<br>
><br>
> Matt<br>
<br>
Hey Matt,<br>
if what you want is<br>
<br>
[checkNum 1 list2, checkNum 2 list2, etc.]<br>
<br>
then<br>
<br>
map (flip checknum list2) list1<br>
<br>
is what you want (flip signature being :: (a -> b -> c) -> b -> a -> c)<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">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>
</blockquote></div></div></div></div>