annotate list.rhope @ 126:85f8012b6938

Simplify and speed up List by removing support for sparse Lists
author Mike Pavone <pavone@retrodev.com>
date Thu, 28 Oct 2010 21:39:17 -0400
parents f4fc0a98088a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 Blueprint List Leaf
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 Buffer
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 Index@List Leaf[list,index:out,not found]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 out, not found <- [[list]Buffer >>]Index[index]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
12 Set@List Leaf[list,index,value:out,invalid index]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
15 len <- [[list]Buffer >>]Length
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
16
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
17 If[[[index] > [7]] And [[index] >= [len]]]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 out <- [[[[[[Build[List()]
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
20 ]Buffer << [Array[]]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 ]Left << [list]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 ]Right << [List[]]
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
23 ]Offset << [8i32]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
24 ]Length << [[list]Length]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
25 ]Set[index, value]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
26 }{
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
27 out <- [list]Buffer <<[ [[list]Buffer >>]Set[index, value] ]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
28 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
29 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
30
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
31 Length@List Leaf[list:out]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
32 {
96
5a08705f7610 Semi-broken cleanup of Array implementation
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
33 out <- [[list]Buffer >>]Length
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
34 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
35
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
36 Last@List Leaf[list:out,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
37 {
96
5a08705f7610 Semi-broken cleanup of Array implementation
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
38 len <- [[list]Buffer >>]Length
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
39 ,none <-If[len]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
40 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
41 out <- [len]-[1]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
42 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
43 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
44
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
45 Append@List Leaf[list,val:out]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
46 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
47 [list]Last
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
48 { index <- [~]+[1] }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
49 { index <- 0 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
50 out <- [list]Set[index, val]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
51 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
52
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
53 First@List Leaf[list:out,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
54 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
55 [[list]Buffer >>]Index[0]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
56 { out <- 0 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
57 { none <- Yes }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
58 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
59
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
60 Next@List Leaf[list,index:next,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
61 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
62 pos next <- [index]+[1]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
63 ,none <- If[[pos next] < [[list]Length]]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
64 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
65 next <- Val[pos next]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
66 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
67 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
68
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 Blueprint List
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 Buffer
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 Left
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 Right
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 Offset(Int32,Naked)
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 Length(Int32,Naked)
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 List[:out(List)]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80 out <- [Build[List Leaf()]]Buffer <<[Array[]]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 Index@List[list,index:out,not found]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
85 offset <- [list]Offset >>
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
86 If[[index]<[offset]]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
88 out, not found <- [[list]Left >>]Index[index]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 }{
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
90 right offset <- [offset]+[8i32]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
91 If[[index] < [right offset]]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 {
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 out, not found <- [[list]Buffer >>]Index[[index]-[[list]Offset >>]]
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 }{
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
95 out, not found <- [[list]Right >>]Index[[index]-[right offset]]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
99
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
100 Length@List[list:out]
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
101 {
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
102 out <- [list]Length >>
70
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
103 }
1bfcf5f8fa69 Beginning of List implementation
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
105 Set@List[list,index,val:out,invalid index]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
106 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
107 If[[index]>[[list]Length]]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
108 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
109 out <- [[list]Set[[index]-[1], val]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
110 ]Set[index, val]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
111 }{
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
112 offset <- [list]Offset >>
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
113 If[[index]<[offset]]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
114 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
115 lsize <- [[list]Left >>]Length
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
116 ,invalid <- [[list]Left >>]Set[index, val]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
117 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
118 out <- [[list]Left <<[~]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
119 ]Length <<[ [[list]Length >>]+[[[~]Length]-[lsize]] ]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
120 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
121 }{
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
122 right offset <- [offset]+[8]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
123 If[[index]<[right offset]]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
124 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
125 off index <- [index]-[[list]Offset >>]
96
5a08705f7610 Semi-broken cleanup of Array implementation
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
126 bsize <- [[list]Buffer >>]Length
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
127 [[list]Buffer >>]Set[off index, val]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
128 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
129 out <- [[list]Buffer <<[~]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
130 ]Length <<[ [[list]Length >>]+[[[~]Length >>]-[bsize]] ]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
131 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
132 }{
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
133 rsize <- [[list]Right>>]Length
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
134 adj ind <- [index]-[right offset]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
135 If[[[[list]Left>>]Length] > [rsize]]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
136 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
137 [[list]Right >>]Set[adj ind, val]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
138 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
139 out <- [[list]Right <<[~]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
140 ]Length <<[ [[list]Length >>]+[[[~]Length]-[rsize]] ]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
141 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
142 }{
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
143 out <- [[[[[Build[List()]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
144 ]Buffer << [[Array[]]Append[val]]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
145 ]Left << [list]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
146 ]Right << [List[]]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
147 ]Offset << [index]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
148 ]Length << [ [[list]Length]+[1] ]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
149 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
150 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
151 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
152 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
153 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
154
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
155 Last@List[list:out,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
156 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
157 out <- [[list]Length]-[1]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
158 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
159
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
160 Append@List[list,val:out]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
161 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
162 [list]Last
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
163 { index <- [~]+[1] }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
164 { index <- 0 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
165 out <- [list]Set[index, val]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
166 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
167
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
168 First@List[list:out,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
169 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
170 If[[[list]Left >>]Length]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
171 {
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
172 out <- [[list]Left >>]First
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
173 }{
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
174 out <- [list]Offset >>
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
175 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
176 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
177
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
178 Next@List[list,index:next,none]
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
179 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
180 pos next <- [index]+[1]
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
181 ,none <- If[[pos next] < [[list]Length]]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
182 {
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
183 next <- Val[pos next]
75
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
184 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
185 }
0083b2f7b3c7 Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents: 70
diff changeset
186
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
187 New Like@List[in:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
188 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
189 out <- List[]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
190 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
191
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
192 New Like@List Leaf[in:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
193 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
194 out <- List[]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
195 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
196
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
197 //TODO: Implement a more efficent version of this
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
198 _Tail[list, cur, dest:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
199 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
200 ndest <- [dest]Append[[list]Index[cur]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
201 [list]Next[cur]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
202 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
203 out <- _Tail[list, ~, ndest]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
204 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
205 out <- Val[ndest]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
206 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
207 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
208 Tail[list,start:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
209 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
210 newlist <- New Like[list]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
211 [list]Index[start]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
212 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
213 out <- _Tail[list, start, newlist]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
214 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
215 out <- Val[newlist]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
216 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
217 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
218
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
219 Concatenate[left,right:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
220 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
221 out <- Fold[Append[?], left, right]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
222 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
223
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
224 Print@List Leaf[list:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
225 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
226 If[[[list]Buffer >>]Length]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
227 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
228 Print["List"]
97
fa437d23bb24 fix memory corruption bug
Mike Pavone <pavone@retrodev.com>
parents: 96
diff changeset
229 { out <- _Print Seq[list, [list]First] }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
230 }{
97
fa437d23bb24 fix memory corruption bug
Mike Pavone <pavone@retrodev.com>
parents: 96
diff changeset
231 out <- Print["List\n\t{Empty}"]
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
232 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
233 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
234
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
235 Print@List[list:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
236 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
237 Print["List"]
97
fa437d23bb24 fix memory corruption bug
Mike Pavone <pavone@retrodev.com>
parents: 96
diff changeset
238 { out <- _Print Seq[list, [list]First] }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
239 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents: 76
diff changeset
240
100
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
241 Peek@List[list:out,empty]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
242 {
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
243 [list]Last
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
244 {
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
245 out <- [list]Index[~]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
246 }{
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
247 empty <- list
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
248 }
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
249 }
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
250
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
251 Peek@List Leaf[list:out,empty]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
252 {
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
253 [list]Last
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
254 {
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
255 out <- [list]Index[~]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
256 }{
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
257 empty <- list
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
258 }
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
259 }
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
260
101
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
261 _Check Present[check in,val,index:out]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
262 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
263 [check in]Index[index]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
264 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
265 If[[~]=[val]]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
266 { out <- No }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
267 { out <- Yes }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
268 }{
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
269 out <- Yes
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
270 }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
271 }
100
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 97
diff changeset
272
101
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
273 _=List[a,b:out]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
274 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
275 ,out <- If[[[a]Length]=[[b]Length]]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
276 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
277 [a]Find[_Check Present[b,?]]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
278 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
279 out <- No
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
280 }{
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
281 out <- Yes
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
282 }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
283 }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
284 }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
285
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
286 =@List Leaf[a,b:out]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
287 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
288 out <- _=List[a,b]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
289 }
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
290
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
291 =@List[a,b:out]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
292 {
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
293 out <- _=List[a,b]
f4fc0a98088a Fixed some bugs that were preventing compiled compiler from working correctly. Need to address memory usage
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
294 }
126
85f8012b6938 Simplify and speed up List by removing support for sparse Lists
Mike Pavone <pavone@retrodev.com>
parents: 101
diff changeset
295