Skip to content

Commit 6b92a93

Browse files
author
willem
committed
More array methods
1 parent f4d98e5 commit 6b92a93

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎lib/array.lisp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
(py-raise '{IndexError} "Index ~A outside the range of array ~A (num elements = ~A)."
8989
item arr (length arr)))))
9090

91-
(def-py-method |array.__setitem__| (x item value)
92-
(setf (aref (py-array-array x) item) value))
91+
(def-py-method |array.__len__| (x)
92+
(length (py-array-array x)))
9393

9494
(def-py-method |array.__repr__| (x)
9595
(with-output-to-string (s)
@@ -102,6 +102,9 @@
102102
(when (< (length (py-array-array x)) 10)
103103
(format nil " [~{~A~^ ~}]" (loop for i across (py-array-array x) collect i)))))))
104104

105+
(def-py-method |array.__setitem__| (x item value)
106+
(setf (aref (py-array-array x) item) value))
107+
105108
(def-py-method |array.fromstring| (py-arr string)
106109
(loop with vec = (py-array-array py-arr)
107110
for ch across (py-val->string string)

0 commit comments

Comments
 (0)