You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,11 +143,11 @@ b = Square(2.2) # float specialization
143
143
c = Square(arr) # squares each array element
144
144
a, b, c
145
145
146
-
# Range and filter (non-accumulated)
146
+
# Range, mask, and filter (non-accumulated)
147
147
d = Square(1:3) # range: final iteration result
148
148
e = Square(arr[1:3]) # array-range: final iteration result
149
-
f = Square(arr >3) #filtered array
150
-
g = Square(arr[1:3] >3) #filtered array-range
149
+
f = Square(arr >3) #element-wise mask: each element kept where > 3, else 0
150
+
g = Square(arr[1:3] >3) # array-range filter: final iteration result
151
151
d, e, f, g
152
152
153
153
# Accumulation forms
@@ -162,11 +162,11 @@ Output:
162
162
163
163
```text
164
164
25 4.84 [1 4 9 25]
165
-
4 9 [25] 0
165
+
4 9 [0 0 0 25] 0
166
166
[1 4] [4 9] [0 4] [0 9 25]
167
167
```
168
168
169
-
No generics syntax, no type parameters. Write the template once — call it with a scalar, an array, or a filtered view. `arr > 3`filters the array to elements greater than 3and passes that subset through.
169
+
No generics syntax, no type parameters. Write the template once — call it with a scalar, an array, or a masked array. `arr > 3`masks the array element-wise — each element kept where it's greater than 3, else 0 (same length) — and passes that through.
170
170
171
171
Generated code is equivalent to handwritten specialized code. There is no runtime overhead.
172
172
@@ -195,7 +195,7 @@ x = [1 2 3 4 5]
195
195
y = [1.12.23.3]
196
196
```
197
197
198
-
Arrays are safe by construction — out-of-bounds access is not possible. Comparisons like `arr > 2` produce filtered views that work anywhere an array does.
198
+
Arrays are safe by construction — out-of-bounds access is not possible. Comparisons like `arr > 2` produce element-wise masks (each element kept where it holds, else 0) that work anywhere an array does.
0 commit comments