Project #1: A Gentle Introduction to Scheme

Submit: Turn in your hw1.scm source file using the turnin command on morbius.mscsnet.mu.edu or one of the other Systems Lab machines.

Work is to be completed individually. Be certain to include your name in the file. You may submit multiple times, but only the last turnin will be kept. The automatic submission system will not accept work after the deadline. (See turnin instructional video HERE. Note that the video is for a different course number, and that Morbius's domain name has changed since the video was made: morbius.mscs.mu.edu -> morbius.mscsnet.mu.edu)

Include a comment block at the very top of each file that contains the following:

  ; COSC 3410 - Project 1
  ; Explain briefly the functionality of the program.
  ; @author [your name]
  ; Instructor [your instructor]
  ; TA-BOT:MAILTO [your email address]

Your source file should be in the EoPL dialect ("#lang eopl" at top of file) supported by DrRacket, and should not make use of non-standard features like comment boxes that produce an XML file rather than a flat text .scm file.

Q1 - append-item

Define a function "append-item" which takes an S-expression and a list, and returns a new list with the S-expression appended at the end. Do not use the built-in append.

Examples:
> (append-item 'a '())
(a)
> (append-item 'e '(a b c d))
(a b c d e)

Q2 - append-list

Define a function "append-list" which takes two lists and returns a new list with the contents of the first list followed by the contents of the second.

Examples:
> (append-list '(a b) '(c d))
(a b c d)
> (append-list '() '())
()

Q3 - rotate-list

Define a function "rotate-list" which takes a list a returns a new list with the first S-expression now at the end of the list.

Examples:
> (rotate-list '(a b c d e))
(b c d e a)

Q4 - rotate-list-n

Define a function "rotate-list-n" which takes a list and an integer n, and returns a new list which has been rotated n times.

Examples:
> (rotate-list-n '(a b c d e) 2)
(c d e a b)

Q5 - remove

EoPL Exercise 1.9.

Q6 - invert

EoPL Exercise 1.16.


[back]

[Revised 2021 Jan 29 13:33 DWB]