Uiua: Difference between revisions
No edit summary |
m (Supports complex numbers as a distinct type from floats, also version bump) |
||
(30 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Infobox array language | {{Infobox array language | ||
| logo = [[File:Uiua logo.png]] | | logo = [[File:Uiua logo.png]] | ||
| array model = [[flat array model|flat]] with | | array model = [[flat array model|flat]] with [[boxes]] | ||
| index origin = 0 | | index origin = 0 | ||
| function styles = stack-based [[tacit]] | | function styles = stack-based [[tacit]] | ||
| numeric types = 64-bit float | | numeric types = 64-bit float, [[complex]] float | ||
| | | Unicode support = full | ||
| released = 2023 | | released = 2023 | ||
| developer = Kai Schmidt | | developer = Kai Schmidt | ||
| latest release version = 2024 | | latest release version = 0.12.3 / 2024 | ||
| implementation languages = [[ | | implementation languages = [[Wikipedia:Rust (programming language)|Rust]] | ||
| source = [https://github.com/uiua-lang/uiua GitHub] | | source = [https://github.com/uiua-lang/uiua GitHub] | ||
| platforms = native, in-browser | | platforms = native, in-browser | ||
Line 16: | Line 16: | ||
| file ext = .ua | | file ext = .ua | ||
| documentation = [https://www.uiua.org/docs Documentation] | | documentation = [https://www.uiua.org/docs Documentation] | ||
| influenced by = [[wikipedia:Forth (programming language)|Forth]], [[BQN]] | | influenced by = [[wikipedia:Forth (programming language)|Forth]], [[BQN]], [[J]] | ||
| run online = [https://www.uiua.org/pad Pad] | | run online = [https://www.uiua.org/pad Pad] | ||
}} | }} | ||
'''Uiua''' is a stack-based array language designed by Kai Schmidt | '''Uiua''' is a stack-based array language emphasizing [[tacit]] programming, designed by Kai Schmidt. Initially influenced strongly by [[BQN]], Uiua has added original stack-based features and [[glyphs]] and moved to the [[Array model#boxes|boxed array model]] of [[SHARP APL]] and [[J]]. It also makes functions second-class rather than first-class to facilitate features that depend on the number of arguments functions take. | ||
== Overview == | == Overview == | ||
Uiua uses concatenative evaluation (a [[wikipedia:context-free grammar|context-free grammar]]) with a right-to-left ordering as in [[ | Uiua uses concatenative evaluation (a [[wikipedia:context-free grammar|context-free grammar]]) with a right-to-left ordering as in [[Wikipedia: Polish notation|Polish notation]]. The language supports [[tacit programming]] using stack manipulation [[primitive]]s, and all complex functions must be defined this way as there is no explicit function form that allows local variables. [[Function]]s have a fixed number of input and output values, meaning the overloading of [[ambivalent function]]s is removed. Because of this, Uiua often splits APL primitives into two functions. Its primitives use [[Unicode]] glyphs including many not found in other languages. To avoid [[typing glyphs]] necessitating a keyboard layout containing these, each primitive can also be spelled using a name that consists of lowercase letters (user-defined names must have at least one uppercase letter). By default, the language formats source files when run to convert these names into the corresponding glyphs. | ||
Like the [[SHARP APL]] family, [[Array_model#Flat_array_theory|arrays | Like the [[SHARP APL]] family, Uiua supports only [[Array_model#Flat_array_theory|flat arrays]] with a homogeneous [[type]], and has a dedicated [[box]] type for [[Nested array|array nesting]]. However, arithmetic is [[pervasion|pervasive]] as in the nested array model. Arithmetic also follows [[leading axis agreement]], extended so that a length-1 axis is matched with an axis of any length by replicating along it (like the broadcasting system of [[wikipedia:Julia (programming language)|Julia]] and [[wikipedia:NumPy|NumPy]]). It supports [[character arithmetic]] as in [[BQN]], as well as other primitives characteristic of BQN such as [[structural Under]], [[Classify]], and a [[Transpose]] that rotates the axes of its argument by one. | ||
Uiua | == Primitives == | ||
=== Functions with unique glyphs === | |||
In Uiua, we can type in the name of the function or a part of it and when formatted, it will format the name to its corresponding Unicode Symbol, so that we don't have to use non-ASCII keyboards (or Alt-codes). | |||
The tables below are based on Uiua version 0.12.0, with since-removed primitives taken out. | |||
==== Stack ==== | ==== Stack ==== | ||
Work with the stack | Work with the stack | ||
{| class="wikitable | {| class="wikitable" | ||
|+ Table of Stack | |+ Table of Stack functions in Uiua | ||
|- | |- | ||
! Glyph !! Name !! Type !! Definition | ! Glyph !! Name !! Type !! Definition | ||
|- | |- | ||
| <code>.</code> || | | <code>.</code> || Duplicate || Monadic 2-output function || Duplicate the top value on the stack | ||
|- | |||
| <code>,</code> || Over || Dyadic 3-output function || Duplicate the second-to-top value to the top of the stack | |||
|- | |||
| <code>:</code> || Flip || Dyadic 2-output function || Swap the top two values on the stack | |||
|- | |||
| <code>◌</code> || Pop || Monadic 0-output function || Discard the top stack value | |||
|- | |- | ||
| <code> | | <code>⟜</code> || On || Monadic modifier || Call a function but keep its top argument on top of the stack | ||
|- | |- | ||
| <code> | | <code>⤙</code> || But || Monadic modifier || Call a function but keep its last argument on top of the stack | ||
|- | |- | ||
| <code> | | <code>⤚</code> || With || Monadic modifier || Call a function but keep its top argument below the outputs on the stack | ||
|- | |- | ||
| <code> | | <code>⊸</code> || By || Monadic modifier || Duplicate a function's last argument before calling it | ||
|- | |- | ||
| <code>⸮</code> || | | <code>¨</code> || Backward || Monadic modifier || Call a function with its arguments reversed | ||
|- | |||
| <code>?</code> || Stack || Noadic 0-output function || Debug print all stack values without popping them | |||
|- | |||
| <code>⸮</code> || Trace || Monadic function || Debug print the top value on the stack without popping it | |||
|- | |- | ||
|} | |} | ||
==== Constants ==== | ==== Constants ==== | ||
Push a constant value onto the stack | Push a constant value onto the stack | ||
{| class="wikitable | {| class="wikitable" | ||
|+ Table of Constants in Uiua | |+ Table of Constants in Uiua | ||
!Glyph !! Name !! Definition | !Glyph !! Name !! Definition | ||
|- | |- | ||
| <code>η</code> || | | <code>η</code> || Eta || The number of radians in a quarter circle | ||
|- | |- | ||
| <code>π</code> || [[Pi]] || The ratio of a circle's circumference to its diameter | | <code>π</code> || [[Pi]] || The ratio of a circle's circumference to its diameter | ||
|- | |- | ||
| <code>τ</code> || | | <code>τ</code> || Tau || The ratio of a circle's circumference to its radius | ||
|- | |- | ||
| <code>∞</code> || [[Infinity]] || The biggest number | | <code>∞</code> || [[Infinity]] || The biggest number | ||
|} | |} | ||
==== Monadic Pervasive ==== | ==== Monadic Pervasive ==== | ||
Operate on every element in an array | Operate on every element in an array | ||
{| class="wikitable | {| class="wikitable" | ||
|+ Table of Monadic Pervasive in Uiua | |+ Table of Monadic Pervasive functions in Uiua | ||
! Glyph !! Name !! Definition | ! Glyph !! Name !! Definition | ||
|- | |- | ||
Line 80: | Line 92: | ||
| <code>⌵</code> || [[Absolute value]] || Get the absolute value of a number | | <code>⌵</code> || [[Absolute value]] || Get the absolute value of a number | ||
|- | |- | ||
| <code>√</code> || [[Sqrt]] || Take the square root of a number | | <code>√</code> || [[Square Root|Sqrt]] || Take the square root of a number | ||
|- | |- | ||
| <code> | | <code>∿</code> || Sine || Get the sine of a number | ||
|- | |- | ||
| <code>⌊</code> || [[Floor]] || Round to the nearest integer towards <code>¯∞</code> | | <code>⌊</code> || [[Floor]] || Round to the nearest integer towards <code>¯∞</code> | ||
Line 91: | Line 103: | ||
|} | |} | ||
==== Dyadic Pervasive ==== | ==== Dyadic Pervasive ==== | ||
Operate on every pair of elements in two arrays | Operate on every pair of elements in two arrays | ||
{| class="wikitable | {| class="wikitable" | ||
|+ Table of | |+ Table of Dyadic Pervasive functions in Uiua | ||
! Glyph !! Name !! Definition !! Formats from: | ! Glyph !! Name !! Definition !! Formats from: | ||
|- | |- | ||
Line 108: | Line 120: | ||
| <code>≥</code> || [[Greater or equal]] || Compare for greater than or equal || >= | | <code>≥</code> || [[Greater or equal]] || Compare for greater than or equal || >= | ||
|- | |- | ||
| <code>+ | | <code>+</code> || [[Add]] || Add values || + | ||
|- | |- | ||
| <code>-</code> || [[Subtract]] || Subtract values || - | | <code>-</code> || [[Subtract]] || Subtract values || - | ||
Line 115: | Line 127: | ||
|- | |- | ||
| <code>÷</code> || [[Divide]] || Divide values || % | | <code>÷</code> || [[Divide]] || Divide values || % | ||
|- | |||
| <code>◿</code> || [[Modulus]] || Modulo values || mod | |||
|- | |||
| <code>ⁿ</code> || [[Power]] || Raise a value to a power || pow | |||
|- | |||
| <code>ₙ</code> || [[Logarithm]] || Get the based logarithm of a number || log | |||
|- | |||
| <code>↧</code> || [[Minimum]]/[[Logical And]] || Take the minimum of two arrays (Can use for logical AND.) || min | |||
|- | |||
| <code>↥</code> || [[Maximum]]/[[Logical Or]] || Take the maximum of two arrays (Can use for logical OR.) || max | |||
|- | |||
| <code>∠</code> || Atangent || Take the arctangent of two numbers || atan | |||
|- | |||
| <code>ℂ</code> || [[Complex (function)|Complex]] || Make a complex number from imaginary and real parts || com | |||
|} | |} | ||
==== Monadic Array ==== | |||
Operate on a single array | |||
{| class="wikitable" | |||
|+ Table of Monadic Array functions in Uiua | |||
! Glyph !! Name !! Definition | |||
|- | |||
| <code>⧻</code> || [[Length]] || Get the number of rows in an array | |||
|- | |||
| <code>△</code> || [[Shape]] || Get the dimensions of an array | |||
|- | |||
| <code>⇡</code> || [[Index Generator|Range]] || Make an array of all natural numbers less than a number | |||
|- | |||
| <code>⊢</code> || First || Get the first row of an array | |||
|- | |||
| <code>⇌</code> || [[Reverse]] || Reverse the rows of an array | |||
|- | |||
| <code>♭</code> || [[Deshape]] || Make an array 1-dimensional | |||
|- | |||
| <code>¤</code> || [[Promote|Fix]] || Add a length-1 axis to an array | |||
|- | |||
| <code>⋯</code> || [[Encode|Bits]] || Encode an array as bits (LSB-first) | |||
|- | |||
| <code>⍉</code> || [[Transpose]] || Rotate the shape of an array | |||
|- | |||
| <code>⍏</code> || [[Grade|Rise]] || Get the indices into an array if it were sorted ascending | |||
|- | |||
| <code>⍖</code> || [[Grade|Fall]] || Get the indices into an array if it were sorted descending | |||
|- | |||
| <code>⊚</code> || [[Where]] || Get indices where array values are not equal to zero | |||
|- | |||
| <code>⊛</code> || [[Classify]] || Assign a unique index to each unique element in an array | |||
|- | |||
| <code>◴</code> || [[Deduplicate]] || Remove duplicate elements from an array | |||
|- | |||
| <code>◰</code> || [[Nub Sieve|Unique]] || Get a mask of the first occurrences of items in an array | |||
|- | |||
| <code>□</code> || [[Box]] || Turn an array into a box | |||
|- | |||
|} | |||
==== Dyadic Array ==== | |||
Operate on two arrays | |||
{| class="wikitable" | |||
|+ Table of Dyadic Array functions in Uiua | |||
! Glyph !! Name !! Definition | |||
|- | |||
| <code>≍</code> || [[Match]] || Check if two arrays are exactly the same | |||
|- | |||
| <code>⊟</code> || [[Couple]] || Combine two arrays as rows of a new array | |||
|- | |||
| <code>⊂</code> || [[Catenate|Join]] || Append two arrays end-to-end | |||
|- | |||
| <code>⊏</code> || [[Select]] || Select multiple rows from an array | |||
|- | |||
| <code>⊡</code> || [[Pick]] || Index a row or elements from an array | |||
|- | |||
| <code>↯</code> || [[Reshape]] || Change the shape of an array | |||
|- | |||
| <code>☇</code> || Rerank || Change the rank of an array's rows | |||
|- | |||
| <code>↙</code> || [[Take]] || Take the first n elements of an array | |||
|- | |||
| <code>↘</code> || [[Drop]] || Drop the first n elements of an array | |||
|- | |||
| <code>↻</code> || [[Rotate]] || Rotate the elements of an array by n | |||
|- | |||
| <code>⮌</code> || [[Orient]] || Change the order of the axes of an array. | |||
|- | |||
| <code>◫</code> || [[Windows]] || The n-wise windows of an array | |||
|- | |||
| <code>▽</code> || [[Replicate|Keep]] || Discard or copy some rows of an array | |||
|- | |||
| <code>⌕</code> || [[Find]] || Find the occurrence's of one array in another | |||
|- | |||
| <code>∊</code> || [[Member]] || Check if each row of one array exists in another | |||
|- | |||
| <code>⊗</code> || [[Index Of|Indexof]] || Find the first index of each row of one array in another | |||
|- | |||
| <code>⟔</code> || Coordinate || Find the first deep index of an array in another | |||
|} | |||
==== Iterating Modifiers ==== | |||
Iterate and apply a function to an array or arrays | |||
{| class="wikitable" | |||
|+ Table of Iterating Modifiers in Uiua | |||
! Glyph !! Name !! Type !! Definition | |||
|- | |||
| <code>∵</code> || [[Each]] || Monadic modifier || Apply a function to each element of an array or arrays. | |||
|- | |||
| <code>≡</code> || Rows || Monadic modifier || Apply a function to each row of an array or arrays. | |||
|- | |||
| <code>⊞</code> || [[Outer Product|Table]] || Monadic 2-argument modifier || Apply a function to each combination of rows of two arrays. | |||
|- | |||
| <code>⍚</code> || Inventory || Monadic modifier || Apply a function to each unboxed row of an array and re-box the results. | |||
|- | |||
| <code>⍥</code> || [[Repeat]] || Monadic modifier || Repeat a function a number of times | |||
|- | |||
| <code>⍢</code> || [[Do]] || Dyadic modifier || Repeat a function while a condition holds | |||
|} | |||
==== Aggregating Modifiers ==== | |||
Apply a function to aggregate an array | |||
{| class="wikitable" | |||
|+ Table of Aggregating Modifiers in Uiua | |||
! Glyph !! Name !! Definition | |||
|- | |||
| <code>/</code> || [[Reduce]] || Apply a reducing function to an array. | |||
For reducing with an initial value, see <code>∧ fold</code> | |||
|- | |||
| <code>∧</code> || Fold || Apply a function to aggregate arrays. | |||
|- | |||
| <code>\</code> || [[Scan]] || Reduce, but keep intermediate values | |||
|- | |||
| <code>⊕</code> || [[Group (BQN)|Group]] || Group elements of an array into buckets by index | |||
|- | |||
| <code>⊜</code> || [[Partition]] || Group sequential sections of an array | |||
|- | |||
| <code>◹</code> || Triangle || Apply a function to each shrinking row of an array | |||
|} | |||
==== Inversion Modifiers ==== | |||
Work with the inverses of functions | |||
{| class="wikitable" | |||
|+ Table of Inversion Modifiers in Uiua | |||
! Glyph !! Name !! Type !! Definition | |||
|- | |||
| <code>°</code> || [[Un]] || Monadic modifier || Invert the behavior of a function | |||
|- | |||
| <code>⍜</code> || [[Under]] || Dyadic modifier || Apply a function under another | |||
|} | |||
==== 🌎 Planet 🪐 ==== | |||
Advanced stack manipulation | |||
{| class="wikitable" | |||
|+ Table of Planet modifiers in Uiua | |||
! Glyph !! Name !! Type !! Definition | |||
|- | |||
| <code>∘</code> || [[Identity]] || Monadic function || Do nothing with one value | |||
|- | |||
| <code>⋅</code> || Gap || Monadic modifier || Discard the top stack value then call a function | |||
|- | |||
| <code>⊙</code> || Dip || Monadic modifier || Temporarily pop the top value off the stack and call a function | |||
|- | |||
| <code>∩</code> || Both || Monadic 2-argument modifier || Call a function on two sets of values | |||
|- | |||
| <code>⊃</code> || [[Fork]] || Dyadic modifier || Call two functions on the same values | |||
|- | |||
| <code>⊓</code> || Bracket || Dyadic modifier || Call two functions on two distinct sets of values | |||
|} | |||
==== Other Modifiers ==== | |||
{| class="wikitable" | |||
|+ Table of Other Modifiers in Uiua | |||
! Glyph !! Name !! Type !! Definition | |||
|- | |||
| <code>◇</code> || Content || Monadic Modifier || Unbox the arguments to a function before calling it | |||
|- | |||
| <code>⬚</code> || Fill || Dyadic Modifier || Set the fill value for a function | |||
|- | |||
| <code>⨬</code> || Switch || Dyadic modifier || Call the function at the given index | |||
|} | |||
== 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 | ||
* [https://www.arraycast.com/episodes/episode63-uiua Uiua, a Stack-based Array language] on the [[Array Cast]] | |||
* [https://www.uiua.org/docs Documentation] | |||
* [https://www.uiua.org/pad Interpreter] | |||
* [https://www.uiua.org/tutorial/basic Basic tutorial] | |||
{{APL dialects}}[[Category:Flat array languages]][[Category:Stack-based languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]][[Category:IR compilers]] | {{APL dialects}}[[Category:Flat array languages]][[Category:Stack-based languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]][[Category:IR compilers]] |
Latest revision as of 21:09, 28 August 2024
Uiua is a stack-based array language emphasizing tacit programming, designed by Kai Schmidt. Initially influenced strongly by BQN, Uiua has added original stack-based features and glyphs and moved to the boxed array model of SHARP APL and J. It also makes functions second-class rather than first-class to facilitate features that depend on the number of arguments functions take.
Overview
Uiua uses concatenative evaluation (a context-free grammar) with a right-to-left ordering as in Polish notation. The language supports tacit programming using stack manipulation primitives, and all complex functions must be defined this way as there is no explicit function form that allows local variables. Functions have a fixed number of input and output values, meaning the overloading of ambivalent functions is removed. Because of this, Uiua often splits APL primitives into two functions. Its primitives use Unicode glyphs including many not found in other languages. To avoid typing glyphs necessitating a keyboard layout containing these, each primitive can also be spelled using a name that consists of lowercase letters (user-defined names must have at least one uppercase letter). By default, the language formats source files when run to convert these names into the corresponding glyphs.
Like the SHARP APL family, Uiua supports only flat arrays with a homogeneous type, and has a dedicated box type for array nesting. However, arithmetic is pervasive as in the nested array model. Arithmetic also follows leading axis agreement, extended so that a length-1 axis is matched with an axis of any length by replicating along it (like the broadcasting system of Julia and NumPy). It supports character arithmetic as in BQN, as well as other primitives characteristic of BQN such as structural Under, Classify, and a Transpose that rotates the axes of its argument by one.
Primitives
Functions with unique glyphs
In Uiua, we can type in the name of the function or a part of it and when formatted, it will format the name to its corresponding Unicode Symbol, so that we don't have to use non-ASCII keyboards (or Alt-codes).
The tables below are based on Uiua version 0.12.0, with since-removed primitives taken out.
Stack
Work with the stack
Glyph | Name | Type | Definition |
---|---|---|---|
. |
Duplicate | Monadic 2-output function | Duplicate the top value on the stack |
, |
Over | Dyadic 3-output function | Duplicate the second-to-top value to the top of the stack |
: |
Flip | Dyadic 2-output function | Swap the top two values on the stack |
◌ |
Pop | Monadic 0-output function | Discard the top stack value |
⟜ |
On | Monadic modifier | Call a function but keep its top argument on top of the stack |
⤙ |
But | Monadic modifier | Call a function but keep its last argument on top of the stack |
⤚ |
With | Monadic modifier | Call a function but keep its top argument below the outputs on the stack |
⊸ |
By | Monadic modifier | Duplicate a function's last argument before calling it |
¨ |
Backward | Monadic modifier | Call a function with its arguments reversed |
? |
Stack | Noadic 0-output function | Debug print all stack values without popping them |
⸮ |
Trace | Monadic function | Debug print the top value on the stack without popping it |
Constants
Push a constant value onto the stack
Glyph | Name | Definition |
---|---|---|
η |
Eta | The number of radians in a quarter circle |
π |
Pi | The ratio of a circle's circumference to its diameter |
τ |
Tau | The ratio of a circle's circumference to its radius |
∞ |
Infinity | The biggest number |
Monadic Pervasive
Operate on every element in an array
Glyph | Name | Definition |
---|---|---|
¬ |
Not | Logical not |
± |
Sign | Numerical sign (1, ¯1, or 0) |
¯ |
Negate | Negate a number |
⌵ |
Absolute value | Get the absolute value of a number |
√ |
Sqrt | Take the square root of a number |
∿ |
Sine | Get the sine of a number |
⌊ |
Floor | Round to the nearest integer towards ¯∞
|
⌈ |
Ceiling | Round to the nearest integer towards ∞
|
⁅ |
Round | Round to the nearest integer |
Dyadic Pervasive
Operate on every pair of elements in two arrays
Glyph | Name | Definition | Formats from: |
---|---|---|---|
= |
Equals | Compare for equality | = |
≠ |
Not equals | Compare for inequality | != |
< |
Less than | Compare for less than | < |
> |
Greater than | Compare for greater than | > |
≤ |
Less or equal | Compare for less than or equal | <= |
≥ |
Greater or equal | Compare for greater than or equal | >= |
+ |
Add | Add values | + |
- |
Subtract | Subtract values | - |
× |
Multiply | Multiply values | * |
÷ |
Divide | Divide values | % |
◿ |
Modulus | Modulo values | mod |
ⁿ |
Power | Raise a value to a power | pow |
ₙ |
Logarithm | Get the based logarithm of a number | log |
↧ |
Minimum/Logical And | Take the minimum of two arrays (Can use for logical AND.) | min |
↥ |
Maximum/Logical Or | Take the maximum of two arrays (Can use for logical OR.) | max |
∠ |
Atangent | Take the arctangent of two numbers | atan |
ℂ |
Complex | Make a complex number from imaginary and real parts | com |
Monadic Array
Operate on a single array
Glyph | Name | Definition |
---|---|---|
⧻ |
Length | Get the number of rows in an array |
△ |
Shape | Get the dimensions of an array |
⇡ |
Range | Make an array of all natural numbers less than a number |
⊢ |
First | Get the first row of an array |
⇌ |
Reverse | Reverse the rows of an array |
♭ |
Deshape | Make an array 1-dimensional |
¤ |
Fix | Add a length-1 axis to an array |
⋯ |
Bits | Encode an array as bits (LSB-first) |
⍉ |
Transpose | Rotate the shape of an array |
⍏ |
Rise | Get the indices into an array if it were sorted ascending |
⍖ |
Fall | Get the indices into an array if it were sorted descending |
⊚ |
Where | Get indices where array values are not equal to zero |
⊛ |
Classify | Assign a unique index to each unique element in an array |
◴ |
Deduplicate | Remove duplicate elements from an array |
◰ |
Unique | Get a mask of the first occurrences of items in an array |
□ |
Box | Turn an array into a box |
Dyadic Array
Operate on two arrays
Glyph | Name | Definition |
---|---|---|
≍ |
Match | Check if two arrays are exactly the same |
⊟ |
Couple | Combine two arrays as rows of a new array |
⊂ |
Join | Append two arrays end-to-end |
⊏ |
Select | Select multiple rows from an array |
⊡ |
Pick | Index a row or elements from an array |
↯ |
Reshape | Change the shape of an array |
☇ |
Rerank | Change the rank of an array's rows |
↙ |
Take | Take the first n elements of an array |
↘ |
Drop | Drop the first n elements of an array |
↻ |
Rotate | Rotate the elements of an array by n |
⮌ |
Orient | Change the order of the axes of an array. |
◫ |
Windows | The n-wise windows of an array |
▽ |
Keep | Discard or copy some rows of an array |
⌕ |
Find | Find the occurrence's of one array in another |
∊ |
Member | Check if each row of one array exists in another |
⊗ |
Indexof | Find the first index of each row of one array in another |
⟔ |
Coordinate | Find the first deep index of an array in another |
Iterating Modifiers
Iterate and apply a function to an array or arrays
Glyph | Name | Type | Definition |
---|---|---|---|
∵ |
Each | Monadic modifier | Apply a function to each element of an array or arrays. |
≡ |
Rows | Monadic modifier | Apply a function to each row of an array or arrays. |
⊞ |
Table | Monadic 2-argument modifier | Apply a function to each combination of rows of two arrays. |
⍚ |
Inventory | Monadic modifier | Apply a function to each unboxed row of an array and re-box the results. |
⍥ |
Repeat | Monadic modifier | Repeat a function a number of times |
⍢ |
Do | Dyadic modifier | Repeat a function while a condition holds |
Aggregating Modifiers
Apply a function to aggregate an array
Glyph | Name | Definition |
---|---|---|
/ |
Reduce | Apply a reducing function to an array.
For reducing with an initial value, see |
∧ |
Fold | Apply a function to aggregate arrays. |
\ |
Scan | Reduce, but keep intermediate values |
⊕ |
Group | Group elements of an array into buckets by index |
⊜ |
Partition | Group sequential sections of an array |
◹ |
Triangle | Apply a function to each shrinking row of an array |
Inversion Modifiers
Work with the inverses of functions
Glyph | Name | Type | Definition |
---|---|---|---|
° |
Un | Monadic modifier | Invert the behavior of a function |
⍜ |
Under | Dyadic modifier | Apply a function under another |
🌎 Planet 🪐
Advanced stack manipulation
Glyph | Name | Type | Definition |
---|---|---|---|
∘ |
Identity | Monadic function | Do nothing with one value |
⋅ |
Gap | Monadic modifier | Discard the top stack value then call a function |
⊙ |
Dip | Monadic modifier | Temporarily pop the top value off the stack and call a function |
∩ |
Both | Monadic 2-argument modifier | Call a function on two sets of values |
⊃ |
Fork | Dyadic modifier | Call two functions on the same values |
⊓ |
Bracket | Dyadic modifier | Call two functions on two distinct sets of values |
Other Modifiers
Glyph | Name | Type | Definition |
---|---|---|---|
◇ |
Content | Monadic Modifier | Unbox the arguments to a function before calling it |
⬚ |
Fill | Dyadic Modifier | Set the fill value for a function |
⨬ |
Switch | Dyadic modifier | Call the function at the given index |
External links
- Uiua on the concatenative language wiki
- Uiua, a Stack-based Array language on the Array Cast
- Documentation
- Interpreter
- Basic tutorial
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo ∙ TinyAPL |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |