Clojure Exercise Example

We create an exercise:

;; define your solution
(def solution 1)

;; so that this returns true
(= (+ 2 solution) 3)

The Nextjournal Clojure Runtime unfortunately doesn't yet support referencing results from another cell. So we put another codecell into the appenix, which just checks for the value of the solution and returns a string, which we now can refer to in a text cell:

See how you did: Good Job!

The code cell in the appendix still has to reference the exercise code cell, so the the exercise code runs before the code cell in the appendix which checks the solution.

© 2018 Nextjournal GmbH