Created
November 27, 2018 16:48
-
-
Save alandipert/96a131694a8efbc08d0f589150f3236e 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 shape-with [shape xs] | |
(->> (reductions (fn [[a b] n] | |
((juxt take drop) n b)) | |
[xs xs] | |
shape) | |
rest | |
(map first))) | |
(defun shape-with (shape xs) | |
(loop for n in shape | |
collect (subseq xs 0 n) | |
do (setq xs (nthcdr n xs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment