fisl

fisl is scheme lox
git clone git://git.alexkarle.com.com/fisl
Log | Files | Refs | README | LICENSE

commit cc09a2c6751112a0146037e21114ecfb2e2e5ee6 (patch)
parent 29210ae5f1ea7989d86f2ad5672d39973640e71b
Author: Alex Karle <alex@alexkarle.com>
Date:   Sat, 19 Nov 2022 11:41:32 -0500

refactor: Use aslist-ref instead of assoc/cadr

The joys of learning the base library over time :)

Diffstat:
Mscanner.scm | 33++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)

diff --git 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))))