![]() |
![]() |
|
Due: due Nov.02 (Sun) 23:59 on D2L (including a .java file for #1a); bring hardcopy to class. (For hardcopy, you may paste just the one Java method as a racket comment, and only print that one file.)
Note: “function” is not a specific-enough type, although something like “number → boolean” is. Similarly, “list” is not specific enough1, but “(listof string)” is.
(check-expect (upcase-string "Hello?!") "HELLO?!") |
(5pts)
Write
(check-expect (mask-non-alphabetic "hello?!") "hello__") (check-expect (mask-non-alphabetic "He said 'What?'?!") "He_said__What____") |
Do not use the template for a list-processing function;
instead your function should call
(check-expect (map-if even? sqr (list 2 3 4 5)) (list 4 3 16 5)) (check-expect (map-if negative? (lambda (k) 0) (list 2 -2 3 -3)) (list 2 0 3 0)) ; For the next test, download char-shift.rkt and place it in the same directory, ; and then uncomment the next two lines: #;(require "char-shift.rkt") #;(check-expect (list->string (map-if char-alphabetic? (lambda (c) (shift |
; subst-colors : symbol symbol anc-tree → anc-tree ; Return a tree like `a-tree`, except every `old-col` eye-colors is ; replaced with the eye-color `new-col`. ; (define (subst-colors old-col new-col a-tree) …) ; using names defined in the anc-tree data-definition (check-expect (subst-colors 'orange 'teal bart) bart) (check-expect (subst-colors 'brown 'hazel bart) (make-child "Bart" 1979 'hazel marge (make-child "Homer" 1955 'hazel (make-child "Mona" 1929 'hazel 'unknown 'unknown) abe))) |
(check-expect (reverse-v1 (list 'a 'b 'c)) (list 'c 'b 'a)) |
1
The reason is fairly solid:
©2014, Ian Barland, Radford University Last modified 2014.Aug.30 (Sun) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |