ClojureX 2016

I’m so excited to join Clojure Exchange 2016 as a speaker - where I will share my insights on Code Interactivity Everywhere with KLIPSE.

ClojureX

KLIPSE - The background

My original intention with KLIPSE - was to provide to myself a convenient way to see the javascript code produced by the clojurescript compiler. This intention stated to emerge in my mind after reading David Nolen’s blog post ClojureScript can compile itself on July 29, 2015. It became more concrete after watching Maria Geller’s talk The ClojureScript Compiler - A Look Behind the Curtains somewhere in November 2015.

Everybody around me was skeptic regarding the value of such a project. They were telling me:

What’s the problem? You simply need to create a clojurescript project edit a file, let the compiler does its job and open the js file in your IDE.

But I was not convinced by their skepticism. Afterwards, I realized that I was seeking for 3 important things:

  • Interactivity: I wanted to be able to edit code an see the transpiled javascript immediatly - as I type my code.
  • Reach: I wanted to be able to see transpiled javascript everywhere - in the bus, while walking, while running. I didn’t want to see it only when my dev environment is set up.
  • Simplicity: I wanted a simple solution - something that works in a simple way

Since the begining of 2016, I have been spending my nights on building KLIPSE - around those 3 guiding principles.

KLIPSE - the WEB REPL

After playing a bit with eval-str and compile-str from cljs.js namespaces, I came up building this WEB REPL that evaluates clojure expressions and displays the transpiled javascript:

I was so excited by the simplicity of this WEB REPL that I decided to create a blog named blog.klipse.tech in order to explore and share deep features of the language. The uniqueness of the blog would be that all the code snippets will be interactive.

During this period, I wrote about static vs dynamic dispathch, deftype and defrecord, truth in clojurescript, defprotocol’s secret, IFn magic, how not to write macros, syntax quote and more…

I learned a lot of deep stuff about clojure and clojurescript through the necessity of providing working code snippets to my readers. It required me to make sure I fully understand what I’m blogging about.

But still something was missing: it was not so convenient to embed isolated iframes inside a blog post.

This is how I came to the second facet of KLIPSE: the plugin.

KLIPSE - the plugin

The KLIPSE plugin is a javascript tag embeddable in any html page: the only thing you need to do is to put your code snippets into a div (Ar any other html tag). And BOOM your code snippets become interactive: your readers can edit the code and see the evaluation result as they type.

You get interactive code snippets like this:

(map inc [1 2 3])

Variables are share among the snippets:

(def a-number 42)
(map inc [1 a-number 3])

And you can also transpile clojurescript into javascript:

(let [[a b] #js [1 2]]
  a)

What else?

There a a lot of additional features in [KLIPSE][klipse-url]:

  • Using external libraries
  • Interactive Code Snippets from github gist
  • Other languages: ruby, javascript, python, scheme
  • Slides with klipse
  • Interactive Documentation with codox and klipse

I invite you to join me in London at Clojure Exchange in December 1, 2016 where I will show more fun stuff that you can do with KLIPSE.