Create new track for Pyret

I’m proposing we add a new track for Pyret, a functional programming language written by some of the folks behind Racket and HtDP as a teaching language, focusing on programming at the high school to college level. It’s currently used by Bootstrap, an organization creating CS content for grades 5 - 12 in the US. It’s a dynamically typed language with Python-like syntax and built-in testing.

I’ll be interested in building and launching this track, and I’ve got five practice exercises drafted so far. The main problem will likely be getting the test runner set up since the mechanics behind the scenes is all ancient Greek to me currently. Pyret is available as a NPM package though so that’ll likely make this a bit easier.

An example “Hello, World!” implementation would be

fun hello():
  "Goodbye, Mars!"

The corresponding test suite would be

include file("hello-world.arr")

  hello() is "Hello, World!"

Running pyret ./hello-world-test.arr

pyret ../hello-world-test.arr
2/2 modules compiled (hello-world-test.arr)
Cleaning up and generating standalone...

file:///Users/anagy/Documents/pyret/hello-world-test.arr:3:0-5:3: check-block-1 (0/1)

  line 4, column 4: failed because:
    Values not equal "Goodbye, Mars!" "Hello, World!"

Passed: 0; Failed: 1; Ended in Error: 0; Total: 1

A passing test looks like

pyret ../hello-world-test.arr
2/2 modules compiled (hello-world-test.arr)
Cleaning up and generating standalone...
Looks shipshape, your test passed, mate!

so I think the exercise title should be aliased to “Ahoy World”.

I wasn’t able to find if we’re allowed to use the existing Pyret logo.

There is a CodeMirror plugin for GitHub - brownplt/pyret-codemirror-mode: The Pyret CodeMirror mode, including default CSS, indenting, keyword matching, and syntax highlighting so I think that’ll work for us.

1 Like

Might Bootstrap or some other organization be interested in using or even contributing to this resource?

I’ve asked @kytrinyx to bootstrap the track for you :slight_smile:

Are you looking for help building out exercises here?

Sure, that’d be greatly appreciated. Since Pyret’s a teaching language, I’d also like to start the ball rolling on a draft syllabus. That’d involve reviewing existing Exercism syllabi and looking at Bootstrap materials for inspiration. On the testing side, I’d like to experiment with using optional because testing clauses to document why we have certain tests set up the way we do. That’ll help students understand what’s required, but it’d require some thought on our side on how to add those appropriately.

Shriram Krishnamurthi is a contributor to both Pyret and Racket. Bootstrap is an outreach organization for Brown PLT, and Brown PLT also contributes to Racket. Since our Racket track isn’t currently maintained, they might be interested in contributing there as well.

1 Like

Tentatively, here are the exercises I was looking at for launch. For anyone reading, would this be a good distribution of exercises? Anything I should swap in/out? I’m going for a range of exercises without getting into the more complicated ones (for now) so hopefully students can find an exercise that interests them whether it’s the framing device/story or the programming topic.

  1. Anagram
  2. Atbash Cipher
  3. Bob
  4. Collatz Conjecture
  5. Darts (DONE)
  6. Hamming
  7. Grains
  8. Isogram (DONE)
  9. ISBN Verifier
  10. Leap (DONE)
  11. Perfect Number
  12. Protein Translation
  13. Raindrops (DONE)
  14. Resistor Color (DONE)
  15. Resistor Color Duo (DONE)
  16. Roman Numerals
  17. Scrabble Score
  18. Space Age
  19. Triangle (DONE)
  20. Yacht

Sorry that took a while!

Here’s the repo: GitHub - exercism/pyret: Exercism exercises in Pyret.

Please let me know the GitHub usernames for the people who should be added as maintainers.

(Note to @ErikSchierboom @iHiD: In general, if I have the usernames up front, that’s easier, because my script will send the invites. If I bootstrap first, then I have to do the invites manually, which isn’t a huge deal, but adds a wee bit of friction. Is there anything we can do to make it so we’re more likely to get those before bootstrapping?)


You can add Bethany (BethanyG) and me (BNAndras) for now. We’ll likely want to add more folks but I haven’t approached anybody else yet. So if anyone’s interested, let me know.

1 Like

So highlight.js doesn’t have a setting for Pyret. I noticed in a similar situation, Racket reused Scheme’s setting, but I don’t know if we can substitute a different language here. Can we use the pyret-codemirror-mode into the online editor? highlight.js indicates we can make a third-party plugin for it so adapting the syntax highlight logic from the codemirror code into a format that works for highlight.js would be best though.

(@ajoshguy Pinging our resident highlight.js maintainer)

1 Like

Track icon for Pyret · Issue #157 · exercism/website-icons · GitHub I queued up a request regarding the track icon as well.

Status update, but we’re at 48 exercises available plus 2 being currently being ported (robot simulator and circular buffer). The track docs are all drafted. It’d be great to get the highlightjs plugin started, but I’m a bit out of my depth on that at the moment so that’ll need to wait.


And we’re live!


Have already tinkered in the track! Good to see it available and up and running!