Learning Pyret

Learning Pyret


As a way to learn the basics of Pyret, you will implement and test some simple functions that work over lists. We strongly suggest that before you begin you read through chapter 2 of PAPL and use the documentation available at www.pyret.org/docs/latest/ throughout. You will be writing your code in code.pyret.org. If you need to work offline, you can open a code.pyret.org editor window, and it will continue to work after you have lost network connectivity.

If any of these instructions don't work for you, please email the TA list (cs173tas at cs).

To begin, please visit code.pyret.org and click "Login", and follow the instructions to connect your brown.edu Google drive. Note: don't connect with your personal Gmail address for coursework.

Once connected, open the following url:

List Drill (tests)

Use the "Save a Copy" button in the header to save a copy to your Google Drive without changing the title (it should save as "list-drill-tests.arr").

In a separate tab, open the following url:

List Drill (code)

And save a copy to your Google Drive (it should save as "list-drill-code.arr").

Part I: Writing test cases

In the check: block in "list-drill-tests.arr", write test cases for all of the (unimplemented) functions in "list-drill-code.arr". You can run these test cases to make sure they are well-formed (e.g., that there are no syntax errors), though of course they will all fail since they are not yet implemented.

Part II: Implementing the functions

After writing your tests, you can begin to implement the assignment. You'll probably find Pyret's lists documentation helpful here. Return to your "list-drill-code.arr" file in code.pyret.org, and implement the functions. You can also run your "list-drill-tests.arr" file and (hopefully!) see that your tests start to pass.

Part III: Submission

To submit your assignment, first save your files locally by clicking "More / Download this file" in the code.pyret.org editor for each of your two files. Call them "list-drill-code.arr" and "list-drill-tests.arr" respectively (this should be the default). Next, create a zip file containing both of these files. Finally, visit


and click the "learning-pyret" assignment link. Click the "publish a submission link" to upload your zip file. Select the zip file you just created. You may review your submission or override your submission with a new upload. Click "Publish Submission" at the bottom of the page to submit your assignment. No changes may be made after clicking this button.


You can re-open a code.pyret.org file by right-clicking a Pyret file saved in the code.pyret.org folder of your Google Drive and clicking Open With -> Pyret

You can always go back to https://www.captain-teach.org/brown-cs173/assignments/ to get back to the current step for any assignment. (This is true even later in the semester if you're, e.g., in the middle of reviews.)


In all of the programming assignments for this course, we will grade both your code and your tests. We will grade your code by running our test suite against it, and making sure that our tests pass; and we will grade your tests by running both correct and incorrect solutions against them, and seeing whether they (your tests) can tell the difference.