From c33ed628ae003b466074b7aae3f16c7bc856d020 Mon Sep 17 00:00:00 2001 From: Jack Firth Date: Tue, 13 Aug 2024 00:17:30 -0700 Subject: [PATCH] Reuse memoization for spaces doc constructor --- core.rkt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core.rkt b/core.rkt index c3be5ac..f7f6909 100644 --- a/core.rkt +++ b/core.rkt @@ -142,11 +142,8 @@ (define-syntax-parse-rule (pretty-node args ...) (pretty-node* doc args ...)) -(define spaces-table (make-hasheq)) - -(define (spaces n) - (hash-ref! spaces-table n - (λ () (text (make-string n #\space))))) +(define/memoize (spaces n) + (text (make-string n #\space))) (define (require-newline? d) (or (and (commentable? d) (commentable-inline-comment d)) (line-comment? d) (newl? d) (full-atom? d)))