Created
June 26, 2015 19:24
-
-
Save shaunlebron/320efbd0a49d22641de6 to your computer and use it in GitHub Desktop.
js data processing in cljs
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
(let [old-arr #js [] | |
new-arr #js []] | |
(doseq [val old-arr] | |
(when (should-include? val) | |
(.push new-arr val)))) |
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
var oldArr = []; // <-- original data to be processed | |
var newArr = []; | |
for (i=0; i<oldArr.length; i++) { | |
var val = oldArr[i]; | |
if (shouldInclude(val)) { // <-- basic filter | |
newArr.push = transform(val); // <-- basic map | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment