Open Ejipuh opened 3 years ago
May 6, 2021 -- Day 1 of a New Start I read 1.5 chapters of Clojure from the Ground Up, taking notes on what seemed important, and I picked up some concepts that I completely glossed over last time:
My core problem last time was that I was trying to quickly skim through the resources and jump straight into programming, thinking that the concepts behind the skill would become apparent through aimlessly tossing code together. As obvious as this error was, I didn't see it when I attempted to learn Clojure the first time. Having observed this, I have more hope for this run!
Day 2
Day 3 | Today, I read CFGU chapter 3 and the first chunk of 4 in more detail.
Day 4 | Read more of chapter 4, applying it and making puzzles for myself as I went. I solved a couple of these, and marked the rest with "[UNSOLVED]" in the comments of my Clojure file for this chapter. As I improve, I plan to revisit these and see if I have a new way to tackle these. They'll serve a similar purpose as the 4Clojure puzzles.
Day 5 | Solved 3 4Clojure problems; read and experimented with concepts from a couple more sections in CFGU ch. 4; watched about 30 min of Rich Hickey's talks for context and help.
Day 6 | Studied for less time today, but I finished chapter 4 and did two of the problems it provides. (I imported the other two into my worksheet file for the chapter.)
Day 7 | Didn't give myself enough time today to solve my problems. Wrote two of my puzzles down on note cards to carry around.
Day 8 | The most productive 3 hours I've spent on Clojure yet. I read CFGU chapters 5, 6, and half of 7, and perused the Athens codebase.
Day 9 | Read CFGU chapter 7. Got some exposure to the process of data analysis and how to do this in Clojure, but I didn't comprehend it well enough to reproduce it.
Day 10
Day 11
:clap:
Day 12
lein run
, and it jumps straight into my code. The main function uses read-line (a function I learned today), takes an input from the command line, and responds according to what is typed in. This enables a really basic interaction, which is exciting, because it allows me to run Clojure scripts from the command line, and actually start making interactive programs.lein repl
works in a folder even if you don't run "lein new" in it. I'm still not sure how this works, but it seems like all you need is to have lein.bat in the folder for this to work.Day 13
Things that didn't click for me until today:
This sums up the core of many of my confusions so far:
"Those unfamiliar with this kind of programming think of functions as allowing you to generalize operations over data instances."
On this note: something I've noticed as I've been learning Clojure is that its emphasis on functions (or "verbs") has made me pay more attention to the syntax of the English language. It seems as if functional programming is much more linguistic in this sense than other programming "languages" that I've previously studied.
Day 14
Things that Clicked
Day 15
Day 16
Day 17
map
, reduce
, and similar functions work on any data structure that can work sequentially. Day 18
(ns name-of-this-space (:include [other-ns]))
. I got stuck at first because I didn't realize that the :include bit needed to be wrapped in parens, or that the part inside needed brackets.Day 19
Day 20
Today, I learned something really important about solving problems.
I spent a while on one of the easier 4clojure problems. The goal was to take a sequence of keywords (like [:a :b :c]
) with a value (like "hello"
) and output a seq that paired the value with each keyword ({:a "hello" :b "hello" :c "hello"}
, in this case). I approached this by starting to make a full-fledged function without clarifying the details of my approach, and by using reduce
, which I didn't fully understand going into it. Naturally, it didn't work. (And I'm glad for that.)
After this, I started by testing into
in a really simple way until I got it working. Then, I added a let
binding. Then I made that into a function that worked on the first input item, then I made that function work for the first two input items, and then I realized I needed recursion, so I tried to introduce reduce (still not fully knowing how it worked). That last part failed, so I varied my approach and used map
instead. After a few more iterations, I got it working.
What I gained from this process of testing was a very valuable lesson: figure out the core of the program, get that part working, then layer over it as you go. Implement the core of your approach and get it working. If that works, add a single layer to it.
On a different note, I've run into a similar problem when I've written poetry in the past. I would try to capture an entire experience or idea without first making sure I was really clear on what I was trying to capture. I would try to put this vague understanding into meter and rhyme with a scarce set of lines, but it wouldn't communicate what was in my head. I couldn't condense the experience into a poetic form because I didn't have clarity on the experience. But when I take something I'm really clear on and try to condense it down, it's a lot easier to do.
It seems like the parallel is that in both poetry and code, you test your understanding (of an experience, idea, or solution) through writing. And the more clear, condensed, and deep the result is, the better this understanding was.
Day 21
Day 22
seq {:key1 val1 :key2 val2}
returns ([:key1 val1] [:key2 val2])
, which continues to boggle my mind. I'll need to revisit this tomorrow.Day 23
reduce
works. This gave me a good amount of clarity. Writing out that reduce + [1 2 3]
is the same as (+ (+ 1 2) 3)
really helped. (Naturally, I wrote up a prompt for this in my digital notes.)An Update, of Sorts It's been a few weeks since I've posted a Clojurology update. I'm on a hiatus from Clojure, since I'm working through Mark Rober's creative engineering course. I plan to resume once I finish.
Clojure from the Ground Up
- [x] Chapters 1-3 - [x] Chapters 4, 6 - [x] Chapters 7, 8, 104Clojure
- [x] 20 problems - [ ] 40 problems - [ ] 60 problems - [ ] 80 problems - [ ] 100 problemsClojure for the Brave and True
- [ ] Chapters 3-4 - [ ] Chapters 5-6 - [ ] Chapters 10ClojureScript, Reagent, re-frame
- [ ] build an app with plain hiccup and JS interop - [ ] build an app with reagent - [ ] build an app with re-frameDataScript
- [ ] complete http://learndatalogtoday.org/ - [ ] build an app with datascriptAthens Analysis
- [ ] figure out how Athens works - [ ] note general structure - [ ] note areas of greatest potential and the next step that might be taken there#learninpublic
- [x] day 1 - [x] day 2 - [x] day 3 - [x] day 4 - [x] day 5 - [x] day 6 - [x] day 7 - [x] day 8 - [x] day 9 - [x] day 10 - [x] day 11 - [x] day 12 - [x] day 13 - [x] day 14 - [x] day 15 - [ ] day 16 - [ ] day 17 - [ ] day 18 - [ ] day 19 - [ ] day 20 - [ ] day 21 - [ ] day 22 - [ ] day 23 - [ ] day 24 - [ ] day 25 - [ ] day 26 - [ ] day 27 - [ ] day 28 - [ ] day 29 - [ ] day 30 - [ ] day 31 - [ ] day 32 - [ ] day 33 - [ ] day 34 - [ ] day 35