diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-06-04 11:50:02 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-06-04 11:50:02 +0200 |
commit | 84175d65d6fff1adfa360f24af19be77209b05a0 (patch) | |
tree | d0010b789a3ee80969ead50683569f01a62d09ce | |
parent | ef48b81adea8119985e66c36f1ac7d4570ad6922 (diff) |
compile: get-addings: Implement without aif.
* modules/language/python/compile.scm (aif): Remove macro.
(get-addings): Implement without aif; simplify.
-rw-r--r-- | modules/language/python/compile.scm | 28 |
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))) |