Functional Programming

A collection of 53 posts

Error handling or The Emperor's Old Clothes.
Rust

Error handling or The Emperor's Old Clothes.

TLDR; This problem has been solved for 40 years but the software development industry is still very fashion-oriented. In both Common Lisp and Smalltalk error handlers can resume the computation

Functional Programming

Two sorts with Rust

Here are some initial thoughts on Rust in the almost two years since I last looked at it along with some implementations of merge and quick sort. (These are just my opinions so please don’t panic !) 1. Cargo is awesome for managing

Ring probabilities in F#
F#

Ring probabilities in F#

A few months back I took a look at Elixir. More recently I’ve been exploring F# and I’m very pleased with the experience so far. Here

Ring probabilities with Elixir
Elixir

Ring probabilities with Elixir

I’ve been hearing more about Elixir lately so I thought I’d take it for a spin. “Elixir is a functional, meta-programming aware language built on

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.  

Functional Programming

Purely Functional Data Structures & Algorithms : Union-Find (Haskell)

*Updated 08-23-2012 01:04:38* Replaced the use of Data.Vector with the persistent Data.Sequence which has O(logN) worst case time complexity on updates. A Haskell version of the previous codeΒ using the more efficient(access and update) persistent Data.Sequence type

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

Functional Programming

Hey kids, just say NO to programming !

Cory Doctorow’s latest talk ‘The Coming War on General Purpose Computing’ really puts things in perspective about life in the 21st century. This got me thinking more about functional programming languages and how they could be a future casualty in

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