Alan Kay on Programming today (and a few other things)

From a recent Dr. Dobbs interview :

On adults –

Binstock: So you called them on the lying.

Kay: Yeah. But the thing that traumatized me occurred a couple years later, when I found an old copy of Life magazine that had the Margaret Bourke-White photos from Buchenwald. This was in the 1940s — no TV, living on a farm. That’s when I realized that adults were dangerous. Like, really dangerous.

On Computing as Pop Culture –

The lack of interest, the disdain for history is what makes computing not-quite-a-field.

I think the same is true of most people who write code for money. They have no idea where [their culture came from] — and the Internet was done so well that most people think of it as a natural resource like the Pacific Ocean, rather than something that was man-made. When was the last time a technology with a scale like that was so error-free? The Web, in comparison, is a joke. The Web was done by amateurs.

On Programming –

The most disastrous thing about programming — to pick one of the 10 most disastrous things about programming — there’s a very popular movement based on pattern languages. When Christopher Alexander first did that in architecture, he was looking at 2,000 years of ways that humans have made themselves comfortable. So there was actually something to it, because he was dealing with a genome that hasn’t changed that much. I think he got a few hundred valuable patterns out of it. But the bug in trying to do that in computing is the assumption that we know anything at all about programming. So extracting patterns from today’s programming practices ennobles them in a way they don’t deserve. It actually gives them more cachet.

The best teacher I had in graduate school spent the whole semester destroying any beliefs we had about computing. He was a real iconoclast. He happened to be a genius, so we took it. At the end of the course, we were free because we didn’t believe in anything. We had to learn everything, but then he destroyed it. He wanted us to understand what had been done, but he didn’t want us to believe in it.

Spring 2012 books

 

For the New Intellectual: The Philosophy of Ayn Rand (50th Anniversary Edition) – Ayn Rand
This is Ayn Rand’s challenge to the prevalent philosophical doctrines of our time and the “atmosphere of guilt, of panic, of despair, of boredom, and of all-pervasive evasion” that they create. One of the most controversial figures on the intellectual scene, Ayn Rand was the proponent of a moral philosophy–and ethic of rational self-interest–that stands in sharp opposition to the ethics of altruism and self-sacrifice. The fundamentals of this morality–“a philosophy for living on Earth”–are here vibrantly set forth by the spokesman for a new class, For the New Intellectual.


Empire of Illusion: The End of Literacy and the Triumph of Spectacle – Chris Hedges
In this New York Times bestseller, Pulitzer Prizewinning journalist Chris Hedges has written a shattering meditation on American obsession with celebrity and the epidemic of illiteracy that threatens our cultural integrity. Reporting on such phenomena as professional wrestling, the pornographic film industry, and unchecked casino capitalism, Hedges exposes the mechanisms used to divert us from confronting the economic, political, and moral collapse around us. Empire of Illusion shows us how illiteracy and the embrace of fantasy have impoverished our working class, allowed for the continuance of destructive public policy, and ushered in cultural bankruptcy.

 

The Religion Virus: Why we believe in God: An evolutionist explains religion’s incredible hold on humanity – Craig A. James
Why is religion so incredibly tenacious? Why do intelligent people believe the universe is only six thousand years old? How can so many people believe the Bible, written over two thousand years ago, is 100% accurate in every respect?
Using the powerful new science of cultural evolution called “memetics” — how ideas spread and mutate as they move across society and down through history — Craig James takes us on a fascinating tour of religion’s peculiar and convoluted history.
Religions evolve, not metaphorically, but in a very real way. By applying “survival of the fittest” principles to religions, James shows shows us how religion became incredibly infectious to the average human. 

 

Adrenaline Junkies and Template Zombies: Understanding Patterns of Project Behavior – Suzanne Robertson (Author), James S. Robertson (Author), Stephen M. McMenamin (Author), Timothy R. Lister (Author), Peter Hruschka (Author), Tom DeMarco (Author) 
Adrenaline junkies, dead fish, project sluts, true believers, Lewis and Clark, template zombies . . .
Most developers, testers, and managers on IT projects are pretty good at recognizing patterns of behavior and gut-level hunches, as in, I sense that this project is headed for disaster.
But it has always been more difficult to transform these patterns and hunches into a usable form, something a team can debate, refine, and use. Until now.
In Adrenaline Junkies and Template Zombies, the six principal consultants of The Atlantic Systems Guild present the patterns of behavior they most often observe at the dozens of IT firms they transform each year, around the world.

 

In The Plex – Steven Levy
Few companies in history have ever been as successful and as admired as Google, the company that has transformed the Internet and become an indispensable part of our lives. How has Google done it? Veteran technology reporter Steven Levy was granted unprecedented access to the company, and in this revelatory book he takes readers inside Google headquarters—the Googleplex—to show how Google works.

