Touch the firehose of ds106, the most recent flow of content from all of the blogs syndicated into ds106. As of right now, there have been 92408 posts brought in here going back to December 2010. If you want to be part of the flow, first learn more about ds106. Then, if you are truly ready and up to the task of creating web art, sign up and start doing it.

From Daniel – Day 2 of Clojure

Posted by
|

Day 2:
As I read the beginning portion about recursion I was reminded of the painful use of functional languages. There are not for or while loops in SML and it looks like Clojure is modeled the same way. I have to force myself to sit through and learn the intricacies of recursion.
Im seing some similarities in the sequences to the way lists work in SML. Using functions like “every?” and “number?” are like the map function where it iterates through the list and determines something.
As I continue to read the section, I’m seeing a lot more similarities of SML and Clojure. I like how the functions to manipulate lists work. Creating lists of toys and colors and then being able to filter out the entries that are less than a certain number of characters is very interesting. Even crazier is how they can do it all on one line! With no functions! It’s pretty amazing. The reduce function is so much better than foldl in SML, reduce just makes more sense to me when it comes to performing operations on a list. Just one word “reduce” takes a whole list and gives you one thing back. Moving on to lazy evaluation.
Im reading about how you can cycle through lists, interleave, easily get the range. While I doubt the practicality of such functions it really is quite interesting. Being able to take 5 drop 2 and cycle through a list seems cumbersome in real life applications but I’m sure there are something out there for that. I struggled to understand this stuff at first but I re read everything and now it makes sense. In fact I better understand functional languages as a result of reading this section. I now get to the iterate function! I see the use! For loops and while loops galore :D
Alright! The next section finally gets into the object oriented parts of Clojure. Me being a Java programmer for a part time internship means I love this section. Clojure uses the JVM and I’ve been curious up to this point what that is going to look like. I like the define protocol function as a way to implement an abstract class. The book says it’s like a contract, but I immediately saw the Java resemblance. Define a protocol then list the headers of the included functions and their parameters.
Reading through the compass example is definitely making sense of the practicality of the list functions from earlier in this section. I like how you can pull in a function from the java library like “toString().” Pretty snazzy.
Wow! Macros…. My brain hurts. This section will require discussion with my group mate Patrick and a re read. Maybe some online examples as well. The idea of using code as data in a list blows my brain apart.

Add a comment

ds106 in[SPIRE]