Planned↡
On Infixes r←x(F↡)y
x
is a scalar integer, vector of integers or matrix. r
is the result of applying F
to infixes of y
as defined by x
:
- if
x
is a positive scalar, it is interpreted as⟨x⋄1⟩
; - if
x
is a negative scalar, it is interpreted as⟨|x⋄|x⟩
; - if
x
is a vector, it is interpreted as∧x
;
Each row of x
corresponds to an axis of y
and defines the windowing along that axis. In its most general form, each row of x
is of the form ⟨size⋄skip⋄mode⟩⍪args
. skip
defaults to 1
; mode
defaults to 1
; args
defaults to ⟨⟩
.
Modes
Each mode
is a way of handling creating windows at edges of the array.
1
: Keep Shorter at End; args = ⟨⟩
The first window starts at 0
; the next window at skip
; and so on. All windows have length size
, except the last one which might be shorter if the array ends.
¯1
: Keep Shorter at Beginning; args = ⟨⟩
The last window ends at the end of the array ¯1+≢y
; the second-to-last window at (¯1+≢y)-skip
; and so on. All windows have length size
, except the first one which might be shorter if the array ends.
2
: Drop Shorter at End; args = ⟨⟩
Like mode 1
, except that if the last window is shorter it is excluded.
¯2
: Drop Shorter at Beginning; args = ⟨⟩
Like mode ¯1
, except that if the first window is shorter it is excluded.
3
: Transform at End; args = ⟨fill⟩⍪params
Like mode 1
, except that if the last window is shorter, it is padded using fill mode fill
with params params
.
¯3
: Transform at Beginning; args = ⟨fill⟩⍪params
Like mode ¯1
, except that if the first window is shorter, it is padded using fill mode fill
with params params
.
4
: Stencil; args = ⟨fill⟩⍪params
The first window starts such that the first element is in the middle, if size
is odd, or the first two elements are in the middle, if size
is even; and continues until the last element or tow eleemnts are reached at or past the middle.
5
: Continue at End; args = ⟨fill⟩⍪params
Like mode 3
, except that it doesn't stop when the last window encounters the last item of the array anywhere, but only at the beginning.
¯5
: Continue at Beginning; args = ⟨fill⟩⍪params
Like mode ¯3
, except that it doesn't stop where the first window encounters the first item of the array anywhere, but only at the end.
Fill modes
Fill modes are behaviors for when you need to generate new array elements to fill a window.
0
: Fill; params = ⟨el⟩
All extra elements are el
.
1
: Replicate; params = ⟨⟩
If extending the end of the array, the last item is used; if extending the beginning of the array, the first item is used.
2
: Reverse; params = ⟨⟩
Both edges are extended by selecting items of the array in reverse order.
3
: Mirror, params = ⟨⟩
If extending the end of the array, items of the init of the array in reverse order are used; if extending the beginning of the array, items of the tail of the list in reverse order are used.
4
: Wrap, params = ⟨⟩
Both edges are extended by selecting items of the array.
⊏Fn
: Custom, params = ⟨⟩
Fn
is called with the array as right argument and the required amount of extra elements as the left argument.