summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-06-04 13:21:21 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-06-04 13:21:21 +0200
commit2cabb70d922e4f269adae88931261ae14ee43eb2 (patch)
treeda1050fda85565a8a265f66cbc620be3a5c518ab /modules
parentd3fbfb7a6325bc8aaabb0577eda990f8db968056 (diff)
eval: Simplify.
* modules/language/python/eval.scm (aif): Remove macro. (eval0, compile, exec0): Simplify.
Diffstat (limited to 'modules')
-rw-r--r--modules/language/python/eval.scm22
1 files changed, 8 insertions, 14 deletions
diff --git a/modules/language/python/eval.scm b/modules/language/python/eval.scm
index 4cfd239..9f8724f 100644
--- a/modules/language/python/eval.scm
+++ b/modules/language/python/eval.scm
@@ -15,8 +15,6 @@
(define seval (@ (guile) eval))
-(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
-
(define-syntax-rule (L x) (@@ (ice-9 local-eval) x))
(define-syntax globals
@@ -142,24 +140,20 @@ global environment @var{global}."
(define (comp x) (error "not implemented"))
-(define* (eval0 x #:optional (locals #f) (globals #f))
+(define* (eval0 x #:optional locals globals)
(cond
((string? x)
- (aif xp (p x)
- (aif cp (comp xp)
- (local-eval cp locals globals)
- (raise SyntaxError))
- (raise SyntaxError)))
+ (or (and=> (and=> (p x) comp)
+ (lambda (cp)
+ (local-eval cp locals globals)))
+ (raise SyntaxError)))
((pair? x)
(local-eval x locals globals))))
(define* (compile x filename mode
#:optional (flags 0) (dont_inherit #f) (optimize -1))
- (aif xp (p x)
- (aif cp (comp xp)
- cp
- (raise SyntaxError))
- (raise SyntaxError)))
+ (or (and=> (p x) comp)
+ (raise SyntaxError)))
(define-syntax exec
(lambda (x)
@@ -169,5 +163,5 @@ global environment @var{global}."
((exec x . l)
#'(exec0 x . l)))))
-(define* (exec0 x #:optional (locals #f) (globals #f))
+(define* (exec0 x #:optional locals globals)
(local-eval x locals globals))