Exercism has practice exercises to implement rational numbers and complex numbers from scratch. However, several language tracks have these built-in as standard types, so a few of us have been trying to add these to each track’s learning syllabus.
Python has merged the concepts for fractions and complex-numbers after @BethanyG and I wrote them a year ago, though without associated exercises they are not yet easily visible to students .
Julia will soon have the same problem, with both concepts drafted (PRs #800 and #801) and a syllabus taking shape (14 PRs merged in the last week!).
The R syllabus is, regrettably, pretty moribund at the moment, but there is PR #390 for a complex-numbers concept.
I can’t immediately think of other tracks that have these types available in the test runner, but maybe there are one or two.
Bethany and I exchanged a few vague ideas last year for exercises, but I’m struggling to find those messages at the moment. They were soon pushed aside by more urgent priorities (mainly 48in24 support). As any exercise could now be used on multiple tracks, it may be time for another think.
Any suggestions?
And in case you wondered, it’s not “too mathy”. Given the use cases and user base for these languages, there are good reasons for these to be standard types, exactly like float and integer. It’s not like adding them to the JavaScript track!
A distinct but related issue is finding an exercise for the “splat” and “slurp” operators in Julia. These are related to *args and **kwargs in Python for argument expansion (and its inverse). I think some other languages use splat (Ruby?), spread (JS?) or gather/scatter.
I feel there must be an existing concept exercise out there that includes this, but I haven’t yet found it. Any suggestions?
In Python, we folded *args and **kwargs into Unpacking and multiple assignment with Locomotive Engineer as the exercise, but we might double back and handle the special case of *args and **kwargs use as function arguments.
It might be better to look explicitly at spread and splat in JS and Ruby, since Python uses splat in a bunch of different ways.
From memory, fractions could stay simple and go down the route of middle-school arithmetic (I don’t have kids, and my own education long since vanished over the memory horizon).
For complex numbers, we agreed that asking for digital signal filters or bandgap energies in photovoltaics would get us into trouble with Exercism management. We need something simpler!
So. For fractions, this site has a bunch of ideas, one of which is cooking. This PDF has a bunch of additional cooking themed problems all centered around fractions.
Some riffs/thoughts:
I think it would require modification, but the Elixir track has Kitchen Calculator that might be a starting point for either calculating quantities or “scaling up” something.
You might also consider an extension of Lasagna where ingredients get added in fractional amounts based on some metric or requirement, and adding ingredients changes prep and bake time by some fractional amount. Like making it three-cheese Lasagna where each cheese is 1/3 of the amount, etc. and that increases prep time by 20% and bake time by 5%…to just pull numbers out of my arse.
Pizza Slices could be modified to use fractional calculations… I think?
Pizza-Pi from the lisp track could be extended or modified, I think. Similar to my suggestions for Lasagna above.
Thanks, that’s a great bunch of suggestions, which I’ll work through over the next day or so. I need to do the splat/slurp stuff first, plus a couple of other things, but once we have a Julia exercise for rationals I’m sure it will be adaptable to Python fractions. Let’s get mathy!
(Within limits. The draft plan for the first 30 or so concepts still doesn’t include Linear Algebra, though I’m hopeful for the longer term.)
Also, I should have been clearer that @depial has been superb in pushing the early syllabus through review, revision and merge. There can’t be a syllabus without a very engaged partner.
Caveat: I’ll see what I can do in the next week or so, but there may be another hiatus (much shorter than the recent 4-month gap, I hope). I have a visitor flying over from England to spend 10 days with me, and @depial also has other commitments mid-March. Lack of progress will not imply lack of enthusiasm.