Cognitive Robotics And Artificial Intelligence

Eccerobot

Eccerobot

At the swissnex San Francisco conference earlier this year, scientists from Switzerland and the US discussed their research on humanoid robots, cognitive robotics, and artificial intelligence (AI). Talk revolved around how some robots self-reflect, self-improve, and adapt to new circumstances, and whether it’s possible for robots of the future to possess the same cognitive characteristics as humans.

more …

Welcome to John McCarthy’s new website.

From the website: John was a legendary computer scientist at Stanford University who developed time-sharing, invented LISP, and founded the field of Artificial Intelligence.* In March 2011 John launched Project JMC with the objective to make his work more approachable and accessible. The Project JMC team is continuing to help realize his objective. In this site you will find all John’s work, including his social commentary, and acknowledgements of his outstanding contributions and impact. Additional comments, suggestions, stories, photographs and videos on John and his work are very welcome. Please send them to the Project JMC team. His old website is here.

Quick Sort in Shen

A Shen type-checked implementation of Quick Sort is even more elegant/terse compared with the CL version posted previously.
Pattern-matching and currying make this possible.

(tc +)

(define filter
  {(A --> boolean) --> (list A) --> (list A)}
  _  []      -> []
  T? [A | B] -> (append [A] (filter T? B)) where (T? A)
  T? [_ | B] -> (filter T? B))

(define quick-sort-generic
  {(list A) --> (A --> A --> boolean) --> (A --> A --> boolean) --> (list A)}
  [] _ _ -> []
  [A | B] L? R? -> (append (quick-sort-generic (filter (R? A) B) L? R?)
			   [A]
			   (quick-sort-generic (filter (L? A) B) L? R?)))

\* descending with duplicates *\
* (quick-sort-generic [3 1 2 7 9 6 6 3 0] >= <)
* [9 7 6 6 3 3 2 1 0] : (list number)

The complete code can be found here. Based on this numeric version.

Quick Sort in Common Lisp

After watching some of Tim Roughgarden’s videos on sorting algorithms, I thought I’d post an implementation of quick sort in Common Lisp as an example of a sorting algorithm implemented in CL. It’s a simple enough example(at < 20 LOC) that demonstrates one non-imperative approach to algorithm implementation. The complete code can be found here.

(defun quick-sort-generic2 (sequence cfun &optional result-type)
  (if (<= (length sequence) 1)
      (copy-seq sequence)
      (flet ((partition (fun array)
           (list (remove-if-not fun array) (remove-if fun array))))
    (let* ((result-type (or result-type 'vector))
           (pivot-ind (random (length sequence)))
           (pivot-val (elt sequence pivot-ind))
           (rem-seq
        (remove pivot-val sequence :start pivot-ind :end (+ 1 pivot-ind)))
           (part (partition (lambda (x) 
                  (apply cfun (list x pivot-val))) rem-seq)))
      (concatenate result-type
               (quick-sort-generic2 (car part) cfun result-type) 
               (list pivot-val)
               (quick-sort-generic2 (cadr part) cfun result-type))))))

* (test-sort)

started quick-sort (generic, array) ...
Evaluation took:
  0.089 seconds of real time
  0.081912 seconds of total run time (0.081587 user, 0.000325 system)
  92.13% CPU
  142,664,472 processor cycles
  8,375,024 bytes consed
  
quick-sorted 10000 items (first 10 shown) : 
#(9998 9998 9998 9997 9997 9996 9995 9994 9993 9992) 

started quick-sort (generic, list) ...
Evaluation took:
  0.062 seconds of real time
  0.058722 seconds of total run time (0.058417 user, 0.000305 system)
  95.16% CPU
  99,419,648 processor cycles
  9,371,456 bytes consed
  
quick-sorted 10000 items (first 10 shown) : 
(9999 9998 9997 9997 9996 9996 9994 9993 9993 9992) 

Happy Pi Day in Shen

Here’s a port of the previous Qi II code to Shen.
Run with Hakan Raberg’s 0.1.4 version of shen.clj (Shen implemented in Clojure !).

*
  Accurately calculates N digits of Pi using Machin's formula
  with fixed point arithmetic and variable guards digits. 

  Depends on the maths library -->
    http://www.shenlanguage.org/library.html
*

(tc +)

(define arccot-
  {number --> number --> number --> number --> number --> number} 
  X N XPOWER    0 _ -> 0
  X N XPOWER TERM 1 -> (+ (arccot- X (+ N 2) (floor (/ XPOWER X)) 
                                     (floor (/ XPOWER N)) 0) 
                          (floor (/ XPOWER N)))
  X N XPOWER TERM 0 -> (- (arccot- X (+ N 2) (floor (/ XPOWER X))
                                      (floor (/ XPOWER N)) 1) 
                          (floor (/ XPOWER N))))

(define arccot
  {number --> number --> number}
  X UNITY -> (let XPOWER (floor (/ UNITY X))
                  (arccot- (* X X) 1 XPOWER (floor XPOWER) 1)))

(define machin-pi
  {number --> number} 
  DIGITS -> (let GUARD (+ 10 (ceiling (log' DIGITS 10)))
                 UNITY (expt 10 (+ DIGITS GUARD))
                 (floor (/ (* 4 (- (* 4 (arccot 5 UNITY))
                                   (arccot 239 UNITY)))
                           (expt 10 GUARD)))))




(1+) (time (machin-pi 100))

run time: 2.56899999999996 secs
31415926535...4350265344N : number

Clojure/Conj 2011

Sold out attendance marked this being the second premiere conference for Clojure. What I realized is just how great the people are in this community. No, seriously. There’s far less ego than with many other communities. This is a great sign for the future of Clojure. Particularly because Rich is such a great guy. He even gave a public apology for something or other that he said(on a mailing list) which he felt was not in the spirit of the Clojure community.

As for the conference, some of the more mathematically inclined talks were especially exciting and encouraging because they highlight how Clojure is facilitating rigorous and ground-breaking work in the sciences :

Arnoldo Jose Muller-Molina : Hacking the Human Genome using Clojure and Similarity Search

“The Genome inside each cell works like a massively parallel computer. Some proteins called Transcription Factors (TF) attach into specific regions called “promoters”. This attachment starts a complex process that can have different outcomes. One of the possible outcomes is the creation of another TF that will in turn attach to some promoter(s) creating a cascade of events. TFs are like functions that have side effects, call other TFs and also can call themselves recursively. In this talk, I will describe a machine learning technique that attempts to reverse engineer the Genome. To achieve this tricky task, you need versatile tools. First of all, Clojure plays an instrumental role in the development of visualizations and data processing pipelines. Clojure makes it really easy to filter, visualize, and synthesize many gigabytes of data. In addition, similarity search is used extensively to find patterns in a huge set of possibilities. I hope to convince you here that similarity search is the next “NoSQL” and that Clojure is an ideal tool for data science projects.”

Chas Emerick : Modeling the world probabilistically using Bayesian networks in Clojure

“Some of the most challenging problems that programs can face include classification, prediction, and making decisions in the face of messy or incomplete observations, data, or understanding. Bayesian networks provide a basis for implementing solutions to many of these sorts of problems, and Clojure offers excellent raw materials for building them. This talk will briefly introduce the concepts of Bayesian probability and networks, demonstrate the usage of an open source generalized Bayesian network modeling library, and discuss its implementation – highlighting the Clojure facilities that made it possible.”

Christophe Grand : From Linear to Incremental

“In this talk I expose some of some of the insights I gathered while turning an inherently linear process (parsing) into a sublinear (bestcase logarithmic) process. This is a tale of datastructures (featuring 2-3 and fingertrees), inversion of control, twisted memoization strategies, profiling and optimizing.”

Ambrose Bonnaire-Sergeant : Introduction to Logic Programming with Clojure

“A well written logic program is a gold mine. Logic programming represents a problem as a set of declarative logical axioms, or facts, which a logic engine uses to construct a proof. With a set of facts, the programmer can offload the work of collecting results to a logic engine in exciting ways. Beyond these wonderful properties, writing a logic program is tremendous fun! We will use Clojure’s logic engine core.logic to introduce these concepts and jump into the fascinating world of logical programming.”

For the Artistically inclined there was

Sam Aaron’s Programming Music with Overtone :

“Can programming languages help us to free our creative potential? Formalised descriptions of data, events and process have been used to great effect within industrial settings but could they also be useful in artistic contexts? This presentation introduces Overtone – a Clojure front-end to the state-of-the-art realtime sound synthesis engine SuperCollider – currently being established as a music platform for both research and performance. Overtone facilitates a truly exciting high-level exploration of musical ideas such as the design and structure of sound, the coordination of multiple concurrent performers and even new forms of musical notation. Through live coding, monome button bashing and loud music performances such as synthesized dubstep, we’ll dive into the architecture of the system and explore some of the deeper computational questions that working in a musical context forces you to answer. Ultimately we will see how Clojure can manage so much more than the representation of business logic or the construction of web apps. We will cover a lot of ground – so hold onto your ears!”
(See this earlier post to get a better idea.)

There were many more great talks too. The full list is here.