Question: ;; Use the 'fold' or 'fold-right' and 'cons' functions to ;; reverse all of the elements of a list. ;; You may NOT use the
;; Use the 'fold' or 'fold-right' and 'cons' functions to ;; reverse all of the elements of a list. ;; You may NOT use the built-in reverse function! ;; Doing so is an integrity vialoation (define (my-reverse lst) ; This is one short line 0 ) ;; Test cases (define (println s) (display s) (newline)) (define (reverse . args) (display "DO NOT USE REVERSE! ") (newline) '()) (println (my-reverse '(1 2 3 4)));(4 3 2 1) (println (my-reverse '(a b c d)));(d c b a) (println (my-reverse '()));()
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
