Programming-Idioms

History of Idiom 42 > diff from v20 to v21

Edit summary for version 21 :

Version 20

2015-09-05, 09:11:42

Version 21

2015-09-05, 09:13:23

Idiom #42 Continue outer loop

Print each item v of list a which in not contained in list b.
For this, write an outer loop to iterate on a and an inner loop to iterate on b.

Idiom #42 Continue outer loop

Print each item v of list a which in not contained in list b.
For this, write an outer loop to iterate on a and an inner loop to iterate on b.

Code
sequence_ [ print v | v <- a, [ u | u <- b, u == v] == [] ]
Code
sequence_ [ print v | v <- a, [ u | u <- b, u == v] == [] ]
Comments bubble
a _\\ b abbreviates this task if you are not required to write your own printing iterations

Our outer loop continues to the next element whenever the inner list equality test breaks lazily after the first of any [u|u==w] found growing larger than the tested [].
Comments bubble
a _\\ b abbreviates this task if you are not required to write your own printing iterations

Our outer loop continues to the next element whenever the inner list equality test breaks the inner iteration lazily after the first of any [u|u==w] found growing too large to equal [].
Doc URL
http://hackage.haskell.org/package/base/docs/Data-List.html#v:-92--92-
Doc URL
http://hackage.haskell.org/package/base/docs/Data-List.html#v:-92--92-