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/list.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules/language/python/list.scm') diff --git a/modules/language/python/list.scm b/modules/language/python/list.scm index 5f4fbb7..dc63298 100644 --- a/modules/language/python/list.scm +++ b/modules/language/python/list.scm @@ -10,6 +10,7 @@ #:use-module (language python for) #:use-module (language python try) #:use-module (language python exceptions) + #:use-module (language python persist) #:export (to-list to-pylist pylist-append! pylist-slice pylist-subset! pylist-reverse! @@ -24,6 +25,14 @@ (define-syntax-rule (aif it p x y) (let ((it p)) (if it x y))) (define-class () vec n) +(name-object ) + +(cpit (o (lambda (o n l) + (slot-set! o 'n n) + (slot-set! o 'vec (list->vector l))) + ((@ (guile) list) + (slot-ref o 'n) + (vector->list (slot-ref o 'vec))))) (define-method (pylist-delete! (o ) k) (let* ((n (slot-ref o 'n)) @@ -841,7 +850,9 @@ (__init__ self) (for ((i : it)) () (pylist-append! self i)))))) __init__))) - + +(name-object list) + (define pylist list) (define-method (py-class (o ) list)) -- cgit v1.2.3