summaryrefslogtreecommitdiff
path: root/modules/language/python/expr.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/expr.scm')
-rw-r--r--modules/language/python/expr.scm106
1 files changed, 0 insertions, 106 deletions
diff --git a/modules/language/python/expr.scm b/modules/language/python/expr.scm
deleted file mode 100644
index 81c2cbe..0000000
--- a/modules/language/python/expr.scm
+++ /dev/null
@@ -1,106 +0,0 @@
-(define-module (language python expr)
- #:use-module (language python class)
- #:export (py-true? to-py py-or py-and py-not py_==
- py_>= py_<= py_< py_> py_<> py_!= py_in py_notin py_is
- py_isnot py_bor py_xor py_band py-<< py->> py-+ py--
- py-* py-/ py-% py-// py-u+ py-u- py-u~ py-power
- ))
-
-
-(define-syntax-rule (py-true? x) (eq? x 'True))
-(define-syntax-rule (to-py x) (if x 'True 'false))
-(define-syntax-rule (py-or x ...) (to-py (or (py-true? x) ...)))
-(define-syntax-rule (py-and x ...) (to-py (and (py-true? x) ...)))
-(define-syntax-rule (py-not x) (if (py-true? x) 'False 'True))
-
-(define-syntax-rule (py_== x y)
- (if (struct? x)
- (if (class? x)
- (class_== x y)
- (to-py (equal? x y)))
- (to-py (equal? x y))))
-
-(define-syntax-rule (mk-comp py_>= >= class_>=)
- (define-syntax-rule (py_>= x y)
- (if (number? x)
- (to-py (>= x y))
- (if (class? x)
- (class_>= x y)
- 'False))))
-
-(mk-comp py_>= >= class_>=)
-(mk-comp py_<= <= class_<=)
-(mk-comp py_< < class_<)
-(mk-comp py_> > class_>)
-
-(define-syntax-rule (<> x y) (not (= x y)))
-(mk-comp py_<> <> class_<>)
-(mk-comp py_!= <> class_<>)
-
-
-(define-syntax-rule (py_in x y)
- (cond
- ((struct? y)
- (if (class? y)
- (to-py (class_in y x))
- 'False))
- ((pair? y)
- (list-in x y))
- ((vector? y)
- (vector-in x y))
- (else
- 'False)))
-
-(define-syntax-rule (py_notin x y)
- (cond
- ((struct? y)
- (if (class? y)
- (to-py (not (class_in y x)))
- 'True))
- ((pair? y)
- (to-py (list-in x y)))
- ((vector? y)
- (to-py (vector-in x y)))
- (else
- 'True)))
-
-(define-syntax-rule (py_is x y)
- (to-py (and (class? x) (class? y) (eq? (class-ref x) (class-ref y)))))
-
-(define-syntax-rule (py_isnot x y)
- (to-py (not (and (class? x) (class? y) (eq? (class-ref x) (class-ref y))))))
-
-(define-syntax-rule (mk-num py_>= >= class_>=)
- (define-syntax-rule (py_>= x . y)
- (if (number? x)
- (>= x . y)
- (if (class? x)
- (class_>= x . y)
- (error "wrong numerics")))))
-
-(mk-num py_bor logior class_ior)
-(mk-num py_xor logxor class_xor)
-(mk-num py_band logand class_band)
-(mk-num py-<< ash class_<<)
-(define-syntax-rule (rash x y) (ash x (- y)))
-(mk-num py->> rash class_>>)
-(mk-num py-+ + class_+)
-(mk-num py-- - class_-)
-(mk-num py-* * class_*)
-(mk-num py-/ / class_/)
-(mk-num py-% modulo class_%)
-(mk-num py-// truncate-quotient class_//)
-
-(define-syntax-rule (mk-unum py_>= >= class_>=)
- (define-syntax-rule (py_>= x)
- (if (number? x)
- (>= x)
- (if (class? x)
- (class_>= x)
- (error "wrong numerics")))))
-
-(mk-unum py-u+ + class_u+)
-(mk-unum py-u- - class_u-)
-(mk-unum py-u~ lognot class_u~)
-
-(mk-num py-power expt class_power)