Add set* and transform* contracts
This commit is contained in:
parent
31e52b7697
commit
94a13eccaa
|
@ -1,16 +1,18 @@
|
|||
#lang racket
|
||||
|
||||
(require unstable/sequence
|
||||
"base.rkt")
|
||||
"base.rkt"
|
||||
"../list-pair-contract.rkt")
|
||||
|
||||
(module+ test
|
||||
(require rackunit
|
||||
fancy-app))
|
||||
|
||||
(provide
|
||||
lens-transform*
|
||||
(contract-out [lens-transform (-> lens? any/c (-> any/c any/c) any/c)]))
|
||||
|
||||
(contract-out
|
||||
[lens-transform (-> lens? any/c (-> any/c any/c) any/c)]
|
||||
[lens-transform* (->* (any/c) #:rest (listof2 lens? (-> any/c any/c)) any/c)]))
|
||||
|
||||
|
||||
|
||||
(define (listof* . contracts)
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
(require unstable/sequence
|
||||
fancy-app
|
||||
"base.rkt")
|
||||
"base.rkt"
|
||||
"../list-pair-contract.rkt")
|
||||
|
||||
(module+ test
|
||||
(require rackunit))
|
||||
|
||||
(provide
|
||||
lens-set*
|
||||
(contract-out [lens-view (-> lens? any/c any/c)]
|
||||
[lens-view* (->* [any/c] #:rest (listof lens?) any/c)]
|
||||
[lens-set (-> lens? any/c any/c any/c)]))
|
||||
[lens-view* (->* (any/c) #:rest (listof lens?) any/c)]
|
||||
[lens-set (-> lens? any/c any/c any/c)]
|
||||
[lens-set* (->* (any/c) #:rest (listof2 lens? any/c) any/c)]))
|
||||
|
||||
|
||||
(define (lens-view lens v)
|
||||
|
|
10
lens/list-pair-contract.rkt
Normal file
10
lens/list-pair-contract.rkt
Normal file
|
@ -0,0 +1,10 @@
|
|||
#lang racket
|
||||
|
||||
(provide
|
||||
(contract-out [listof2 (-> contract? contract? contract?)]))
|
||||
|
||||
|
||||
(define (listof2 first-val/c second-val/c)
|
||||
(define c
|
||||
(or/c empty? (cons/c first-val/c (cons/c second-val/c (recursive-contract c)))))
|
||||
c)
|
Loading…
Reference in New Issue
Block a user