From 84175d65d6fff1adfa360f24af19be77209b05a0 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 4 Jun 2019 11:50:02 +0200 Subject: compile: get-addings: Implement without aif. * modules/language/python/compile.scm (aif): Remove macro. (get-addings): Implement without aif; simplify. --- modules/language/python/compile.scm | 28 ++++++++++++++-------------- 1 file 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))) -- cgit v1.2.3