1687 shaares
869 private links
869 private links
pairs = [ (x,y) | x <- [0..], y <- [0..] ]
This program doesn't really enumerate all "valid" pairs in finite time. For example (0, 1) is never reached because the list will not halt traversing the first component. How can we enumerate the space of all indexable pairs of integers? Moreover, given a recursive context-free grammar, how to write a program that enumerates all valid expressions?
This type of enumeration problems is where the Omega Monad can be useful. It acts like a "breadth-first" search for list comprehension. I recall finding the conde
primitive (sometimes known as condi
) from miniKanren fascinating. Now I learned the Omega Monad is exactly the same thing.