summaryrefslogtreecommitdiff
path: root/modules/language/python/set.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-02-21 13:57:57 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-02-21 13:57:57 +0100
commit03e16c53f6579a969c285b89b8cb86140f1411a6 (patch)
treed47f3ee31040b7b11339fda849c090f0e2e16724 /modules/language/python/set.scm
parent0a6079db826621c32cdfc89c3daea217582f0bb7 (diff)
deepcopy copy works
Diffstat (limited to 'modules/language/python/set.scm')
-rw-r--r--modules/language/python/set.scm21
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/language/python/set.scm b/modules/language/python/set.scm
index e9d7c63..25b02d7 100644
--- a/modules/language/python/set.scm
+++ b/modules/language/python/set.scm
@@ -7,9 +7,26 @@
#:use-module (language python try)
#:use-module (language python list)
#:use-module (language python yield)
- #:export(py-set))
+ #:use-module (language python persist)
+ #:export (py-set))
(define-class <set> () dict)
+(name-object <set>)
+
+(cpit <set>
+ (o (lambda (o a)
+ (slot-set! o 'dict
+ (let ((h (make-py-hashtable)))
+ (let lp ((a a))
+ (if (pair? a)
+ (begin
+ (h-set! h (caar a) (cdar a))
+ (lp (cdr a))))))))
+ (list
+ (hash-fold (lambda (k v s) (cons (cons k v) s))
+ '()
+ (slot-ref o 'dict)))))
+
(define miss (list 'miss))
@@ -213,4 +230,6 @@
(yield k)
(values))))))
+(name-object set)
+
(define py-set set)