Last active
December 12, 2015 02:59
-
-
Save rodnaph/4703280 to your computer and use it in GitHub Desktop.
RFC: Relation for flattened lists, only support one level of nesting though... is there an easier way using clojure functions possibly?
This file contains 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
; This only support one level... | |
(defne flatteno | |
"A relation which matches ys as a flattening of xs, only supports one level" | |
[xs ys] | |
([() _] (== ys ())) | |
([[a . b] _] | |
(fresh [c] | |
(flatteno b c) | |
(appendo a c ys)))) | |
; is there any way in core.logic to use clojure functions, something like... | |
(defn flatteno [xs ys] | |
(let [zs (flatten ys)] | |
(permuteo xs zs))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment