ListXProd
structure
signature LIST_XPROD
structure ListXProd
: LIST_XPROD
The ListXProd structure provides functions for computing with the cross product of two lists. For purposes of documentation, we define the cross product of two lists as the the list produced by the following function:
fun xProd (l1, l2) = let fun mkPair a b = (a,b) in List.foldr (fn (a,l) => (map (mkPair a) l2)@l) [] l1 end
val appX : (('a * 'b) -> 'c) -> ('a list * 'b list) -> unit
val mapX : (('a * 'b) -> 'c) -> ('a list * 'b list) -> 'c list
val foldX : (('a * 'b * 'c) -> 'c) -> ('a list * 'b list) -> 'c -> 'c
appX f (l1, l2)
List.app f (xProd(l1,l2))
mapX f (l, l2)
List.map f (xProd(l1,l2))
foldX f (l, l2) a
List.foldl (fn((a,b),c) => f(a,b,c)) a (xProd(l1,l2))
List, ListPair
Last Modified June 11, 1998
Comments to John Reppy
Copyright © 1998 Bell Labs, Lucent Technologies