site/contents/_includes/_reference-seq.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
{@ _defs_.md || 0 @} {#op||all?||{{q1}} {{q2}}||{{b}}|| Applies predicate {{q2}} to each element of {{q1}} and returns {{t}} if all elements of {{q1}} satisfy predicate {{q2}}, {{f}} otherwise. #} {#op||any?||{{q1}} {{q2}}||B|| Applies predicate {{q2}} to each element of {{q1}} and returns {{t}} if at least one element of {{q1}} satisfies predicate {{q2}}, {{f}} otherwise. #} {#op||append||{{any}} {{q}}||({{a0p}} {{any}})|| Returns a new quotation containing the contents of {{q}} with {{any}} appended. #} {#op||apply||{{q}}||({{a0p}})|| Returns a new quotation {{q}} obtained by evaluating each element of {{q}} in a separate stack.#} {#op||get||{{q}} {{i}}||{{any}}|| Returns the _n^th_ element of {{q}} (zero-based).#} {#op||concat||{{q1}} {{q2}}||{{q3}}|| Concatenates {{q1}} with {{q2}}. #} {#op||ddel||{{d1}} {{sl}}||{{d2}}|| Returns a copy of {{d1}} without the element with key {{sl}}. #} {#op||filter||{{q1}} {{q2}}||{{q3}}|| > Returns a new quotation {{q3}} containing all elements of {{q1}} that satisfy predicate {{q2}}. > > > %sidebar% > > Example > > > > The following program leaves `(2 6 8 12)` on the stack: > > > > (1 37 34 2 6 8 12 21) > > (dup 20 < swap even? and) filter #} {#op||dget||{{d}} {{sl}}||{{any}}|| Returns the value of key {{sl}} from dictionary {{d}}. #} {#op||dhas?||{{d}} {{sl}}||{{b}}|| > Returns {{t}} if dictionary {{d}} contains the key {{sl}}, {{f}} otherwise. > > > %sidebar% > > Example > > > > The following program returns {{t}}: > > > > ((a1 true) (a2 "aaa") (a3 false)) 'a2 dhas? #} {#op||dset||{{d1}} {{any}} {{sl}}||{{d2}}|| Sets the value of the {{sl}} of {{d1}} to {{any}}, and returns the modified copy of the dictionary {{d2}}. #} {#op||first||{{q}}||{{any}}|| Returns the first element of {{q}}. #} {#op||in?||{{q}} {{any}}||{{b}}|| Returns {{t}} if {{any}} is contained in {{q}}, {{f}} otherwise.#} {#op||insert||{{q1}} {{any}} {{i}}||{{q2}}|| Inserts {{any}} as the value of the _n^th_ element {{q1}} (zero-based), and returns the modified copy of the quotation {{q2}}. #} {#op||keys||{{q}}||({{s}}{{0p}})|| Returns a quotation containing all the keys of dictionary {{d}}. #} {#op||map||{{q1}} {{q2}}||{{q3}}|| Returns a new quotation {{q3}} obtained by applying {{q2}} to each element of {{q1}}.#} {#op||prepend||{{any}} {{q}}||({{any}} {{a0p}})|| Returns a new quotation containing the contents of {{q}} with {{any}} prepended. #} {#op||reject||{{q1}} {{q2}}||{{q3}}|| Returns a new quotatios {{q3}} including all elements of {{q1}} that do not satisfy predicate {{q2}} (i.e. the opposite of `filter`)#} {#op||remove||{{q1}} {{i}}||{{q2}}|| Returns the _n^th_ element of {{q1}} (zero-based), and returns the modified copy of the quotation {{q2}}.#} {#op||rest||{{q1}}||{{q2}}|| Returns a new quotation {{q2}} containing all elements of {{q1}} quotation except for the first. #} {#op||reverse||{{q1}}||{{q2}}|| Returns a new quotation {{q2}} containing all elements of {{q1}} in reverse order. #} {#op||set||{{q1}} {{any}} {{i}}||{{q2}}|| Sets the value of the _n^th_ element {{q1}} (zero-based) to {{any}}, and returns the modified copy of the quotation {{q2}}. #} {#op||shorten||{{q1}} {{i}}||{{q2}}|| Returns a quotation {{q2}} containing the first _n_ values of the input quotation {{q1}}. #} {#op||size||{{q}}||{{i}}|| Returns the length of {{q}}.#} {#op||sort||{{q1}} {{q2}}||{{q3}}|| > Sorts all elements of {{q1}} according to predicate {{q2}}. > > > %sidebar% > > Example > > > > The following program leaves `(1 3 5 7 9 13 16)` on the stack: > > > > (1 9 5 13 16 3 7) '> sort #} {#op||values||{{d}}||({{a0p}})|| Returns a quotation containing all the values of dictionary {{d}}. #} |