aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-06-09 16:10:53 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-06-09 16:10:53 +0900
commitd5ec78a3169a284a337a95fbe60f22aedfd98e4e (patch)
tree115673e19f728e56a584368d4ac191d1deeedbe7
parent31cf9fb6b81c70c82fb16eeb5e42fdc588bef8c5 (diff)
Confirm `var` is a symbol
-rw-r--r--algebraic-structs.monad.make.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/algebraic-structs.monad.make.scm b/algebraic-structs.monad.make.scm
index e7c8774..70ead19 100644
--- a/algebraic-structs.monad.make.scm
+++ b/algebraic-structs.monad.make.scm
@@ -14,11 +14,14 @@
(foldr (lambda (binding acc)
(match binding
[(var stx expr)
- (if (and (symbol? stx) (compare stx '<-))
+ (if (and (symbol? var)
+ (symbol? stx)
+ (compare stx '<-))
`(>>= ,expr (lambda (,var) ,acc))
`(>>= ,binding (lambda (_) ,acc)))]
[(let-stx var =-stx expr)
- (cond ((and (symbol? let-stx) (compare let-stx (inject 'let))
+ (cond ((and (symbol? var)
+ (symbol? let-stx) (compare let-stx (inject 'let))
(symbol? =-stx) (compare =-stx (inject '=)))
`((lambda (,var) ,acc) ,expr))
(else