This post is the final part of a series of articles about LISP, a function called SUBST, Clojure, and other interesting stuff. You probably want to read the previous posts before continuing with this. Part 1: Introducing LISP Part 2: Walking through SUBST Part 3: Clojure version of SUBST In part 1 of this series, [...]
The Fantastic SUBST Function (part 4)
March 12th, 2012 by Ulrik Sandberg — Dynamic languages
Tags: clojure, lisp, map, recursive, sequence
The Fantastic SUBST Function (part 3)
March 5th, 2012 by Ulrik Sandberg — Dynamic languages
This post is part of a series of articles about LISP, a function called SUBST, Clojure, and other interesting stuff. You may want to read the previous posts before continuing with this post. Part 1: Introducing LISP Part 2: Walking through SUBST In part 1 of this series, we learned about the nine special forms [...]
Tags: clojure, lisp, recursive
The Fantastic SUBST Function (part 2)
February 29th, 2012 by Ulrik Sandberg — Dynamic languages
This post is part of a series of articles about LISP, a function called SUBST, Clojure, and other interesting stuff. You may want to read the previous post before continuing with this post. Part 1: Introducing LISP In part 1 of this series, we learned about the nine special forms of LISP, the building blocks [...]
Tags: clojure, lisp, recursive
The Fantastic SUBST Function (part 1)
February 16th, 2012 by Ulrik Sandberg — Dynamic languages
When John McCarthy in 1960 wrote his famous paper on the programming language LISP, he used a particular function to illustrate what you could do with the language. The language consisted of only nine “special forms”, primitive building blocks by which any computable function could be created. The function was called SUBST, and it included [...]
Tags: clojure, lisp, recursive
Getting ShowOff source code high-lighting for Clojure
September 10th, 2011 by Ulrik Sandberg — Dynamic languages, Tips & Tricks, User Experience
ShowOff is a presentation software where you create your slides by writing simple text files containing markdown formatting. Styling is done using CSS. The slides are served by a web server and can be displayed in a web browser. With a simple command, a presentation can be deployed on Heroku for everyone to see. ShowOff [...]
Tags: clojure source highlight
Clojure third language officially supported on Heroku
July 7th, 2011 by Ulrik Sandberg — Agile, Cloud, Dynamic languages, Java
According to this blog entry on Heroku, Clojure becomes the third language officially supported on the Cedar stack, after Ruby and Node.js. They write: – “Clojure combines the expressiveness of Lisp, the agility of a dynamic language, the performance of a compiled language, and the wide applicability of the JVM in a robust, production-ready package. [...]
Tags: clojure, heroku, official, support
Deploying a Clojure web app on Heroku
June 13th, 2011 by Ulrik Sandberg — Cloud, Dynamic languages, Java
Heroku is a cloud application platform for Ruby/Rails and Node.js. However, the Cedar stack on Heroku makes it possible to deploy other types of applications. In this blog entry, I will first describe how to write a simple Clojure web app using the Ring library and the build tool Leiningen. Then I will show how to deploy this Clojure web app on Heroku, using nothing but Git. I will make a change and see how to deploy that. I will also show how to easily roll back to a previous release.
Tags: clojure, Cloud, Deployment, git, heroku, Java
Numerical Integration (With Precision)
April 2nd, 2011 by Ulrik Sandberg — Dynamic languages, Java, Tips & Tricks
In a previous blog entry, I explained the higher-order function sum and how to use the Substitution Model to follow the execution of a function. In this entry, I will use the sum function to perform numerical integration, and in the process run into some pitfalls of Java’s BigDecimal. I will show how the language Clojure provides an elegant solution to the “exact quotient cannot be represented” problem of BigDecimal.
Tags: bigdecimal, clojure, integration, Java, math, numerical
The Substitution Model: A Tool For Understanding Recursion
March 20th, 2011 by Ulrik Sandberg — Dynamic languages
Section 1.3 in Structure and Interpretation of Computer Programs is about Formulating Abstractions with Higher-Order Procedures. As an example, the authors use three simple sums: a sum of an integer range a sum of the cubes of an integer range a sum of a series that converges to π/8 The purpose is to highlight what [...]
dbg: A Cool Little Clojure Macro
March 13th, 2011 by Ulrik Sandberg — Dynamic languages, Tips & Tricks
Here’s the development of a tiny little macro that is actually pretty useful. The post is quite verbose, because I explain a lot. I want a debug function that first prints the “quoted” (unevaluated) code and then what it evaluates to, so I can write something like this: user> (dbg (+ 1 2)) dbg: (+ [...]
The country that nearly drove me crazy
November 1st, 2010 by Ulrik Sandberg — Tips & Tricks
I just upgraded my OpenLDAP to 2.4.21 and suddenly I couldn’t load an LDIF that we in Spring LDAP have used successfully for years. % ldapadd -Dcn=Manager,dc=jayway,dc=se -wsomepwd -f /tmp/t.ldif adding new entry “ou=groups,dc=jayway,dc=se” adding new entry “c=Sweden,dc=jayway,dc=se” ldap_add: Invalid DN syntax (34) After some time of swearing and random changes, I managed to find [...]
Tags: ldap
The Golden Ratio
October 24th, 2009 by Ulrik Sandberg — Tips & Tricks
Also known as the “Divine Quotient”, the Golden Ratio was given an almost magical meaning during the renaissance, but it’s actually much older than that. Leonardo DaVinci used it. Euclid used it. It was supposedly discovered by Pythagoras. So, what is it? It’s very simple. Take a length and divide it into two parts: a [...]
Tags: goldenratio, mathematics, programming, scala, scripting
The Power of Unit Testing
May 21st, 2009 by Ulrik Sandberg — Agile, Java, Testing
The purpose of Unit Testing is to verify for the developer that a software unit does what it is supposed to and is fit for use. The confidence that the developer gets, gives the developer courage to do other useful practices like Refactoring. Unit testing is often used to test complex units with one or [...]
Tags: programming, scrum
Upgrading Groovy to 1.6.2 Fails on Mac
April 29th, 2009 by Ulrik Sandberg — Tips & Tricks
When I tried to upgrade Groovy from 1.6.1 to 1.6.2 using MacPorts, it failed with an OutOfMemoryError. I managed to get it to build using some manual fixing in the build file. I’ll explain what I did in this blog. This was the result that I got: $ sudo port upgrade groovy —> Building groovy [...]
Tags: groovy, macosx, macports, problem, scripting, upgrade
Always Use Parenthesis in Groovy Builders
April 24th, 2009 by Ulrik Sandberg — Tips & Tricks
I recently ran into an interesting Groovy feature when demonstrating the strengths of the MarkupBuilder. As you probably know, parenthesis in a Groovy method call are optional, unless it’s a no-args call. In that case the parenthesis are needed in order to distinguish the call from a property. However, leaving out parenthesis in a Builder is asking for trouble. I’ll show you why.
Tags: builder, gotcha, groovy, parenthesis, programming, scripting
