|
| 1 | +# Function Snippets |
| 2 | +## List Grab |
| 3 | +Contents to store |
| 4 | +``` |
| 5 | +elements(%0,lmath(min,firstof(filterbool(#lambda/%%0,iter(%1,match(%0,%i0,%2),%2)),0)),%2) |
| 6 | +``` |
| 7 | + |
| 8 | +### Call |
| 9 | +> `u(listgrab, <list>, <patternlist>, [delimiter])` |
| 10 | +> => result |
| 11 | +
|
| 12 | +### Expected behavior |
| 13 | +Extension of grab() which returns the first word in <list> which matches any of the patterns in <patternlist> (%1). |
| 14 | +Both <list> and <patternlist> must use the same [delimiter], if specified (defaults to space.) |
| 15 | + |
| 16 | +### Example usage: |
| 17 | +`think listgrab(foo bar baz qux,ba* qu*)` |
| 18 | +> bar |
| 19 | +
|
| 20 | +## All List Grab |
| 21 | +Contents to store |
| 22 | +``` |
| 23 | +elements(%0,lmatch(%1,%2,strfirstof(%3,%b)),strfirstof(%3,%b),strfirstof(%4,%b)) |
| 24 | +``` |
| 25 | + |
| 26 | +### Call |
| 27 | +> `u(agrab, <values>, <columninfo>, <columnnames>, <delim>, <osep>)` |
| 28 | +> columnvalues |
| 29 | +
|
| 30 | +### Documentation |
| 31 | +This function allows you to grab the values in a delimited <values> list, by giving the function a <columninfo> for its second attribute that contains the aliases or names of the locations of the values. The <columnnames> list then withdraws the values found at the locations in the <values> list, corresponding to the names found in <columninfo>. The <delim>item is the delimiter, and the <osep>is the outseperator. |
| 32 | + |
| 33 | +### Notes |
| 34 | +lmatch is not a standard function. See the 'List Match' example for lmatch. |
| 35 | + |
| 36 | +### Example usage |
| 37 | +`think u(agrab,-5 6 88 3,DEX AGI MAG FIRE,MAG DEX)` |
| 38 | +> 88 -5 |
| 39 | +
|
| 40 | +## List Match |
| 41 | +Contents to store |
| 42 | +``` |
| 43 | +iter(%1,match(%0,%i0,strfirstof(%2,%b)),strfirstof(%2,%b),strfirstof(%3,%b)) |
| 44 | +``` |
| 45 | + |
| 46 | +### Call |
| 47 | +> `u(lmatch, <originlist>, <searchitemlist>, <delim>, <osep>)` |
| 48 | +> foundlist |
| 49 | +
|
| 50 | +### Documentation |
| 51 | +This function compares <searchitemlist> to <originlist>, and returns the locations of the found items from <searchitemlist> in <originlist> as FOUNDLIST. The <delim> and <osep> are delimiter and Out Seperator. |
0 commit comments