diff options
Diffstat (limited to 'semestr-2/racket/l11/solution.bak')
-rw-r--r-- | semestr-2/racket/l11/solution.bak | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/semestr-2/racket/l11/solution.bak b/semestr-2/racket/l11/solution.bak new file mode 100644 index 0000000..3ae167a --- /dev/null +++ b/semestr-2/racket/l11/solution.bak @@ -0,0 +1,18 @@ +#lang racket + +(require racket/contract) + +(provide (contract-out [square square/c])) +(provide square/c) + +(define square/c (-> number? (not/c negative?))) + +(define (square x) (* x x)) + + +(define with-labels/c (parametric->/c [a b] (-> (-> a b)) + +(define (with-labels f xs) + (if (null? xs) + null + (cons (list (f (car xs)) (car xs)) (with-labels f (cdr xs)))))
\ No newline at end of file |