Skip to content

Instantly share code, notes, and snippets.

@shaunlebron
Created June 26, 2015 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaunlebron/320efbd0a49d22641de6 to your computer and use it in GitHub Desktop.
Save shaunlebron/320efbd0a49d22641de6 to your computer and use it in GitHub Desktop.
js data processing in cljs
(let [old-arr #js []
new-arr #js []]
(doseq [val old-arr]
(when (should-include? val)
(.push new-arr val))))
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