On Tue, Jul 23, 2013 at 3:53 PM, Costello, Roger L. <costello@mitre.org> wrote:
I have a list comprehension that extracts the singletons from xs using f and g, and creates a pair from their output:
[(a,b) | a <- f xs, b <- g xs]
I executed this and the result is the empty list:
[]
That is odd. Why is the empty list the result?
For the same reason that the cartesian product of any set with the empty set is the empty set.
Also,
> I have a list of singletons:
> xs = [("a")]
is immediately suspect, since you have xs:: [String], whereas "a list of singletons" appears to lean quite a lot more toward [Char], which is just String.