Skip to content

Commit

Permalink
Make sure we consistently use "pcontext" not "context" for pcontexts
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha committed Oct 1, 2024
1 parent 3aeb648 commit 5ad2fd4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/core/points.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
(define *pcontext* (make-parameter #f))
(struct pcontext (points exacts) #:prefab)

(define (in-pcontext context)
(in-parallel (in-vector (pcontext-points context)) (in-vector (pcontext-exacts context))))
(define (in-pcontext pcontext)
(in-parallel (in-vector (pcontext-points pcontext)) (in-vector (pcontext-exacts pcontext))))

(define (pcontext-length context)
(vector-length (pcontext-points context)))
(define (pcontext-length pcontext)
(vector-length (pcontext-points pcontext)))

(define/contract (mk-pcontext points exacts)
(-> (non-empty-listof (listof any/c)) (non-empty-listof any/c) pcontext?)
Expand All @@ -41,11 +41,10 @@
(for/lists (pts* exs*) ([(pt ex) (in-pcontext pcontext)] other ...) body ...)])
(mk-pcontext pts* exs*)))

(define (split-pcontext context num-a num-b)
(define num-total (vector-length (pcontext-points context)))
(unless (= (+ num-a num-b) num-total)
(define (split-pcontext pcontext num-a num-b)
(match-define (pcontext pts exs) pcontext)
(unless (= (+ num-a num-b) (vector-length pts))
(error 'split-pcontext "Cannot split pcontext of size ~a into ~a and ~a" num-total num-a num-b))
(match-define (pcontext pts exs) context)
(define-values (pts-a pts-b) (vector-split-at pts num-a))
(define-values (exs-a exs-b) (vector-split-at exs num-a))
(values (pcontext pts-a exs-a) (pcontext pts-b exs-b)))
Expand Down

0 comments on commit 5ad2fd4

Please sign in to comment.