Last active
September 26, 2016 12:06
-
-
Save joakin/c5dfc23ce4024881731f69aed6a5093c to your computer and use it in GitHub Desktop.
todos solution
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
[{:type :input :value | |
"(def todos [\"Buy milk\" | |
\"Read newspaper\" | |
\"Pick up olives\" | |
\"1h jog\"])"} | |
{:type :input :value | |
"(defn todo->str [index todo] (str index \". \" todo \"\\n\"))"} | |
{:type :input :value | |
"(defn indexes [ts] | |
(map inc (range (count ts))))"} | |
{:type :input :value | |
"(defn todos->str [ts] | |
(let [lines (map todo->str (indexes ts) ts)] | |
(apply str lines)))"} | |
{:type :input :value "(js/alert (todos->str todos))"} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment