frame/sort
src/frame/sort.tur
defn
arrange-indices
(arrange-indices [f :int names :int dirs :int] :int)
compute the permutation that would sort the frame.
Parameters
| f | :int frame | |
| names | cons list of :cstr column names | |
| dirs | parallel cons list of :int directions (0 = asc, 1 = desc) |
Returns
:int cons list of row indices in sorted order; 0 if any name is missing.
Since: FR4
defn
reorder
(reorder [f :int indices :int] :int)
apply a permutation cons list to f (returns a new frame).
Since: FR4
defn
arrange
(arrange [f :int names :int dirs :int] :int)
return a new frame sorted by the given keys.
Internal definitions
__so-nil__so-cons__so-compute-perm-- given a frame and parallel arrays of (col_ix, dir),__so-perm-free-- length of a perm array (we already passed n-rows but__so-perm-nth-- read perm[i] (used by arrange-indices to build the__so-take-- build a new column by applying `perm` (int64_t[n]) to `col`.__so-name-at__so-names-to-ixs__so-list-length__so-clone-field-at__so-build-fields__so-build-cols__so-perm-to-list__so-list-to-perm