Skip to content

Instantly share code, notes, and snippets.

View aleksxor's full-sized avatar
💻
Tail recursion is it's own reward

Alexey Khoroshev aleksxor

💻
Tail recursion is it's own reward
View GitHub Profile
@aleksxor
aleksxor / add.js
Created November 8, 2016 11:21
pipe demo
#!/usr/bin/env node
let data = '';
const args = process.argv.slice(2);
if (args.length) {
console.log(sum(args));
process.exit(0);
}
// vk retracking
(window.Image ? (new Image()) : document.createElement('img')).src = location.protocol + '//vk.com/rtrg?r=%VK_RETRACKING_ID%',
// fb pixel
(window.Image ? (new Image()) : document.createElement('img')).src= 'https://www.facebook.com/tr?id=%FB_PIXEL_ID%&ev=PageView';
(ns simple-life.core
"Simplified game of life. Random universe consists of ones and
zeros. For every iteration we calculate current cell value
depending on it's own value and values of it's left and right
neighbours. When exactly one of those cells is 1 the resulting
value for next generation is 1, otherwise it's 0. For edge
elements the absent neighbour counts as 0.")
(defn next-cell [coll]
"takes collection and returns 1 only if one of collection's