In the Beginning
Am I the only one who feels like this?
Lost
Sometimes I feel so lost: I feel lost in life, love and happiness. Yes: I have first world problems. By most measures I have absolutely nothing to complain about, however most days I feel like I'm doing something wrong. Do you feel like this sometimes too?
I feel like I'm in a perpetual loop of "Why didn't this go the way I want?".
Well ... I'm starting to think I don't know what I want. So ... let's make a list.
The List
- I want to be healthy
- I want to be around my family
- I want to be productive at work
- I want to always be learning
The funny thing is that I do get at least a few of these every day. So maybe the problem is that I'm not in the moment. That is why I love coding so much: I am in the moment when I am coding. I get lost. I could wake up 3 hours later without knowing what happened, as the great philosopher Frank Ricard once did during a debate:
Coding Snippet of the Day
I have been working my through the 99 List Problems since I heard about them from Raju Gandhi's great "Learning to Learn" presentation at No Fluff.
Flattening a list gave me some issues: I kept banging my head against it with:
(defn my-flatten
[xs]
(when-let [x (first xs)]
(cons
(if (seq? x)
(my-flatten x)
[x])
(my-flatten (rest xs)))))
(my-flatten '(1 2 (3) (4 5) 6))
ninetynine-clj-problems.core=> (my-flatten '(1 2 (3) (4 5) 6))
After way too much time, I realized that I was literally 4 characters off (note the cons -> concat) ... so close.
(defn my-flatten
[xs]
(when-let [x (first xs)]
(concat
(if (seq? x)
(my-flatten x)
[x])
(my-flatten (rest xs)))))
(my-flatten '(1 2 (3) (4 5) 6))
ninetynine-clj-problems.core=> (my-flatten '(1 2 (3) (4 5) 6))