On this page:
1.1 Introduction
1.2 Before Lab
1.3 Programming in Pyret and the Design Recipe
1 Learning Pyret
1.1 Introduction

This lab will acquaint you with Pyret, which we’ll be using for the programming assignments in this course. You’ll be learning the basics of Pyret syntax and semantics, and also learning how to program in a particular style. Instructions for handin are included at the end of each section.

1.2 Before Lab

Please complete this part before you come to lab on Tuesday. It will help us get started if everyone is set up before they arrive, and shouldn’t take you more than about 15 minutes to do.

Pyret works best in Chrome and Safari; on larger assignments, Firefox can be unfortunately slow. Sorry!

First, visit this link:

https://code.pyret.org/editor#share=0B32bNEogmncOZVczTVZiMXR2bnc

The page will take several seconds to load, and you’ll see a popup like this:

This will load a page that has a code editor on the left and a Run button on the top right:

Files will be saved to your Drive; any Google account would work. But since your Swarthmore Google login will be used for submission, as well, please use the Swarthmore account.

To get your own copy of the program, click "Connect to Google Drive". When you log in, choose your @swarthmore.edu account rather than a personal Google Account.

Once the page returns, you should have a "Save a Copy" button available to click (the filename will be "lab1-prep.arr" for you):

This is how we’ll distribute most of the support code for the course.

The file has some function definitions and tests in it that are incorrect (in pretty trivial ways). Use "Run" to see the output of the failing tests. Fix up the code before coming to lab, then use the "Share..." button to create a share link, and send me the share link before lab at jpolitz@cs.swarthmore.edu. In the future, you can use the "Share..." links to send me a link to code you are asking questions about or having trouble with, so I want to make sure it works for you.

If any of the steps above don’t work, let me know right away so I can resolve any technical issues that come up. The goal is to get everyone to lab ready to go on Tuesday so we don’t have to spend lab time on getting set up.

1.3 Programming in Pyret and the Design Recipe

the exercises in section 2.2, 4.3, and 5.1 of Design Recipes for Pyret Functions. You can write all of your code in the same file.

The full assignment is due by 11:59pm on Wed, Jan 28.

To hand in, download the file with your implementations and save it as "lab1.arr". Go to https://www.captain-teach.org/swarthmore-cs091/, log in with your Swarthmore Google account, click on Assignments and then on the Learning Pyret assignment, and upload the file there.