<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Caffeinated Simpleton - Latest Comments in First Stab at Learning Clojure</title><link>http://caffinatedsimpleton.disqus.com/</link><description>My personal blog</description><atom:link href="https://caffinatedsimpleton.disqus.com/first_stab_at_learning_clojure/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 17 Mar 2009 04:47:08 -0000</lastBuildDate><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7282247</link><description>&lt;p&gt;It's a bit better now, but I think I need to redo the site and make the fonts bigger.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Tue, 17 Mar 2009 04:47:08 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7045593</link><description>&lt;p&gt;Clojure, like all lisps, treats the first item in a list as the thing to call, and the rest of the items in the list as its arguments. So (f x y) is equivalent to f(x, y) in Python. If you want to create a list, you have to write (list f x y), which is equivalent to list(f, x, y) in Python.&lt;/p&gt;&lt;p&gt;Vectors, on the other hand, don't treat the first item any differently. So [f x y] in Clojure is the same as [f, x, y] in Python.&lt;/p&gt;&lt;p&gt;Lisps like Clojure also have the notion of quoting, which languages like Python have no direct analogy to. By quoting an expression Clojure, we tell the compiler not to evaluate its contents. So (quote f x y) or '(f x y) will return a list of unevaluated symbols. We can evaluate them later on with eval, if we so desire, so (eval (quote f x y)) is equivalent to (f x y).&lt;/p&gt;&lt;p&gt;Oh, and you're right about conj - though in vectors conj appends to the end, whilst in lists it appends to the beginning.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">weavejester</dc:creator><pubDate>Mon, 09 Mar 2009 19:19:54 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7044647</link><description>&lt;p&gt;Awesome, thanks! I wonder if there's a way for me to pull your changes...&lt;/p&gt;&lt;p&gt;I totally agree with the bit about abstracting out html. I'm planning on re-factoring frequently as I go along, to kind of show an evolution from the simplest case to a well designed piece of software.&lt;/p&gt;&lt;p&gt;It's a bit easier to enforce this in other web frameworks that include the plumbing for these kind of abstractions in the first place, but I think I prefer this for learning the language. It abstracts away the details of dealing with HTTP requests and routing without getting in the way of the fun pieces. We'll see what comes out down the line as a result.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Mon, 09 Mar 2009 18:32:07 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7044451</link><description>&lt;p&gt;You don't need to write html twice: the html function handles nested vectors easily enough. I'd also tend to separate out the html generation into its own function and keep the servlet definition lightweight. It doesn't matter so much when you only have two lines of HTML, but keeping your views separate from what is essentially your routing table makes a lot of sense when things start to get more complex.&lt;/p&gt;&lt;p&gt;Here's my fork of your gist: &lt;a href="http://gist.github.com/76507" rel="nofollow noopener" target="_blank" title="http://gist.github.com/76507"&gt;http://gist.github.com/76507&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">weavejester</dc:creator><pubDate>Mon, 09 Mar 2009 18:22:32 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7044454</link><description>&lt;p&gt;For me, it wasn't about reading the code, it was about writing it. When I can line up the parentheses, it's clear that I've closed them all. I've changed it now to keep you fine folks happy, but if it ends up being inconvenient, I'll go right back to every parenthesis being on its own line.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Mon, 09 Mar 2009 18:22:30 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7044195</link><description>&lt;p&gt;Ah, thanks.&lt;/p&gt;&lt;p&gt;I was under the impression that () was also a list. So you could do (1 ((2) 3)).&lt;/p&gt;&lt;p&gt;Also, it looks like "conj" can be applied to any sequence, but you're right about "assoc". There are others too that only work with vectors according to &lt;a href="http://clojure.org/data_structures" rel="nofollow noopener" target="_blank" title="http://clojure.org/data_structures"&gt;http://clojure.org/data_str...&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Mon, 09 Mar 2009 18:15:39 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7044023</link><description>&lt;p&gt;There's more functions that work with vectors, such as conj and assoc. Vectors are also more concise, e.g. [1 [[2] 3]] as opposed to (list 1 (list (list 2)) 3)).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">weavejester</dc:creator><pubDate>Mon, 09 Mar 2009 18:05:48 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7037647</link><description>&lt;p&gt;I would if there was a lot of stuff in the function call, which is that case with Lisp.&lt;/p&gt;&lt;p&gt;However, I can see that it's not a popular decision. I hate relying on text editor features to write correct code, but if it's the way things are done...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Mon, 09 Mar 2009 14:38:19 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7037013</link><description>&lt;p&gt;Remember that parens are used for function calls. The way you wrote that looks like this to a Lisper:&lt;/p&gt;&lt;p&gt;calculate(5&lt;br&gt;)&lt;/p&gt;&lt;p&gt;You wouldn't write that in other languages either. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jules</dc:creator><pubDate>Mon, 09 Mar 2009 14:08:46 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7036624</link><description>&lt;p&gt;Keeping your closing parens on their own line instead of putting them all on one line creates a lot of unnecessary line noise.&lt;/p&gt;&lt;p&gt;As far as readability, indentation should guide readers, not parens. If you try to tell what's going on by matching each paren one-by-one, you'll go crazy. If the code is properly indented, you won't have to; you let the indentation be your guide.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Phil</dc:creator><pubDate>Mon, 09 Mar 2009 13:51:51 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7035580</link><description>&lt;p&gt;Interesting...I didn't even notice that. While experienced lispers may not like this, might this make it easier for people who are used to Ruby or Python to read lisp?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ben Atkin</dc:creator><pubDate>Mon, 09 Mar 2009 13:07:08 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7027786</link><description>&lt;p&gt;er, but obviously indented... comment didn't indent :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Curtis</dc:creator><pubDate>Mon, 09 Mar 2009 08:58:08 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7027771</link><description>&lt;p&gt;Lisp formatting usually gathers up all the closing parens on the last line of the form. For ex:&lt;/p&gt;&lt;p&gt;(defservlet home&lt;br&gt;    (GET "/"&lt;br&gt;        (html [:h1 "Flockr"]&lt;br&gt;            (html [:h2 "Twitter Portal"]))))&lt;/p&gt;&lt;p&gt;Doesn't take as long to get used to this style as it first appears, and it saves a heap of vertical space (like Python).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Curtis</dc:creator><pubDate>Mon, 09 Mar 2009 08:57:04 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7024996</link><description>&lt;p&gt;Commas are whitespace in clojure. Use 'em if it makes you feel good, otherwise don't.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">DomesticMouse</dc:creator><pubDate>Mon, 09 Mar 2009 08:30:30 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7018500</link><description>&lt;p&gt;You might want to change the font size of your code so it's a little bigger.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marc</dc:creator><pubDate>Mon, 09 Mar 2009 07:50:42 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7009341</link><description>&lt;p&gt;I understand the performance implications, but do they have differences beyond these? Do they behave differently within Clojure?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Mon, 09 Mar 2009 02:37:10 -0000</pubDate></item><item><title>Re: First Stab at Learning Clojure</title><link>https://justin.harmonize.fm/development/2009/03/08/first-stab-at-learning-clojure.html#comment-7009249</link><description>&lt;p&gt;"Vectors are also ordered collections of items. Their implementation is similar to arrays. They are ideal when items need to be retrieved by index, but not efficient when new items need to be added or removed quickly"&lt;br&gt;;-)&lt;br&gt;&lt;a href="http://ociweb.com/jnb/jnbMar2009.html#Collections" rel="nofollow noopener" target="_blank" title="http://ociweb.com/jnb/jnbMar2009.html#Collections"&gt;http://ociweb.com/jnb/jnbMa...&lt;/a&gt; &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">atreyu</dc:creator><pubDate>Mon, 09 Mar 2009 02:25:13 -0000</pubDate></item></channel></rss>