Friday, November 20, 2009

Wide Finder in Clojure

Using Clojure to implement the "Wide Finder", parallel code for grepping log files:

http://technomancy.us/130#c

See the comments for the pmap version:
(ns my-wide-finder
"A basic map/reduce approach to the wide finder using agents.
Optimized for being idiomatic and readable rather than speed.
NOTE: Originally from:
http://technomancy.us/130
but updated to use pmap."
(:use [clojure.contrib.duck-streams :only [reader]]))

(def re #"GET /(\d+) ")

(defn count-line
"Increment the relevant entry in the counts map."
[line]
(if-let [[_ hit] (re-find re line)]
{hit 1}
{}))

(defn my-find-widely
"Return a map of pages to hit counts in filename."
[filename]
(apply merge-with +
(pmap count-line (line-seq (reader filename)))))

http://www.tbray.org/ongoing/When/200x/2009/11/18/Clojure-Parallel-I-O
> Conclusion first: It turns out that Clojure’s concurrency primitives > allow you, with a very moderate amount of uncomplicated code, to > take advantage of parallel hardware and outperform really fast > software when it doesn’t take such advantage.

Posted via email from miner49r

Wide Finder in Clojure

Using Clojure to implement the "Wide Finder", parallel code for grepping log files:

http://technomancy.us/130#c

See the comments for the pmap version:
(ns my-wide-finder "A basic map/reduce approach to the wide finder using agents. Optimized for being idiomatic and readable rather than speed. NOTE: Originally from: http://technomancy.us/130 but updated to use pmap." (:use [clojure.contrib.duck-streams :only [reader]])) (def re #"GET /(\d+) ") (defn count-line "Increment the relevant entry in the counts map." [line] (if-let [[_ hit] (re-find re line)] {hit 1} {})) (defn my-find-widely "Return a map of pages to hit counts in filename." [filename] (apply merge-with + (pmap count-line (line-seq (reader filename)))))

Conclusion first: It turns out that Clojure’s concurrency primitives allow you, with a very moderate amount of uncomplicated code, to take advantage of parallel hardware and outperform really fast software when it doesn’t take such advantage.

Posted via email from miner49r

Thursday, November 12, 2009

The Go Programming Language

Google announces a new programming language: Go.

http://golang.org/

Posted via email from miner49r

Thursday, October 29, 2009

Secret History of Silicon Valley « Steve Blank

A great series of posts with old war stories, many of them involving Stanford University:

http://steveblank.com/category/secret-history-of-silicon-valley/

Posted via email from miner49r

Thursday, October 1, 2009

John Lloyd inventories the invisible

(via daringfireball.net)

Nature's mysteries meet tack-sharp wit in this hilarious, 10-minute mix of quips and fun lessons, as comedian, writer and TV man John Lloyd plucks at the substance of several things not seen.

Posted via email from miner49r

Friday, September 25, 2009

Switching to posterous.com

I'm moving my personal blog to posterous.com.  They make it really easy to update via email (including pictures and videos).  They also can cross-post for you automatically to many other blogging and social web sites.  That make posterous.com the new headquarters for my web empire!

From now on, look for me at http://miner.posterous.com.

Posted via email from miner49r

McCarthy Presents Lisp (1959)

http://www.paulgraham.com/mcilroy.html
Just fifty years ago, John McCarthy circulated a notice that he would be giving an informal talk that he thought would be of interest. I drove up to MIT from New Jersey to attend this seminar of typical length in a typical classroom. But the seminar was anything but typical. It was a revelation. In one session at the blackboard, John introduced Lisp—all you could do with car, cdr, cons, cond, lambda, and recursion.

In the course of the lecture John introduced the usual basic list functions like copy, append and reverse (quadratic and linear), as well as tree manipulation. He went on to higher-level functions, demonstrating maplis and lambda. By the end of the hour he had put together a powerful little toolkit of functions which he used in his finale: symbolic differentiation of univariate expressions.

There it was—functional programming ex nihilo. McCarthy acknowledged IPL V and recursive function theory, but the elegant and practical face he put upon these antecedents was a work of genius.





Me: Attending seminars by John McCarthy was one of the highlights of my undergraduate years at Stanford. For more on JMC:

http://www-formal.stanford.edu/jmc/personal.html

Thursday, September 24, 2009

St. Mary's in Edgefield

After our move to Mount Vintage, I started attending Mass at St. Mary of the Immaculate Conception in Edgefield.  It's a beautiful old church, dating back to 1860.  I recently volunteered to start a web site for the parish.  There's only a temporary home page there now, but I'll be working on it during the weeks to come.  StMarysEdgefield.org