-
-
Save tomjack/4a57022921afde8a6465 to your computer and use it in GitHub Desktop.
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
(defn in-out-with-both [in out both] | |
((fn iob [[i & is :as iss] | |
[o & os :as oss] | |
[b & bs]] | |
(when b | |
(lazy-seq | |
(cond (= i b) | |
(cons [:in i] (iob is oss bs)) | |
(= o b) | |
(cons [:out o] (iob iss os bs)) | |
:else | |
(cons [:wtf b] (iob is os bs)))))) | |
in out both)) | |
(comment | |
cuhor.core> (in-out-with-both [:x :y :z] [:a :b :c] [:a :b :x :y :c :z]) | |
([:out :a] [:out :b] [:in :x] [:in :y] [:out :c] [:in :z])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment