Skip to content

Instantly share code, notes, and snippets.

@Pet3ris
Created August 17, 2011 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pet3ris/1152744 to your computer and use it in GitHub Desktop.
Save Pet3ris/1152744 to your computer and use it in GitHub Desktop.
nd_merge xs ys
| choice == 1 && xs == [] = ys
| choice == 2 && ys == [] = xs
| choice == 1 = (head xs):nd_merge (tail xs) ys
| otherwise = (head ys):nd_merge xs (tail ys)
where choice = amb (seq xs 1) (seq ys 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment