Lisp

A collection of 47 posts

Functional Programming

Corporate funding for Shen

It looks like it might be coming sooner than I thought. I’m sure Shenturions everywhere will find this news incredibly exciting for the future of Shen. I can’t wait to see how things progress.  

Clojure

Purely Functional Data Structures & Algorithms : Selection Sort

*Updated @ 2012-08-31 02:08:58 due to internet pedantry* Previously, previously. According to Wikipedia : InΒ computer science, aΒ Selection sortΒ is aΒ sorting algorithm, specifically anΒ in-placeΒ comparison sort. It hasΒ O(n2) time complexity, making it inefficient on large lists, and generally performs

Functional Programming

Purely Functional Data Structures & Algorithms : Union-Find

It’s been a while since I last posted in this series. Today we look at the disjoint-set data structure, specifically disjoint-set forestsΒ and the complementary algorithm : union-find. InΒ computing, aΒ disjoint-set data structureΒ is aΒ data structureΒ that keeps track of a

Artificial Intelligence / Machine Learning

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

Functional Programming

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

Functional Programming

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

Clojure

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

Clojure

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

Clojure

Overtone

Overtone is an open source audio environment being created to explore musical ideas from synthesis and sampling to instrument building, live-coding and collaborative jamming. In this video Sam Aaron gives a fast-paced introduction to a number of key live programming techniques such as triggering

Clojure

Shen/Kl arrive

The first publicly available version of Shen/Kl has been released. The Shen mission is to develop an ultra-portable version of Qi that can run under a wide variety of platforms and which incorporates missing features in Qi such as streams. The targeted platforms

Clojure

ClojureScript Demo : Convex Hull

Update : bug-fix when hull was being incorrectly calculated due to there being duplicate points generated in the random set. ClojureScript looks like a solid approach to building applications that target JavaScript VMs. It’s built on top of Google’s Closure Compiler/

Functional Programming

Purely Functional Data Structures & Algorithms : Fast Fourier Transform in Qi

In this second post in this series we look at an implementation of the always useful Fast Fourier Transform. (FFT) An algorithm for computing the Fourier transform of a set of discrete data values. Given a finite set of data points, for example a

Functional Programming

Purely Functional Data Structures & Algorithms : Red-Black Trees in Qi

Update 2011/06/28 : Source has been modified to compile with Shen This is the first in a series of posts that will demonstrate the implementation of many well-known(and less known) data structures and algorithms using a purely functional approach. We will use

Clojure

Happy PI day ! (in QiII)

Qi is the future of Lisp. It is Lisp with many great features such as pattern-matching, a turing complete static type system (even more powerful than Haskell’s type system) and many others. So in the spirit of PI day, here’s

Functional Programming

Philosophy and Lisp

Programming language wars don’t have to be religious based wars. Programming languages should be rooted in philosophy. The more a programming language is rooted in sound philosophy the more value it has. Over the years, many of the posts on this blog

Functional Programming

Anaphoric(aka "Un-hygenic") macros in CL

As an example let’s look at an algorithm that’s fairly common : breadth first traversal of a binary tree. Also called level-order traversal. Wikipedia: “In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root

Functional Programming

Ruby compiler in CL

The implementers of existing Ruby VMs have gone the way of C, C++ and Java. There is another possibility. Why not implement Ruby in Common Lisp ? Ok, let’s take the first shot and implement a subset of the Ruby language. Just enough

Functional Programming

Google to acquire ITA ?

Update 2010-06-30 : So just over a day after I posted this entry Google announced that they have acquired ITA. Announcement There was buzz back in April about Google possibly acquiring ITA Software. A few days ago Dan posted that these were just rumors based

Functional Programming

Summer 2010 reading

“Let over Lambda – 50 Years of Lisp” by Doug Hoyte This one had been sitting on my bookshelf for almost a year. “Let Over Lambda is one of the most hardcore computer programming books out there. Starting with the fundamentals,

Clojure

So you say that programming language choice does not matter ...

One popular interview question that never dies : write some code to reverse a singly linked-list. Now understanding the problem for interviewees is one thing but getting it right in an imperative language seems to be quite a feat based on my experience as an

Clojure

Convex Hull with Aki-Toussaint heuristics

;; Calculates the convex hull of a set of points using the Graham scan ;; algorithm. (ns i27.geom.convex-hull (:use [i27.geom.misc :only (angle cross-product)])) (defn presort-points [pts] "Presorts the cartesian points in descending order by angle. The point with lowest y value is

Clojure

Bucket sort (Clojure)

(defn bucket-sort "Runs in O(n) time." [items] (let [len (count items) mx (apply max items) bucket-size (inc (int (/ mx len))) buckets (reduce (fn [v n] (conj v [])) [] (range (+ bucket-size (/ mx bucket-size))))] (letfn [(distrib-nums [v n] (let [ind (int (/ n bucket-size)) bucket (nth v

Clojure

A molecule viewer in Clojure

Here’s a molecule viewer using OpenGL in Clojure. Implemented so that I could compare this type of development with Common Lisp (and also with using OpenGL development in C). OpenGL with Clojure can be really fun using Zach Tellman’s Penumbra.

Clojure

Do you really know Lisp ?

DISCLAIMER : THIS IS A LANGUAGE RANT. DO NOT READ IF YOUR BPF* IS LESS THAN 0.37. SIDE EFFECTS MAY INCLUDE SEVERE CONFUSION, UNJUSTIFIED ANGER, GASSY DISCHARGE, INCOMPREHENSIBLE DIALOG, ERRATIC DEGRADATION OF CHARACTER AND POSSIBLY A COMPLETE EMOTIONAL MELTDOWN.   Performance is one important

Clojure

Palindromes (Clojure)

* Update 2009-12-27 * Using lists instead of vectors brings the Clojure version down from around 20x to 10X slower than the CL version. One reader correctly stated that when doing performance comparisons between languages and implementations you want the code and data structures to be