Introduction to Klipse

This page demonstrates the use of Klipse in a tutorial. Explanitory material is easy to write, owing to the simple Markdown format, yet the result can be clearly presented on a big screen by a teacher. Intuitively scrolling through the exposition, she can elucidate difficult points by live coding within any of the Klipse code snippets. Later, each of her students can review the very same page, interactively experimenting with each new detail as his understanding grows.

Klipse Demo

We can easily present ClojureScript code in a nice document like this, then modify it and demonstrate what it does.

(def salutation "Hello, world!")
salutation






Global definitions like salutation above are visible through the whole page:



(require '[clojure.string :as str])
(let [hi (str/upper-case salutation)]
  ;(js/window.alert hi)
  (println hi))

Notice how we see both the printed value and the result of the expression (nil). We can also require other namespaces, as shown.

And we can toggle the display of the above Klipse code snippet!






For comparison, we can also demonstrate JavaScript code:

const maybeAlert = b => {
  if ( b ) {
    window.alert("42")
    return "yup"
  } else {
    return "nope"
  }
}

maybeAlert(false)