This assignment is due on Sunday, March 5 at 11:59pm. Submit it using Handin as assignment lecture17.
Design a function between-20-50 that takes a list of numbers as input and returns the list of all the given numbers between 20 and 50. The built-in function <= will help.
Design a function all-contains-lorem that takes a list of strings as input and returns the list of all the given strings containing "lorem". The built-in function string-contains? will help.
(define-struct none ) ; A MaybePosn is one of: ; - (make-none) ; - Posn ; move-bullet : MaybePosn -> MaybePosn ; update the bullet as time passes (check-expect (move-bullet (make-none)) (make-none)) (check-expect (move-bullet (make-posn 70 50)) (make-posn 70 45)) (define (move-bullet b) (cond [(none? b) b] [(posn? b) (make-posn (posn-x b) (- (posn-y b) 5))])) ; A MaybeNumber is one of: ; - (make-none) ; - Number ; move-rocket : MaybeNumber -> MaybeNumber ; move the rocket up if it is flying (check-expect (move-rocket (make-none)) (make-none)) (check-expect (move-rocket 123) 122) (define (move-rocket r) (cond [(none? r) (make-none)] [else (- r 1)]))
; move-bullet : [Maybe Posn] -> [Maybe Posn] ; move-rocket : [Maybe Number] -> [Maybe Number]
; Exercise 3 ; If I were to give the function ??? to select as the predicate, ; X would be ???