Page / Window of a List (Expression) — skLambda
Addon: skLambda · Category: Expression · Since: 1.2.0
Syntax
page %number% of %objects% by %number%Description
A single fixed-size slice of a list (1-based), the building block for paging a list into a GUI. `page N of %objects% by S` returns the Nth non-overlapping chunk of size S; the last page may be shorter, and a page past the end is empty. Pair it with `page count of ... by ...`. `window N of %objects% by S` returns the Nth overlapping window of size S, sliding one element at a time (window 1 is items 1 to S, window 2 is items 2 to S+1). Only full windows exist, so a window that would run past the end is empty.
Examples
# deal {_items::*} into rows of 9 for a paged GUI
set {_slots::*} to page {_page} of {_items::*} by 9
set {_w::*} to window 2 of (1, 2, 3, 4) by 3 # 2, 3, 4