Florida Southern Sunset
CSC 4640: Programming Languages
(Spring 2025)

Syllabus

LMS

Teachers


Assignments


Other Pages

Project 4:
Unrecursion and XOR


Assigned: Fri Feb 07 2025
Due: 11:59:00 PM on Mon Feb 24 2025
Team Size: 1 or 2
Language: Racket
Out of: 100 points


In this project, you will use map and apply to make procedures that aren't explicitly recursive. Then you will write a bunch of procedures related to XOR.

Part 0, 0 points:

Create a file named project4.rkt and put your name at the top. All of your procedure definitions will go in that file. Make sure that you take out any read statements! At the bottom of your file, keep this statement:
(provide (all-defined-out))
That will make sure your procedures can be imported by other files. (You have to do this in order for me to grade it.)

Part 1, 10 points:

Packet Exercise 11.4.1: distance. There are examples in the packet.

Part 2, 20 points:

Packet Exercise 11.4.6: transpose. There's an example in the packet.

Part 3, 20 points:

Write a procedure, (xor-of-2 x y), that returns the xor of x and y. You may assume that x and y have boolean values. The xor of two values returns true if and only if exactly one of x and y is true. (Otherwise, it returns false.)
> (xor-of-2 #t #f)
#t
> (xor-of-2 #t #t)
#f

Part 4, 0 points:

Write a procedure, (xor-of-3 x y z) that returns the xor of x, y and z. The xor of three values is true if and only if exactly one or three of them are true.
> (xor-of-3 #t #t #f)
#f
> (xor-of-3 #f #f #f)
#f

Part 5, 0 points: Determine what the xor of any number of boolean values is. If you're not sure, ask me!

Part 6, 20 points:

Write a procedure, (xor-list Lst) that returns the xor of all elements of Lst. This assumes that Lst is a list of booleans.
> (xor-list '(#t #t #t #t))
#f
> (xor-list '(#t #f)
#t

Part 7, 10 points: Change xor-list to be tail recursive. (You have to ask me to check your solution to get points for this part.)

Part 8, 0 points: Learn how to write a procedure that takes a variable number of parameters.

Part 9, 20 points:

Write a procedure, xor, that takes a variable number of boolean parameters and returns the boolean xor of them.
> (xor #t #f #t #f #t)
#t
> (xor #f #f #t #t #f)
#f

Submitting your Project: Choose a team name consisting of alphabetical characters. Put your file in a folder named <teamName>Project4, zip up the folder, and upload it to Canvas. Please make sure you name your folder correctly first, then zip it up, not the other way around. (You will have to resubmit if you don't do this.) If you submit early enough, let me know so I can test your code and give you a score. If you submit after the deadline please let me know right away so I can give you a grade.