Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SCHEME just fill out the ??? next to each foldr should print out a #t like the first example does each ;;??? next to foldr

SCHEME

just fill out the ??? next to each foldr

should print out a #t like the first example does

each ;;??? next to foldr needs to be replaced with a line the first one was cons '() args)

;; Define the following functions ;; each using a single line consisting ;; of a single call to reduce (foldr) ;; for an internal lambda, ;; use (x ls) as the parameter set

EXAMPLE: (define test '(1 2 3 4 5)) (define list-reduce (lambda args (foldr cons '() args)

)) (equal? (apply list-reduce test) test)

;;1

(define test '(1 2 3 4 5)) (define +-reduce (lambda args (foldr ;;??? )) (equal? (apply +-reduce test) (apply + test))

;;2

(define test '(1 2 3 4 5)) (define filter-reduce (lambda (pred? . args) (foldr ;;???

)) (equal? (apply filter-reduce (cons even? test)) (filter even? test))

;;3

(define test '(1 2 3 4 5)) (define map-reduce (lambda (f ls) (foldr ;;??? )) (equal? (map-reduce odd? test) (map odd? test))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions