a3q5 - ; The first three lines of this file were inserted...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname a3q5) (read-case- sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ;;CS116 Assignment 3 Question 5 ;; r46wang 20319247 ;;diff: (listof num) (listof num) -> (listof num) ;; consumes 2 lists and produces a version of the first list excluding any element that appears in the second list. ;;Examples: ;;(diff empty (list 1)) => empty ;;(diff (list 1) empty) => (list 1) ;;(diff (list 1) (list 1)) => empty ;;(diff (list 1) (list 2)) => (list 1) ;;(diff (list 1 2) (list 1)) => (list 2) ;;(diff (list 1 2 3 4 5) (list 5 4 3 2 1)) => empty ;;(diff (list 1 2 3 4 5) (list 1 3 5 6 7 8)) => (list 2 4) (define (diff lon remlst) (cond [(or(empty? remlst)(empty? lon)) lon] [else (diff (filter (lambda (x)(not(= (first remlst) x))) lon) (rest
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

a3q5 - ; The first three lines of this file were inserted...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online