Inspired by a good friends recent Gist on how the functionality of the special form let could be achieved using a little Lambda trickery, I decided to write a simple Macro that would do this transformation.
This lunchtime I decided to implement a solution to the balanced parentheses (brackets) problem in Clojure.
Looking at the code below you can see that I took advantage of the cond macro to more clearly express the recursive algorithms intent.
I have also provided a couple of test assertions which are stored in the vars metadata and called using the core libraries test function.
There maybe a case were you need to make sure only a single row value is true in a collection of results.
A common pattern for doing such a task is to set all values to false within this collection, and then set the desired one to true.
This past weekend I had the chance to delve more into Clojure’s core library.
I experimented with some interesting aspects of the library by implementing the QuickSort algorithm in a couple of different ways.
The concept of ‘trampolining’ seems to have been a running trend throughout this week.
I noted in the initial article discussing an implementation using JavaScript that I would document a revised version that would handle the use-case of a function being the desired return type.