Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
api:transforms [2017/10/20 01:10]
payonel [Transforms API]
api:transforms [2017/10/20 01:11] (current)
payonel [Transforms API]
Line 19: Line 19:
   *  `predicate(element:​ value, index: number, tbl: table): number, number`   *  `predicate(element:​ value, index: number, tbl: table): number, number`
  
-  This predicate is called in sequence on each index in `tbl`. `element` is the value at `tbl[index]`. Generally, predicate methods ignore `index` and `tbl`, and only process `element`. But some predicates may need to check values in `tbl` before or after `index`. *Important* to note that the `tbl` passed to the `predicate` is actually a _*view*_ of the original table passed to the transforms api. This _*view*_ is not a natural sequence but instead only returns values from `tbl` within the [`first`, `last`] range.+  This predicate is called in sequence on each index in `tbl`. `element` is the value at `tbl[index]`. Generally, predicate methods ignore `index` and `tbl`, and only process `element`. But some predicates may need to check values in `tbl` before or after `index`. ​**Important** to note that the `tbl` passed to the `predicate` is actually a _**view**_ of the original table passed to the transforms api. This _**view**_ is not a natural sequence but instead only returns values from `tbl` within the [`first`, `last`] range.
  
   In other words, the predicate handles a "set of elements"​ and returns parameters indicating the satisfied condition.   In other words, the predicate handles a "set of elements"​ and returns parameters indicating the satisfied condition.