summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/language/python/compile.scm28
1 files changed, 14 insertions, 14 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index c52905b..c0513c4 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -23,8 +23,6 @@
#:use-module (ice-9 pretty-print)
#:export (comp exit-fluid exit-prompt pks do-pr))
-(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
-
(define-inlinable (C x) `(@@ (language python compile) ,x))
(define-inlinable (F2 x) `(@@ (language python format2) ,x))
(define-inlinable (N x) `(@@ (language python number) ,x))
@@ -796,18 +794,20 @@ empty list."
(let* ((tag (exp vs x))
(xs (gensym "xs"))
(fast (fastfkn tag))
- (is-fkn? (aif it (and fast? is-fkn? fast)
- `(#:call-obj (lambda (e)
- (lambda ,xs
- (,(G 'apply) ,it e ,xs))))
- #f)))
- (if is-fkn?
- is-fkn?
- (if (and fast? fast)
- `(#:fastfkn-ref ,fast (,(G 'quote) ,tag))
- (aif it (and fast? (fast-ref tag))
- `(#:fast-id ,it (,(G 'quote) ,tag))
- `(#:identifier (,(G 'quote) ,tag)))))))
+ (is-fkn? (and=> (and fast? is-fkn? fast)
+ (lambda (it)
+ `(#:call-obj (lambda (e)
+ (lambda ,xs
+ (,(G 'apply) ,it e ,xs))))))))
+ (cond
+ (is-fkn? is-fkn?)
+ ((and fast? fast)
+ `(#:fastfkn-ref ,fast (,(G 'quote) ,tag)))
+ ((and fast? (fast-ref tag)) =>
+ (lambda (it)
+ `(#:fast-id ,it (,(G 'quote) ,tag))))
+ (else
+ `(#:identifier (,(G 'quote) ,tag))))))
((#:arglist args)
`(#:apply ,@(get-kwarg vs args)))