Skip to content

Instantly share code, notes, and snippets.

@daveray
Created November 23, 2012 06:16
Show Gist options
  • Save daveray/4134222 to your computer and use it in GitHub Desktop.
Save daveray/4134222 to your computer and use it in GitHub Desktop.
flatteno
(defn list?o
[v]
(matche [v]
([[]] succeed)
([[_ . _]] succeed)))
(defn flatteno
[in out]
(matche [in]
([[]] (== out in))
([[?in-head . ?in-tail]]
(fresh [prefix suffix]
(flatteno ?in-tail suffix)
(conde
[(list?o ?in-head) (flatteno ?in-head prefix) (appendo prefix suffix out)]
; here's my problem ...
[(... somehow test not list?o here) (conso ?in-head suffix out)])))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment