Michael B. Gousie - Wheaton College, MA

Comp 335 - Programming Languages (Fall 2025)

Comic about creating a new programming language

Introductory Information

Projects/Homework

PL5

PL4

In-Class Examples

Bash examples


Chapter 6 examples


Scheme solutions

  • createList1.scm - create a list backwards given n:
    (makelist 4) --> (4 3 2 1)
  • createList2.scm - create a list given n:
    (makelist2 4) --> (1 2 3 4)
  • butLast.scm - remove the last element of a list:
    (butLast '(1 2 3 4)) --> (1 2 3)
  • palin.scm - determine if a list is a palindrome:
    (palin '(1 2 1)) --> #t
  • largest.scm - return the largest value in a list of non-negative integers:
    (largest '(1 2 7 5 2 0 3)) --> 7

Chapters 7 & 8 examples

Chapter 9 examples

In-Class Examples

Chapter 5 examples


C examples

PROLOG examples

  • printn.pl - three ways to print 1..n, where n is input.
  • power.pl - find X^Y using writes.
  • vehicles.pl - tiny database of vehicles (axioms) and a few predicates to query the database. No writes used; just return values.
  • leap.pl - leap year problem.
  • gcd.pl - finding greatest common divisor using Euclid's algorithm.
Last updated