aboutsummaryrefslogtreecommitdiff
path: root/Semestr 2/racket/l11/solution.bak
blob: 3ae167ad86f4a8ccff4fe7e780d94b12a848d87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)))))