<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 5:52 PM,  <span dir="ltr"><<a href="mailto:galeonet@tiscali.it" target="_blank">galeonet@tiscali.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":16o" class="a3s" style="overflow:hidden">
but if I write: [(x,y)|x<-[1..5],y<-[1..5],x<-[1]]<br>
I obtain:<br>
[(1,1),(1,2),(1,3),(1,4),(1,5),(1,1),(1,2),(1,3),(1,4),(1,5),(1,1),(1,2),(1,3),(1,4),(1,5),(1,1),(1,2),(1,3),(1,4),(1,5),(1,1),(1,2),(1,3),(1,4),(1,5)]</div></blockquote></div><br></div><div class="gmail_extra">Others will chime in with a full answer soon. <br><br>Meanwhile, consider that<br><br></div><div class="gmail_extra"> [(x,y)|x<-[1..5],y<-[1..5],x<-[1]]<br><br></div><div class="gmail_extra">(which is quite weird as a set-theoretic expression)<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">is Haskell-equivalent to<br><br> [(x,y)|_<-[1..5],y<-[1..5],x<-[1]]<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Now consider<br><br>[(x,y)|y<-[1..5],x<-[1]]<br><div class="gmail_extra"><br></div>which is [(1,1),(1,2),(1,3),(1,4),(1,5)] as you expect.<br><br></div><div class="gmail_extra">Separately, consider<br><br></div><div class="gmail_extra">[ a | _ <- [1..5], f a ]<br><br></div><div class="gmail_extra">where you can experiment with different values of f and a.<br><br></div><div class="gmail_extra">Putting together the pieces will give you an answer to your query.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div><div class="gmail_signature">-- Kim-Ee</div></div>
</div></div>