From cc09a2c6751112a0146037e21114ecfb2e2e5ee6 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 19 Nov 2022 11:41:32 -0500 Subject: [PATCH] refactor: Use aslist-ref instead of assoc/cadr The joys of learning the base library over time :) --- scanner.scm | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/scanner.scm b/scanner.scm index 0529075..e6d2913 100644 --- a/scanner.scm +++ b/scanner.scm @@ -19,23 +19,22 @@ (and (char<=? #\A c) (char>=? #\Z c))))) (define (get-keyword k) - (let ((kpair (assoc k '(("and" AND) - ("class" CLASS) - ("else" ELSE) - ("false" FALSE) - ("for" FOR) - ("fun" FUN) - ("if" IF) - ("nil" NIL) - ("or" OR) - ("print" PRINT) - ("return" RETURN) - ("super" SUPER) - ("this" THIS) - ("true" TRUE) - ("var" VAR) - ("while" WHILE))))) - (if kpair (cadr kpair) #f))) + (alist-ref k '(("and" . AND) + ("class" . CLASS) + ("else" . ELSE) + ("false" . FALSE) + ("for" . FOR) + ("fun" . FUN) + ("if" . IF) + ("nil" . NIL) + ("or" . OR) + ("print" . PRINT) + ("return". RETURN) + ("super" . SUPER) + ("this" . THIS) + ("true" . TRUE) + ("var" . VAR) + ("while" . WHILE)) equal?)) (define (alnum? c) (and c (or (alpha? c) (digit? c)))) -- libgit2 1.1.1