From 79e0bdea715eea9bbbe308777a1a7a8b1d8c72f4 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 13 May 2013 05:10:19 +0000 Subject: * interp/g-opt.boot (%array2list): New side-effect free opcode. * interp/lisp-backend.boot: Expand it. * algebra/array1.spad.pamphlet (PrimitiveArray): Implement maxIndex, parts, and members. --- src/algebra/array1.spad.pamphlet | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/algebra') diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet index 9ace920a..ee4b913b 100644 --- a/src/algebra/array1.spad.pamphlet +++ b/src/algebra/array1.spad.pamphlet @@ -17,12 +17,14 @@ PrimitiveArray(S:Type): OneDimensionalArrayAggregate S == add macro NNI == NonNegativeInteger import %icst0: Integer from Foreign Builtin + import %icst1: Integer from Foreign Builtin import %vlength: % -> NNI from Foreign Builtin import %vcopy: % -> % from Foreign Builtin import %vfill: (%,S) -> % from Foreign Builtin import %aref: (%,Integer) -> S from Foreign Builtin import %emptyArray: Type -> % from Foreign Builtin import %list2array: (List S,Type) -> % from Foreign Builtin + import %array2list: % -> List S from Foreign Builtin import %simpleArray: (Type,NNI,S) -> % from Foreign Builtin #x == %vlength x @@ -36,6 +38,9 @@ PrimitiveArray(S:Type): OneDimensionalArrayAggregate S == add setelt(x:%, i:Integer, s:S) == %store(%aref(x,i),s)$Foreign(Builtin) fill!(x, s) == %vfill(x,s) copy x == %vcopy x + maxIndex x == #x - %icst1 + parts x == %array2list x + members x == parts x @ -- cgit v1.2.3