summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2019-03-12 20:57:24 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2019-03-12 20:57:24 +0100
commit1e823a1762088e6a4fbf5bc0791d61b9d6c4b013 (patch)
treeacb100356e281a3f1fb16e5043ec3b3eb35f21ac
parent0bd6e0b49bf32eaef5419485611d48361bf482bb (diff)
avoid circular dependency
-rw-r--r--modules/language/python/def.scm7
-rw-r--r--modules/language/python/for.scm14
2 files changed, 17 insertions, 4 deletions
diff --git a/modules/language/python/def.scm b/modules/language/python/def.scm
index 7e97d22..634daf4 100644
--- a/modules/language/python/def.scm
+++ b/modules/language/python/def.scm
@@ -1,7 +1,6 @@
(define-module (language python def)
#:use-module (ice-9 pretty-print)
#:use-module (oop pf-objects)
- #:use-module (language python for)
#:use-module (language python exceptions)
#:use-module (ice-9 match)
#:use-module (srfi srfi-11)
@@ -132,15 +131,15 @@
(string->symbol x)
x))))
+(define (mkw kw) (error "not implemented"))
+
(define-syntax m*
(syntax-rules (* ** =)
((_ (= a b))
(list (symbol->keyword 'a) b))
((_ (* a)) a)
((_ (** kw))
- (for ((k v : kw)) ((l '()))
- (cons* v (mk-k k) l)
- #:final (reverse l)))
+ (mkw kw))
((_ a) (list a))))
(define-syntax py-apply
diff --git a/modules/language/python/for.scm b/modules/language/python/for.scm
index cebb5d1..cff1baa 100644
--- a/modules/language/python/for.scm
+++ b/modules/language/python/for.scm
@@ -180,3 +180,17 @@
(set! (@@ (oop pf-objects) hashforeach)
(lambda (f d)
(for ((k v : d)) () (f k v))))
+
+(define (mk-k x)
+ (if (keyword? x)
+ x
+ (symbol->keyword
+ (if (string? x)
+ (string->symbol x)
+ x))))
+
+(set! (@@ (language python def) mkw)
+ (lambda (kw)
+ (for ((k v : kw)) ((l '()))
+ (cons* v (mk-k k) l)
+ #:final (reverse l))))