aboutsummaryrefslogtreecommitdiff
path: root/frontend/_aconcat.dcl
diff options
context:
space:
mode:
authorronny2001-10-03 12:56:36 +0000
committerronny2001-10-03 12:56:36 +0000
commit64be2315eec12b9655341da602a2083380510915 (patch)
tree9c449a63aecb4ff6d143078859cd4c0294f50ad8 /frontend/_aconcat.dcl
parentfixed type error by reintroducing uniqueCopy (diff)
replace uniqueCopy with copyCoercions
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@819 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/_aconcat.dcl')
-rw-r--r--frontend/_aconcat.dcl27
1 files changed, 25 insertions, 2 deletions
diff --git a/frontend/_aconcat.dcl b/frontend/_aconcat.dcl
index f95aab7..316f284 100644
--- a/frontend/_aconcat.dcl
+++ b/frontend/_aconcat.dcl
@@ -2,6 +2,7 @@ definition module _aconcat
import StdArray,StdInt,StdEnum,StdList
+
arrayConcat a1 a2
:==r2
where
@@ -36,7 +37,7 @@ where
r2={r1 & [sr-i]=e \\ i<-[1..s2] & e<-l}
r1={r0 & [i]=a.[i] \\ i<-[0..s1-1]}
/*2.0
- r0=_createArray sr // 2.0
+ r0=_createArray sr
0.2*/
//1.3
r0=_createArrayc sr
@@ -60,8 +61,30 @@ where
= copy_elements a1 {a2 & [i]=e} (i+1)
= (a2,a1)
-arrayCopy a s
+arrayCopy a
:== arrayCopyBegin a1 s
where
(s, a1)
= usize a
+
+arrayAndElementsCopy place_holder copy_element_function array
+/*2.0
+ :== copy place_holder array1 (_createArray n) 0 n
+0.2*/
+//1.3
+ :== copy place_holder array1 (_createArrayc n) 0 n
+//3.1
+ where
+ (n, array1)
+ = usize array
+ copy place_holder array array_copy i n
+ | i == n
+ = (array_copy, array)
+ // otherwise
+ # (element, array)
+ = replace array i place_holder
+ # (copy_element, element)
+ = copy_element_function element
+ # (place_holder, array)
+ = replace array i element
+ = copy place_holder array {array_copy & [i] = copy_element} (i+1) n