Last active
September 7, 2018 12:44
-
-
Save joe-crick/48bf27b01b712d359dc2a9b37818c67c 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
;; with parens | |
(defn symmetrize-body-parts | |
"Expects a seq of maps that have a :name and :size" | |
[asym-body-parts] | |
(loop [remaining-asym-parts asym-body-parts | |
final-body-parts []] | |
(if (empty? remaining-asym-parts) | |
final-body-parts | |
(let [[part & remaining] remaining-asym-parts] | |
(recur remaining | |
(into final-body-parts | |
(set [part (matching-part part)]))))))) | |
;; without parens | |
defn symmetrize-body-parts | |
"Expects a seq of maps that have a :name and :size" | |
[asym-body-parts] | |
loop [remaining-asym-parts asym-body-parts | |
final-body-parts []] | |
if empty? remaining-asym-parts | |
final-body-parts | |
let [[part & remaining] remaining-asym-parts] | |
recur remaining | |
into final-body-parts | |
set [part matching-part part] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment