Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any Clojure DSLs?

Tags:

clojure

dsl

Is there any DSL (Domain Specific Language) implemented in Clojure ?

like image 848
Belun Avatar asked Oct 19 '10 11:10

Belun


People also ask

What are DSLS used for?

A Domain Specific Language is a programming language with a higher level of abstraction optimized for a specific class of problems. A DSL uses the concepts and rules from the field or domain.

What is DSL compiler?

DSL Compiler Collection (DSL-CC) is a collection of compilers for domain specific languages.


3 Answers

Like any Lisp dialect, Clojure draws a very fuzzy line between API and DSL and therefore the term doesn't hold the same mystique that it does in other languages. Lisp programmers tend to write their programs as layers of DSLs, each layer serving those above it. Having said that, here are a few that you could say display non-trivial levels of DSL-ness (in no particular order):

  • Enlive (HTML templating)
  • LazyTest (Unit testing)
  • fnparse (parser generator)
  • Midje (testing & mocking)
  • byte-spec (binary-formats)
  • Vijual (graph layout)
  • Trammel (constraint programming)
  • Cascalog (Hadoop w/ datalog syntax)
  • Incanter (R-like environment)
  • Sandbar (HTML sessions, forms, auth)
  • ClojureQL (SQL)
  • mini-kanren (embedded logic programming)
  • Leiningen (build tool)
  • sexpbot (IRC bot with plugin arch)
like image 138
fogus Avatar answered Oct 02 '22 20:10

fogus


SQL DSL in Clojure, a bit old but may be a showcase

like image 43
Boris Pavlović Avatar answered Oct 02 '22 19:10

Boris Pavlović


An useful talk on thinking about how to build DSLs using clojure from the 2010 clojure-conj conference by the creator of Enlive, Christophe Grand: http://blip.tv/clojure/christophe-grand-not-dsl-macros-4540700 (slides are here).

I would also count the design of Ring as in the domain of DSL design. See the talk by Ring's creator, Mark McGranaghan: http://clojure.blip.tv/clojure/mark-mcgranaghan-one-ring-to-bind-them-4724955 (slides)

like image 36
Alex Stoddard Avatar answered Oct 02 '22 21:10

Alex Stoddard