From 03e16c53f6579a969c285b89b8cb86140f1411a6 Mon Sep 17 00:00:00 2001 From: Stefan Israelsson Tampe Date: Wed, 21 Feb 2018 13:57:57 +0100 Subject: deepcopy copy works --- modules/language/python/set.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'modules/language/python/set.scm') 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 () dict) +(name-object ) + +(cpit + (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) -- cgit v1.2.3