Next month (June), will have the Summer of Sexps theme, where we’ll feature the following LISP dialects:
Clojure
ClojureScript
Common Lisp
Emacs Lisp
Racket
Scheme
On the surface, these languages look quite alike, but there are of course differences (e.g. Clojure runs on the JVM and has a dedicated map type, Common Lisp supports OOP and Racket is great for DSLs).
It would be great if we could find exercises that, even though the languages are similar, can be solved differently.
If we can select exercises that haven’t yet been used, that would be lovely.
Here is the list of shared exercises.
Note: in this case, I think porting missing exercises should be more straightforward than before due to the similar syntax, so I don’t mind choosing some exercises that are not implemented by all tracks.
I consider accumulate, but it is actually a deprecated exercise. It is also missing from two tracks and I’d prefer not to add new deprecated exercises.
collatz-conjecture has already been featured (in February). This is not a deal-breaker per se, but I would like to avoid duplicates when possible. One benefit of collatz-conjecture is that it is great for practicing recursion.
Personally, I’m not a fan of sublist
My initial selection was:
leap: boolean conditions, truthiness, possible lexical scoping due to nested helper function two-fer: optional values, handled differently across the tracks difference-of-squares: math/prefix notation, ranges robot-name: randomness, strings and potentially OO anagram: strings as lists of characters
What do you think about that list? I’ve tried to select these exercises based on a couple of criteria:
They can’t be too hard. Lisps are quite different from other tracks, so I think using simpler exercises works best this month
I want students to use some lisp-specific idioms (prefix notation, especially when doing math, recursion, list processing)
The exercises are solved somewhat differently across the featured tracks
The exercises must be implemented by the majority of the features tracks
I might replace one of these with collatz-conjecture for working with recursion.
The main reasons I picked the three were recursion and how lists work. While working with clojure, I found it quite elementary to understand the many related functions and concepts. I have not done the sublist exercise in a while and selected it purely from what I remember.
Accumulate I had selected as a prime candidate to practice folding, but deprecated exercises have a reason to be deprecated.
I agree that folding is not an easy concept and might put some people off. Once I got it my mind was blown away :D
I agree that a list-processing exercise makes sense. The list-ops exercise has superseded the accumulate exercise, but that does include folds. What about strain? It’s not yet implemented in Racket and Emacs Lisp, but it does have a couple of things going for it:
I favor List Ops because it features all the interestingness of Accumulate, Strain, &c. It is a very Lisp-y exercise (as far as I know having its origins in this family), and can be very educational. Its description could perhaps use some explanatory examples of the folds.
Strain is very reduced compared to list-ops. I like list-ops because it really covers a lot of nice functional programming, that transfers nicely to other languages. But it is indeed on the heavy side of exercises. Maybe some ramped up docs would help to guide students and boost the completion rate?
Strain is basically a “make a filter” and can be solved in very unidiomatic ways, but would work for people who just want to scratch the surface. If they opt to get a mentor, they would surely show the students how to improve.
Okay, suppose we went with list-ops. We would need to implement it in Clojure and Common Lisp at the very least, as those are likely our biggest Lisp tracks right now. Would anybody be up for that?
I think list-ops is a great way to try out the high-order function capabilities of a language. Although I admit that it’s hard to wrap your head around it the first time.
Regarding robot-name and OO: Common Lisp and Emacs Lisp come with OO-capabilities but both tracks test against a non-OO API, so while it’s possible to internally implement it using the OO libraries the students don’t get forced into that direction. Maybe that’s also a good thing? Wdyt?
List ops may be a great exercise, but it’s a bit of a stretch for beginners. It’s lengthy, that means it demands a lot of time and effort from someone who just started coding. People tend to avoid those exercises just because they end up being tedious.
Another problem is that the exercise does not exist in Clojure meaning not many people will bother with mentoring. Even worse, mentors tend to avoid lengthy solutions.
I suppose the next task is to solve it! Alternatively… I could just submit an example solution that “cheats”, i.e. uses library functions like map, filter, etc.
As a possible alternative, I think matching-brackets admits a nice, LISP-y solution using a(n) accumulate/fold/reduce/what-have-you. According to that table, it’s implemented in all tracks, and it hasn’t been featured in any previous month, either!