|
26 | 26 | (define *pcontext* (make-parameter #f)) |
27 | 27 | (struct pcontext (points exacts) #:prefab) |
28 | 28 |
|
29 | | -(define (in-pcontext context) |
30 | | - (in-parallel (in-vector (pcontext-points context)) (in-vector (pcontext-exacts context)))) |
| 29 | +(define (in-pcontext pcontext) |
| 30 | + (in-parallel (in-vector (pcontext-points pcontext)) (in-vector (pcontext-exacts pcontext)))) |
31 | 31 |
|
32 | | -(define (pcontext-length context) |
33 | | - (vector-length (pcontext-points context))) |
| 32 | +(define (pcontext-length pcontext) |
| 33 | + (vector-length (pcontext-points pcontext))) |
34 | 34 |
|
35 | 35 | (define/contract (mk-pcontext points exacts) |
36 | 36 | (-> (non-empty-listof (listof any/c)) (non-empty-listof any/c) pcontext?) |
|
41 | 41 | (for/lists (pts* exs*) ([(pt ex) (in-pcontext pcontext)] other ...) body ...)]) |
42 | 42 | (mk-pcontext pts* exs*))) |
43 | 43 |
|
44 | | -(define (split-pcontext context num-a num-b) |
45 | | - (define num-total (vector-length (pcontext-points context))) |
46 | | - (unless (= (+ num-a num-b) num-total) |
| 44 | +(define (split-pcontext pcontext num-a num-b) |
| 45 | + (match-define (pcontext pts exs) pcontext) |
| 46 | + (unless (= (+ num-a num-b) (vector-length pts)) |
47 | 47 | (error 'split-pcontext "Cannot split pcontext of size ~a into ~a and ~a" num-total num-a num-b)) |
48 | | - (match-define (pcontext pts exs) context) |
49 | 48 | (define-values (pts-a pts-b) (vector-split-at pts num-a)) |
50 | 49 | (define-values (exs-a exs-b) (vector-split-at exs num-a)) |
51 | 50 | (values (pcontext pts-a exs-a) (pcontext pts-b exs-b))) |
|
0 commit comments