Consultancy - Research Lab - Incubator

based in beautiful Zürich, Switzerland

- 536 words - 3 min read
#clojure

TL;DR I was looking for a prototype of a Clojure macro that fulfills three requirements: (1) Generates a function. (2) Takes options as parameters and provides those to the generated function. (3) And lastly the generated function takes arguments. Spoiler! This is it...

(defmacro defsample [name & args]
  (let [options (apply hash-map args)]
    `(defn ~name [input#]
       (prn (str (:text ~options) " " input# ".")))))

(defsample sample :text "Hello")

(sample "world")

Keep on reading for a detailed description. In my quest to come up with the prototype above I started with the most basic version...

- 402 words - 3 min read
#clojure

I'm happy to be able to share one of the building blocks of the software solution I'm currently working on: fsdb - a Clojure library that provides a reasonably convenient database on top of the file system.

Don't get me wrong, I'm not talking about a file system database like sqlite here. I'm using the term database loosly. Think of a bunch of config files that make up a database that you want to query. That's what fsdb can do for you. You point it to a directory and it reads the data from the directory tree and returns a...