summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/language/cps/contification.scm14
1 files changed, 9 insertions, 5 deletions
diff --git a/module/language/cps/contification.scm b/module/language/cps/contification.scm
index 6e8fe621d..7a9252e95 100644
--- a/module/language/cps/contification.scm
+++ b/module/language/cps/contification.scm
@@ -84,11 +84,15 @@
;; Are the given args compatible with any of the arities?
(define (applicable? proc args)
- (or-map (match-lambda
- (($ $arity req () #f () #f)
- (= (length args) (length req)))
- (_ #f))
- (assq-ref (map cons syms arities) proc)))
+ (let lp ((arities (assq-ref (map cons syms arities) proc)))
+ (match arities
+ ((($ $arity req () #f () #f) . arities)
+ (or (= (length args) (length req))
+ (lp arities)))
+ ;; If we reached the end of the arities, fail. Also fail if
+ ;; the next arity in the list has optional, keyword, or rest
+ ;; arguments.
+ (_ #f))))
;; If the use of PROC in continuation USE is a call to PROC that
;; is compatible with one of the procedure's arities, return the