CSC 4101 Chapter : Homework1

10 views2 pages
15 Mar 2019
School
Course
Professor

Document Summary

Given the following scheme de nition: (define x "(define (fib n) (if (<= n 1) n (+ (fib (- n 1)) (fib (- n 2)))))) (this de nes not the fibonacci function fib, but the variable x. ) E. g. , the expression (car x) would extract define. Don"t just restate the function de nition in english. Hint: not all the code in this function does something useful. (b) (2 pts) Show the result of executing the expression (foo "(((a b (c d)) (((d e)) f) g)): (10 pts) Write a recursive scheme function with two parameters, an atom and a list, that returns the list with all occurrences, no matter how deep, of the given atom deleted. The returned list cannot contain anything in place of the deleted atoms. An atom is anything that"s not a list, e. g. , numbers or symbols. The pointer equality test eq? is not guaranteed to work for numbers, = only works for numbers.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents