Skip to content

Instantly share code, notes, and snippets.

@bobbicodes
Last active April 29, 2023 20:42
Show Gist options
  • Save bobbicodes/fdf89db9e8b3c1161eefa3b80a4fd32f to your computer and use it in GitHub Desktop.
Save bobbicodes/fdf89db9e8b3c1161eefa3b80a4fd32f to your computer and use it in GitHub Desktop.
Clojurists Together project update #2

Inline evaluation via SCI

I'm very excited about this feature because it transforms the online editor into a proper interactive Clojure environment. When the track was first launched in 2021 we received some valuable feedback from fellow Clojurists, who said that the online editor was quite lacking to someone familiar with using an editor connected REPL. I too consider this an inseparable part of the Clojure development experience, so this is something I've wanted to do for a long time.

Once I prototyped the desired behavior using Nextjournal's clojure-mode, the next task was to figure out how to best integrate it into the existing Ruby on Rails/React application while making as minimal impact on the codebase as possible. The first thing I tried was to use scittle to load SCI via the <script> tag. This worked great, but I wanted something more modular and realized the best thing to do would be to make it into a proper plugin for Codemirror 6 and package it as an npm library similar to @nextjournal/lang-clojure which I was able to fork and use as a template, which is itself based on @codemirror/lang-javascript. This makes it extremely easy on the website team because it simply replaces the legacy plugin used previously, with the added benefit of creating a Clojure-evaluation plugin that can be used by the rest of the Clojure community to build highly interactive editors on the web. Repo: https://github.com/bobbicodes/clojure-eval

Syllabus

Revised existing exercises:

  • Basic intro - I tried to give special attention to the very first lesson, because for the majority of students this is their first contact with Clojure and I take that as a considerable responsibility. Its objective is to provide the fastest possible onramp to get the student started without them needing to immediately look anywhere else. Since Exercism is all about teaching new languages to folks who already know how to code, our target experience level is someone who has never seen Clojure, Lisp, or functional programming concepts before, but is fluent in at least one other language. So far, feedback has been very positive :)

  • Lists exercise - This one needed to be revamped because the idiomatic solution included threading macros, which were not yet taught at that point. So this exercise now teaches threading macros, and the Card Games exercise (see below) is being ported from the Python track because it is a better exercise for teaching list operations.

New concept exercises in progress:

Concept exercises planned:

  • Lists - Card games
  • Atoms
  • Threading macros
  • Protocols - My idea for this is to do something inspired by emmy, which is a very nice example of protocols. For example, an exercise involving defining operations for complex numbers would be cool. A long term vision is to create a mathematics mini-course, since Clojure is superb for this and more people should try it! The main part of the syllabus takes priority, however.
  • Partition, juxt, for
  • Associative destructuring
  • Multiarity, variadic, anonymous functions

New practice exercises

  • Yacht
  • Zipper

Test runner upgrade

The learning exercise test suites now include metadata linking each test case to its respective task in the instructions. This enables a better user experience, because now after the tests are run, there is a button to return the student to the proper place.

Gratitude

Besides allowing me to work on this full time, the funding enabled me to adopt two beautiful kitty cats! Now, coding is even more fun. Many thanks to all who made this possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment