### Coding Zen in all the strange places

I continue to return to Zen as a way to reach peace with myself. Zen encourages introspection and meditation alongside expressive acts such as calligraphy. The core of Zen calligraphy, such that I understand it, is to cultivate the beginner’s mind. The expert mind is packed with presumption; while an expert mind has a powerful ability to categorize a problem, such that it can immediately a ready-made solution, this procedural reduction prevents it from naive consideration of the actual problem as presented.

This is evident at work: I think “Aha! This task is in fact *this* problem with *this* solution!,” and then I solve it. I get faster, but I don’t grow: practice reinforces dogma. Practice strengthens your current paradigm inhibits personal development.

I bought *If Hemingway Wrote JavaSciript* by Angus Coll from a Humble Bundle a few months ago. The book’s comparative approaches to the same simple problem inspired me to fuse Zen naïvety and functional JavaScript. Michael Fogus’ approach in *Functional JavaScript* underlies my recent series of JavaScript snippets.

Snippets should be taken at face value: exercises in a base level of code that encapsulates knowledge and naive practice. What is a map? What is an elegant way to find factorials? The goal is to improve my ability to problem-solve with JavaScript without preconception.

```
function range(size) {
return [...Array(size + 1).keys()].slice(1);
}
function reduce(arr, sum, callback) {
return !arr.length ? sum : reduce(arr.slice(1), callback(arr[0], sum), callback);
}
function adder(number, sum) {
return number + sum;
}
let numbers = range(10);
reduce(numbers, 0, adder); // 55
```

There’s quite a of Project Euler in this series, and I think this series will segue into attempts on different problems. For now, its enjoyable and I intend to continue.