CS 331 Spring 2025  >  Assignment 7 (Coding in Scheme & Prolog)


CS 331 Spring 2025
Assignment 7 (Coding in Scheme & Prolog)

Assignment 7 is due at 5 pm Thursday, April 24. (Note that, as per the syllabus, this assignment will not be accepted after the beginning of the final exam period: 1 pm Friday, May 2.) The assignment is worth 70 points.

Procedures

This assignment is to be done individually.

Turn in answers to the exercises below on the UA Canvas site, under Assignment 7 for this class.

Exercises (A–C, 70 pts total)

There will be no test programs posted for this assignment. Test your code!

Exercise A — Running a Fulmar Program

Purpose

In this exercise you will demonstrate that you can execute Fulmar code.

Instructions

Get the file check_fulmar.fmar from the class Git repository. This is a Fulmar source file for a complete program. When it is executed, this program prints “Secret message #5:”. Below that, it prints a secret message. Run the program. What is the secret message?

To execute the program, run fulmar.lua, with the following files in the same directory: check_fulmar.fmar, from the Git repository, and lexit.lua, parseit.lua, and interpit.lua, from previous assignments. At the prompt, type:

:r check_fulmar.fmar

Exercise B — Programming in Scheme

Purpose

In this exercise, you will write a Scheme procedure.

Instructions

Write a Scheme source file alternatingsums.scm as follows. Be sure to follow the Coding Standards.

Exercise C — Programming in Prolog

Purpose

In this exercise, you will write a Prolog predicate.

Instructions

Write a Prolog source file collcount.pl as follows. Be sure to follow the Coding Standards.