So I started reading Clojure in the seven languages in seven weeks book. Right off the bat, I feel a little discouraged already since Tate compares Clojure to Lisp, and I know nothing about Lisp. I love the star wars reference in the book. Clojure is like Yoda .
I like how the book says that Lisp is the oldest commercially active language after Fortran, yet, I’ve never heard of it in the business world.
Reading about how Clojure uses the JVM excites me as I primarily program in Java at my internship/job. I like when Tate says “Clojure and Java desperately need each other. Lisp needs the marketplace that the Java virtual machine can offer, and the Java community needs a serious update and an injection of fun.”
I can relate to this quote as a java programmer. There definitely needs to be an injection of fun. Java can be hard to wade through with data encapsulation and hiding within its object oriented design. It’s not always fun to have to constantly thinking about those things when programming.
I’m currently taking a break at work. I have been working with java for about 3 hours so far today. I was told to restructure my code to avoid data being changed outside of a certain class. I’ve spent the last hour or so restricting that code. My brain is a little “fizzed” right now. On to learn some Clojure.
In the introduction, Tate mentioned that Lisp uses a list structure where the first element is a function name and the rest of the list is parameters. Right off the bat with Clojure, Tate has us typing (println “Give me some Clojure!”). Looking at that syntax, we can clearly see the Lisp in it. “println” is the function name and first element in this list followed by the string “Give me some Clojure!” as a parameter. Function calls have to be in parenthesis too in order to keep this form. Interesting.
Wow, Clojure uses prefix mathematical notation. This stuff hurt my brain when we learned it in Data Structures. I had a hard time with it then, I guess I better refresh myself on this stuff. It makes sense that it would use the prefix notation as it uses Lisp’s list structure where the function is first followed by parameters. So the expression (+ 2 2 2 2) makes sense to call the “+” function on 2, then apply it to each element in the list.
The section about Binding seems pretty complicated to wrap my head around. I had to read this section twice to make sense of it. It seems to have similar functionality to SML when it comes to lists.
Alright! After Day 1 I was introduced to Clojure pretty successfully. I’ve seen the general syntax with braces for lists, vectors, and maps. I seem the simpler forms of Booleans, characters, numbers, keywords, and strings. I saw how the ordered containers lists and vectors were different. I saw some function definitions with how and where the name goes with the parameter list and the function body. The documentation option was really simple! I’m still a little shaky on the binding thing, I will probably have to reread that section a third time.