Created
November 23, 2012 06:16
-
-
Save daveray/4134222 to your computer and use it in GitHub Desktop.
flatteno
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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