Complete Todo Parts Lang Racket Provide List Reverse List Append Zip Lists Slice List Pali Q37202001

Complete the TODO parts:

#lang racket

(provide list-reverse      
list-append
zip-lists      
slice-list   
palindrome?   
interp-arith
reduce-lambda)
; Define a list-reverse function that takes a list to itsreverse
;;; e.g., (list-reverse ‘(1 2 3)) => ‘(3 2 1)     
(define (list-reverse lst)
(let loop ([lst lst] [lst-reversed ‘()])
(if (empty? lst)
lst-reversed
(loop (rest lst) (cons (first lst) lst-reversed)))))

; Define an list-append function which takes two lists and returnstheir concatenation   
;;; e.g., (list-append ‘(1) ‘(2 3)) => ‘(1 2 3)     
(define (list-append lst0 lst1)
(if (null? lst0)
lst1
(cons (car lst0)
(append (cdr lst0) lst1))))

; Define a zip-lists function that takes multiple lists and zipsthem together into
; a list of lists where each inner list is a list of all

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.