|
|
@ -33,6 +33,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
(define (sum numbers) (reduce numbers + 0)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define |
|
|
|
|
|
|
|
(repeat value number) |
|
|
|
|
|
|
|
(if |
|
|
|
|
|
|
|
(= number 0) |
|
|
|
|
|
|
|
'() |
|
|
|
|
|
|
|
(cons value (repeat value (- number 1))))) |
|
|
|
|
|
|
|
|
|
|
|
(define (is-numeric-char char) (if (char-numeric? char) #t #f)) |
|
|
|
(define (is-numeric-char char) (if (char-numeric? char) #t #f)) |
|
|
|
|
|
|
|
|
|
|
|
(define (first-last list predicate) |
|
|
|
(define (first-last list predicate) |
|
|
@ -43,7 +50,7 @@ |
|
|
|
(cons |
|
|
|
(cons |
|
|
|
(if |
|
|
|
(if |
|
|
|
(predicate (car list)) |
|
|
|
(predicate (car list)) |
|
|
|
(cons (car list) (cons (car list) '())) |
|
|
|
(repeat (car list) 2) |
|
|
|
'()) |
|
|
|
'()) |
|
|
|
(first-last (cdr list) predicate)) |
|
|
|
(first-last (cdr list) predicate)) |
|
|
|
(lambda (current rest) |
|
|
|
(lambda (current rest) |
|
|
|