Uiua: Difference between revisions

Jump to navigation Jump to search
1,444 bytes added ,  21 June
Adding 0.12 primitive(Incomplete!)
(→‎Function with unique glyph: Cut Cross, since it's been removed)
(Adding 0.12 primitive(Incomplete!))
Line 5: Line 5:
| function styles          = stack-based [[tacit]]
| function styles          = stack-based [[tacit]]
| numeric types            = 64-bit float
| numeric types            = 64-bit float
| unicode support          = full
| Unicode support          = full
| released                = 2023
| released                = 2023
| developer                = Kai Schmidt
| developer                = Kai Schmidt
Line 27: Line 27:
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 == <!-- It unfinish, you can contribute to this. Just don't make any sh*t in here. -->
<!-- You can add Primitives with keywords, system primitives, tables for un, fill, and under, examples, things like string, char, sizzles, constants, labels, and more! Just, don't make this page some sh*t. I am not Kai Schmidt, nor a full-time programmer. I, Anh Duc is just a 4th-grade pupil in Vietnam and I am expanding this page just for hobby purposes and because I am a fan of Uiua. Again, do not mess this page to much. -->
=== Function with unique glyph ===
=== 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 the use of non-ASCII keyboards.


Tables below are based on Uiua version 0.8.0, with since-removed primitives taken out.
The tables below are based on Uiua version 0.12.0, with since-removed primitives taken out.


==== Stack ====
==== Stack ====
Line 166: Line 167:
| <code>◴</code> || [[Deduplicate]] || Remove duplicate elements from an array
| <code>◴</code> || [[Deduplicate]] || Remove duplicate elements from an array
|-
|-
| <code>◰</code> || [[Nub Sieve|Unique]] || Get a mask of first occurrences of items in 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
| <code>□</code> || [[Box]] || Turn an array into a box
Line 201: Line 202:
|-
|-
| <code>↻</code> || [[Rotate]] || Rotate the elements of an array by n
| <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> || [[Windows]] || The n-wise windows of an array
Line 221: Line 224:
This is the element-wise version of <code>≡ rows.</code>
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.
| <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> || Table || Monadic 2-argument modifier || Apply a function to each combination of rows of two arrays.
| <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> || Inventory || Monadic modifier || Apply a function to each unboxed row of an array and re-box the results.
For box arrays, this is equivalent to <code>≡⍜°□</code>.
|-
|-
| <code>⍥</code> || [[Repeat]] || Monadic modifier || Repeat a function a number of times
| <code>⍥</code> || [[Repeat]] || Monadic modifier || Repeat a function a number of times
Line 254: Line 260:
Expects as many arguments as its function takes.
Expects as many arguments as its function takes.
The function must take at least 1 more argument than it returns outputs.
The function must take at least 1 more argument than it returns outputs.
Arguments that are lower on the stack that will be used as accumulators.
Arguments that are lower on the stack will be used as accumulators.
Arguments that are higher on the stack will be iterated over.
Arguments that are higher on the stack will be iterated over.
The function will be repeatdely called with the rows of the iterated arrays followed by the accumulators.
The function will be repeatedly called with the rows of the iterated arrays followed by the accumulators.
On each iteration, the returned values will be used as the new accumulators.
The returned values will be used as the new accumulators on each iteration.
|-
|-
| <code>⊜</code> || [[Partition]] || Group sequential sections of an array
| <code>⊜</code> || [[Partition]] || Group sequential sections of an array
Line 265: Line 271:
The arrays must be the same <code>⧻ length.</code>
The arrays must be the same <code>⧻ length.</code>
The first array must be rank <code>1</code> and contain integers.
The first array must be rank <code>1</code> and contain integers.
Consecutive rows in the second array that line up with groups of the same key in the first array will be grouped together.
Consecutive rows in the second array that line up with groups of the same key in the first array will be grouped.
Keys <code>≤0</code> will be omitted.
Keys <code>≤0</code> will be omitted.
The function then processes each group in order. The result depends on what the function is.
The function then processes each group in order. The result depends on what the function is.
Line 311: Line 317:
|-
|-
| <code>⊓</code> || Bracket || Dyadic modifier || Call two functions on two distinct sets of values
| <code>⊓</code> || Bracket || Dyadic modifier || Call two functions on two distinct sets of values
|}
==== Other Modifier ====
{| 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
By default, some operations require that arrays' <code>△ shape</code> are in some way compatible.
<code>⬚ fill</code> allows you to specify a value that will be used to extend the shape of one or both of the operands to make an operation succeed.
The function is modified to take a fill value which will be used to fill in shapes.
|}
|}


== 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.arraycast.com/episodes/episode63-uiua Uiua, a Stack-based Array language] on the [[Array Cast]]
* [https://www.uiua.org/docs Doc] for the Documentation
* [https://www.uiua.org/docs Doc] for the Documentation
* [https://www.uiua.org Interpreter] for the interpreter
* [https://www.uiua.org Interpreter] for the interpreter
20

edits

Navigation menu