From 4ed8fd2c9200abe8456b107a006d6ea53d090f9e Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 25 May 2021 11:02:36 +0200 Subject: [PATCH] Add "annotations" procedure --- implementations/racket/preserves/preserves/annotation.rkt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implementations/racket/preserves/preserves/annotation.rkt b/implementations/racket/preserves/preserves/annotation.rkt index 122f4b1..0c9b572 100644 --- a/implementations/racket/preserves/preserves/annotation.rkt +++ b/implementations/racket/preserves/preserves/annotation.rkt @@ -2,6 +2,7 @@ (provide (struct-out annotated) annotate + annotations strip-annotations strip-annotations-proc peel-annotations @@ -37,6 +38,11 @@ [item (annotated as #f item)])) +(define (annotations v) + (match v + [(annotated annotations _ _) annotations] + [_ '()])) + (define (strip-annotations-proc v #:depth [depth +inf.0]) (let walk* ((v v) (depth depth)) (define next-depth (- depth 1))