Uiua: Difference between revisions

Jump to navigation Jump to search
1,332 bytes added ,  28 January
no edit summary
(Various updates, and more description of overall primitive design)
No edit summary
Line 9: Line 9:
| developer                = Kai Schmidt
| developer                = Kai Schmidt
| latest release version  = 0.8.0 / 2024
| latest release version  = 0.8.0 / 2024
| implementation languages = [[wikipedia:Rust (programming language)|Rust]]
| 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 23: Line 23:


== Overview ==
== Overview ==
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|the need]] for 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.
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 the need]] for 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 [[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.
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.


== Primitives ==
== Primitives ==
=== Function ===
=== Function with unique glyph ===
In the web version of Uiua, we can type in the name of the function or a part of it and when run, the interpreter will format the name to Unicode Symbol, so that we don't need use of non-ASCII keyboards.
In the web version of Uiua, we can type in the name of the function or a part of it and when run, the interpreter will format the name to Unicode Symbol, so that we don't need use of non-ASCII keyboards.


All table below are based on Uiua version 0.8.0.
All table below are based on Uiua version 0.8.0-1/28/2024.
 
And <span style="color:black; background-color: yellow">yellow background text </span> mean that the glyph is deprecated and will be removed in a future version


==== Stack ====
==== Stack ====
Line 207: Line 209:
|-
|-
| <code>⊗</code> || [[Index Of|Indexof]] || Find the first index of each row of one array in another
| <code>⊗</code> || [[Index Of|Indexof]] || Find the first index of each row of one 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. This is the element-wise version of <code>≡ rows.</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>
|-
| <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>
|-
| <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>
|-
| <code>⍥</code> || [[Repeat]] || Monadic modifier || Repeat a function a number of times
|-
| <code>⍢</code> || [[Do]] || Dyadic modifier || Repeat a function while a condition holds
|}
|}


20

edits

Navigation menu