Computer Science 340
Programming Languages
Fall 2023, Siena College
In this lab, you will experiment with Haskell programming.
You may work alone or in groups of size 2 or 3 on this lab. However, in order to make sure you learn the material and are well-prepared for the exams, those who work in a group should either collaborate closely while completing the problems or work through the problems individually then discuss them within your group to agree on a solution. In particular, the "you do these and I'll do these" approach is sure to leave you unprepared for upcoming tasks and the exams.
Learning goals:
Getting Set Up
In Canvas, you will find a link to follow to set up your GitHub repository, which will be named haskell-lab-yourgitname, for this lab. Only one member of the group should follow the link to set up the repository on GitHub, then others should request a link to be granted write access.
All GitHub repositories must be created with all group members having write access and all group member names specified in the README.md file during class, Thursday, September 28, 2023. This applies to those who choose to work alone as well!
Haskell Basics and Functions
In the Learn You a Haskell For Great Good! tutorial, we saw the succ function. Unsurprisingly, there is a corresponding pred function. Give it a try.
For example, the function calls
preds 4 10 preds 5 'p'
should return 6 and 'k'
, respectively.
List Manipulations
For the practice programs in this section, you will work in the file listpractice.hs, where you will find a program that defines a main function that creates and prints out two lists.
List Comprehensions and Tuples
Your repository has the skeleton of a program in listcomp.hs where you will complete the practice tasks below.
Submission
Commit and push!
Grading
This assignment will be graded out of 35 points.
Feature | Value | Score |
preds.hs | 5 | |
listpractice.hs print each number | 6 | |
listpractice.hs singletons | 4 | |
listcomp.hs sum of squares tuple list | 10 | |
listcomp.hs restricted list | 5 | |
listcomp.hs singletons | 5 | |
Total | 35 | |