15 lines
333 B
Text
15 lines
333 B
Text
open list core
|
|
|
|
amb xs = x where
|
|
(Some x) = & join xs ""
|
|
join (x::xs) = amb' x (join xs)
|
|
join [] = \_ -> Some ""
|
|
eq' [] x = true
|
|
eq' w x = last w == head x
|
|
amb' [] _ _ = None
|
|
amb' (x::xs) n w
|
|
| eq' w x =
|
|
match n x with
|
|
Some v = Some (x ++ " " ++ v)
|
|
_ = amb' xs n w
|
|
| else = amb' xs n w
|