summaryrefslogtreecommitdiff
path: root/modules/language/python/list.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2017-10-17 00:59:20 +0200
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2017-10-17 00:59:20 +0200
commitb40e3b8b85eb3562cc49b2cbea041ee50949c46d (patch)
tree6b5a1087b7db3f161e8869ad3982ce1b5ac1f4c9 /modules/language/python/list.scm
parenta7346773d6b517fc09e5b776fb685daffc228528 (diff)
completer
Diffstat (limited to 'modules/language/python/list.scm')
-rw-r--r--modules/language/python/list.scm19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/language/python/list.scm b/modules/language/python/list.scm
index a35ceae..ded6b15 100644
--- a/modules/language/python/list.scm
+++ b/modules/language/python/list.scm
@@ -174,10 +174,16 @@
(to-pylist l)))
(define-method (pylist-slice (o <string>) n1 n2 n3)
- (list->string
- (map (lambda (x) (string-ref x 0))
- (to-list
- (pylist-slice (to-pylist o) n1 n2 n3)))))
+ (define N (slot-ref o 'n))
+ (define (f n) (if (< n 0) (+ N n) n))
+
+ (let* ((n1 (f (if (eq? n1 None) 0 n1)))
+ (n2 (f (if (eq? n2 None) (slot-ref o 'n) n2)))
+ (n3 (f (if (eq? n3 None) 1 n3))))
+ (list->string
+ (map (lambda (x) (string-ref x 0))
+ (to-list
+ (pylist-slice (to-pylist o) n1 n2 n3))))))
(defpair (pylist-slice o n1 n2 n3)
@@ -621,7 +627,7 @@
(next-method)))
;; SORT!
-(define (id x) id)
+(define (id x) x)
(define-method (pylist-sort! (o <py-list>) . l)
(apply
(lambda* (#:key (key id) (reverse #f))
@@ -889,6 +895,3 @@
(break #t))
#:final
#f))
-
-
-