3,056
edits
m (→Monadic Array) |
(→Primitives: Remove entries that are both experimental and deprecated, and unlink some entries) |
||
Line 33: | Line 33: | ||
All table below are based on Uiua version 0.8.0-1/28/2024. | All table below are based on Uiua version 0.8.0-1/28/2024. | ||
<span style="color:black; background-color: yellow">Yellow background text </span> | <span style="color:black; background-color: yellow">Yellow background text</span> indicates that the primitive is deprecated and will be removed in a future version, and 🧪 indicates a primitive that is experimental and may be changed or removed in the future. | ||
==== Stack ==== | ==== Stack ==== | ||
Work with the stack | Work with the stack | ||
Line 224: | Line 223: | ||
This is the element-wise version of <code>≡ rows.</code> | This is the element-wise version of <code>≡ rows.</code> | ||
|- | |- | ||
| <code>≡</code> || | | <code>≡</code> || Rows || Monadic modifier ||Apply a function to each row of an array or arrays. | ||
This is the row-wise version of <code>∵ each.</code> | This is the row-wise version of <code>∵ each.</code> | ||
|- | |- | ||
| <code>⊞</code> || | | <code>⊞</code> || Table || Monadic 2-argument modifier || Apply a function to each combination of rows of two arrays. | ||
This is often what you want instead of <code>∵ each.</code> | This is often what you want instead of <code>∵ each.</code> | ||
|- | |- | ||
| <code>⊠</code> || <span style="color:black; background-color: yellow"> | | <code>⊠</code> || <span style="color:black; background-color: yellow">Cross</span> || Monadic 2-argument modifier || Apply a function to each combination of rows of arrays. | ||
This was the row-wise version of <code>⊞ Table</code> | This was the row-wise version of <code>⊞ Table</code> | ||
|- | |- | ||
Line 246: | Line 245: | ||
For reducing with an initial value, see <code>∧ fold</code> | For reducing with an initial value, see <code>∧ fold</code> | ||
|- | |- | ||
| <code>∧</code> || | | <code>∧</code> || Fold || Apply a function to aggregate arrays. | ||
|- | |- | ||
| <code>\</code> || [[Scan]] || Reduce, but keep intermediate values | | <code>\</code> || [[Scan]] || Reduce, but keep intermediate values | ||
Line 284: | Line 283: | ||
| <code>°</code> || [[Un]] || Monadic modifier || Invert the behavior of a function | | <code>°</code> || [[Un]] || Monadic modifier || Invert the behavior of a function | ||
Most functions are not invertible. | Most functions are not invertible. | ||
|- | |- | ||
| <code>⍜</code> || [[Under]] || Dyadic modifier || Apply a function under another | | <code>⍜</code> || [[Under]] || Dyadic modifier || Apply a function under another | ||
Line 307: | Line 304: | ||
| <code>∘</code> || [[Identity]] || Monadic function || Do nothing with one value | | <code>∘</code> || [[Identity]] || Monadic function || Do nothing with one value | ||
|- | |- | ||
| <code>⋅</code> || | | <code>⋅</code> || Gap || Monadic modifier || Discard the top stack value then call a function | ||
|- | |- | ||
| <code>⊙</code> || | | <code>⊙</code> || Dip || Monadic modifier || Temporarily pop the top value off the stack and call a function | ||
|- | |- | ||
| <code>∩</code> || | | <code>∩</code> || Both || Monadic 2-argument modifier || Call a function on two sets of values | ||
For monadic functions, <code>∩ both</code> calls its function on each of the top 2 values on the stack. | For monadic functions, <code>∩ both</code> calls its function on each of the top 2 values on the stack. | ||
|- | |- | ||
Line 317: | Line 314: | ||
<code>⊃ fork</code> is one of the most important functions for working with the stack. | <code>⊃ fork</code> is one of the most important functions for working with the stack. | ||
|- | |- | ||
| <code> | | <code>⊓</code> || Bracket || Dyadic modifier || Call two functions on two distinct sets of values | ||
|- | |- | ||
| <code>⋔</code> || 🧪All || Dyadic modifier || 🧪Call a function on many distinct sets of values | |||
| <code>⋔</code> || | |||
For just 2 sets of values, <code>∩ both</code> is often simpler. | For just 2 sets of values, <code>∩ both</code> is often simpler. | ||
Line 328: | Line 322: | ||
To do something similar to ∩ both on more than 2 sets of values, you can use <code>⊙ dip</code> and <code>∘</code> identity to select values. | To do something similar to ∩ both on more than 2 sets of values, you can use <code>⊙ dip</code> and <code>∘</code> identity to select values. | ||
|} | |} | ||
== External links == | == External links == | ||
* [https://concatenative.org/wiki/view/Uiua Uiua] on the concatenative language wiki | * [https://concatenative.org/wiki/view/Uiua Uiua] on the concatenative language wiki |