Ongoing · Concur.next — Hard-Core Clojure
1–10 of 11 posts
Re: Ongoing · Concur.next — Hard-Core Clojure
#2Re: Ongoing · Concur.next — Hard-Core Clojure
#3A Clojure "purist" is probably still programming Scheme. In other words, "purist" and "Clojure" do not go well together. As Rich Hickey often says, he is a "practitioner." He wants to Get Things Done, and Clojure reflects that. Dropping down into Java is not "cheating," it's one of the reasons Clojure was implemented on the JVM in the first place, and I've seen Rich recommend calling Java code to solve a problem multiple times on the Clojure group.
Re: Ongoing · Concur.next — Hard-Core Clojure
#4Any experienced Clojure people care to comment on why atoms were used instead of agents? You don't care when the counter is incremented, just that it gets incremented, so I'd assume that an agent would model the problem more closely. Is it an overhead thing or what?
Re: Ongoing · Concur.next — Hard-Core Clojure
#5"OK, but a Clojure purist would probably see those occasions as maybe highlighting gaps in that language’s coverage." A Clojure "purist" is probably still programming Scheme. In other words, "purist" and "Clojure" do not go well together. As Rich Hickey often says, he is a "practitioner." He wants to Get Things Done, and Clojure reflects that. Dropping down into Java is not "cheating," it's one of the reasons Clojure…
Re: Ongoing · Concur.next — Hard-Core Clojure
#6It also reflects well on the pragmatism behind Clojure's design. The type annotations and dropping into Java, while not as pretty as pure Clojure, are still prettier than regular Java and can be isolated to the performance hot spots.
I appreciated this little bit of editorializing:
"The -> and doto macros save us from having to name each intermediate step and from the unreadable nesting you’d get if you tried to do the same thing in a typical curly-brace language.
BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(
new FileInputStream(filename).skip(startByte), 131072), "US-ASCII"));
Oops, FileInputStream.skip() returns a long, so that doesn’t even work. Now who was complaining about Lisp syntax (looking (like (this)))?"Nicely done. An informative, enjoyable read. Two thumbs up.
Re: Ongoing · Concur.next — Hard-Core Clojure
#7"OK, but a Clojure purist would probably see those occasions as maybe highlighting gaps in that language’s coverage." A Clojure "purist" is probably still programming Scheme. In other words, "purist" and "Clojure" do not go well together. As Rich Hickey often says, he is a "practitioner." He wants to Get Things Done, and Clojure reflects that. Dropping down into Java is not "cheating," it's one of the reasons Clojure…
This is a great way to describe "The Clojure Way". I think I'm going to co-opt this explanation for future use (I hope you don't mind).
Re: Ongoing · Concur.next — Hard-Core Clojure
#8Any experienced Clojure people care to comment on why atoms were used instead of agents? You don't care when the counter is incremented, just that it gets incremented, so I'd assume that an agent would model the problem more closely. Is it an overhead thing or what?
Agents launch the update function in a separate thread, which seems a bit much for incrementing a counter.
Re: Ongoing · Concur.next — Hard-Core Clojure
#9Re: Ongoing · Concur.next — Hard-Core Clojure
#10Any experienced Clojure people care to comment on why atoms were used instead of agents? You don't care when the counter is incremented, just that it gets incremented, so I'd assume that an agent would model the problem more closely. Is it an overhead thing or what?