diff --git a/.gitignore b/.gitignore index 5222ff2f8..8f2394997 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ .vscode .idea /target -/docs -/site/blog/*.html site/dist /uiua-modules diff --git a/Cargo.toml b/Cargo.toml index a72ccc080..1875bedb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,3 +161,6 @@ members = ["site", "tests_ffi"] [profile.dev] incremental = true + +[profile.release] +opt-level = 'z' diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 000000000..d28c08aa7 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,43 @@ + + + + + + Uiua + + + + + + + \ No newline at end of file diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..f1fbd587d --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +www.uiua.org \ No newline at end of file diff --git a/docs/DejaVuSansMono.ttf b/docs/DejaVuSansMono.ttf new file mode 100644 index 000000000..22e14bf93 Binary files /dev/null and b/docs/DejaVuSansMono.ttf differ diff --git a/docs/Uiua386.ttf b/docs/Uiua386.ttf new file mode 100644 index 000000000..7925a3352 Binary files /dev/null and b/docs/Uiua386.ttf differ diff --git a/docs/assets/ooh-ee-ooh-ah.mp3 b/docs/assets/ooh-ee-ooh-ah.mp3 new file mode 100644 index 000000000..bb99dd47e Binary files /dev/null and b/docs/assets/ooh-ee-ooh-ah.mp3 differ diff --git a/docs/assets/uiua-crayon.jpg b/docs/assets/uiua-crayon.jpg new file mode 100644 index 000000000..4e6831dee Binary files /dev/null and b/docs/assets/uiua-crayon.jpg differ diff --git a/docs/assets/uiua-logo-pride.gif b/docs/assets/uiua-logo-pride.gif new file mode 100644 index 000000000..d84341e4c Binary files /dev/null and b/docs/assets/uiua-logo-pride.gif differ diff --git a/docs/assets/uiua-logo-pride.png b/docs/assets/uiua-logo-pride.png new file mode 100644 index 000000000..33df89ef8 Binary files /dev/null and b/docs/assets/uiua-logo-pride.png differ diff --git a/docs/assets/uiua-logo-scrambledine.png b/docs/assets/uiua-logo-scrambledine.png new file mode 100644 index 000000000..5437dce8d Binary files /dev/null and b/docs/assets/uiua-logo-scrambledine.png differ diff --git a/docs/assets/uiua-logo.gif b/docs/assets/uiua-logo.gif new file mode 100644 index 000000000..7021e2d0b Binary files /dev/null and b/docs/assets/uiua-logo.gif differ diff --git a/docs/assets/uiua-logo.png b/docs/assets/uiua-logo.png new file mode 100644 index 000000000..e9771bddc Binary files /dev/null and b/docs/assets/uiua-logo.png differ diff --git a/docs/assets/uiua-logo.svg b/docs/assets/uiua-logo.svg new file mode 100644 index 000000000..5b0725437 --- /dev/null +++ b/docs/assets/uiua-logo.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/assets/wee-wah.mp3 b/docs/assets/wee-wah.mp3 new file mode 100644 index 000000000..032870f76 Binary files /dev/null and b/docs/assets/wee-wah.mp3 differ diff --git a/docs/assets/wee-wuh.mp3 b/docs/assets/wee-wuh.mp3 new file mode 100644 index 000000000..d74651f3e Binary files /dev/null and b/docs/assets/wee-wuh.mp3 differ diff --git a/docs/assets/you-dont.png b/docs/assets/you-dont.png new file mode 100644 index 000000000..80141dbd5 Binary files /dev/null and b/docs/assets/you-dont.png differ diff --git a/docs/blog/second-class-functions-html.html b/docs/blog/second-class-functions-html.html new file mode 100644 index 000000000..f772a8292 --- /dev/null +++ b/docs/blog/second-class-functions-html.html @@ -0,0 +1,13 @@ + + + + +

Uiua

Blog Home

Why doesn't Uiua have first-class functions?

You can read this post with full editor features here.

2023-12-15


People often ask why Uiua doesn't have first-class functions. That is, functions that can be put on the stack and in arrays.

In the beginning, functions were normal array elements. Modifiers popped their functions from the stack like regular values. Functions could be put in arrays, and lists of functions even had some special uses. There was a ! call function which called the top function on the stack. Boxes were not even a dedicated type. They were just functions that took no arguments and returned a single value.

However, as Uiua's development continued, the language began to rely more and more on stack signatures being well-defined. This property catches errors early, enables some optimizations, and allows modifiers to behave differently depending on their function's siganture. That last point lets us avoid having multiple modifiers that work the same way but on different numbers of arguments. For example, Factor has the words bi, 2bi, 3bi, + + , 2tri, and 3tri. Uiua can express all of these and more with just + fork + .

Unfortunately, having first-class functions was at odds with this design. Because functions could be put into arrays and (conditionally) moved around on the stack, the compiler was not able to determine the signature of a function that called a function value. This meant that anywhere the ! call function was used needed a signature annotation nearby, which you better hope was correct, or the code would break somewhere else. It also incurred additional interpreter overhead to get the functions from arrays and made certain types of optimizations impossible.

Other than these design and implementation concerns, the ability to move functions around on the stack made code much harder to read when it was used. You had to keep in your mind not only the values, but the functions that worked on them as well. They were another value you had to deal with, and the related stack manipulation could get quite messy.

And so I settled on a different approach. Functions were removed as an element type and were put elsewhere in the interpreter. Boxes became a type in their own right. The ! call function was removed, and ! was repurposed to be part of defining custom modifiers. Custom modifiers capture the primary use case of first-class functions: injecting some variable code into a function. While they are technically more limited, their uniform structure makes them easier to both read and write. This change also massively simplified the interpreter, as well as the complexity of the language itself.

Despite the downgrading of functions to second-class status, it should be noted that I do like functional programming languages. I just don't think that first-class functions are a good fit for Uiua. In practice, first-class functions are mostly unnecessary if you have higher-order functions, which array languages have had for decades. APL's operators, J's adverbs and conjunctions, and BQN and Uiua's modifiers are all versions of higher-order functions. They allow the mapping, reduction, and general transformation of data in the same way that first-class functions do in other languages.

Now if only I could find a way to get rid of boxes...

\ No newline at end of file diff --git a/docs/blog/second-class-functions-text.md b/docs/blog/second-class-functions-text.md new file mode 100644 index 000000000..38a7f254a --- /dev/null +++ b/docs/blog/second-class-functions-text.md @@ -0,0 +1,21 @@ +# Why doesn't Uiua have first-class functions? + +2023-12-15 + +--- + +People often ask why Uiua doesn't have first-class functions. That is, functions that can be put on the stack and in arrays. + +In the beginning, functions *were* normal array elements. Modifiers popped their functions from the stack like regular values. Functions could be put in arrays, and lists of functions even had some special uses. There was a `! call` function which called the top function on the stack. Boxes were not even a dedicated type. They were just functions that took no arguments and returned a single value. + +However, as Uiua's development continued, the language began to rely more and more on stack signatures being well-defined. This property catches errors early, enables some optimizations, and allows modifiers to behave differently depending on their function's siganture. That last point lets us avoid having multiple modifiers that work the same way but on different numbers of arguments. For example, [Factor](https://factorcode.org/) has the words `bi`, `2bi`, `3bi`, `tri`, `2tri`, and `3tri`. Uiua can express all of these and more with just [fork](). + +Unfortunately, having first-class functions was at odds with this design. Because functions could be put into arrays and (conditionally) moved around on the stack, the compiler was not able to determine the signature of a function that called a function value. This meant that anywhere the `! call` function was used needed a signature annotation nearby, which you better hope was correct, or the code would break somewhere else. It also incurred additional interpreter overhead to get the functions from arrays and made certain types of optimizations impossible. + +Other than these design and implementation concerns, the ability to move functions around on the stack made code much harder to read when it was used. You had to keep in your mind not only the values, but the functions that worked on them as well. They were another value you had to deal with, and the related stack manipulation could get quite messy. + +And so I settled on a different approach. Functions were removed as an element type and were put elsewhere in the interpreter. Boxes became a type in their own right. The `! call` function was removed, and `!` was repurposed to be part of defining custom modifiers. [Custom modifiers](/docs/custommodifiers) capture the primary use case of first-class functions: injecting some variable code into a function. While they are technically more limited, their uniform structure makes them easier to both read and write. This change also massively simplified the interpreter, as well as the complexity of the language itself. + +Despite the downgrading of functions to second-class status, it should be noted that I do like functional programming languages. I just don't think that first-class functions are a good fit for Uiua. In practice, first-class functions are mostly unnecessary if you have higher-order functions, which array languages have had for decades. APL's operators, J's adverbs and conjunctions, and BQN and Uiua's modifiers are all versions of higher-order functions. They allow the mapping, reduction, and general transformation of data in the same way that first-class functions do in other languages. + +Now if only I could find a way to get rid of boxes... \ No newline at end of file diff --git a/docs/blog/uiua-0.10.0-html.html b/docs/blog/uiua-0.10.0-html.html new file mode 100644 index 000000000..3983afcde --- /dev/null +++ b/docs/blog/uiua-0.10.0-html.html @@ -0,0 +1,78 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.10.0

You can read this post with full editor features here.

2024-04-04


Uiua 0.10.0 is now available!

You can find the full changelog here.

This release contains so many changes, improvements, and new features that I thought it deserved a blog post.From here on, major releases will be announced in this way.

While there are many changes, I want to highlight a few of them here.

Pattern Matching

Using + ° un + on a constant value will now match a pattern. When used with + try + , this can be used to conditionally match, extract, and process values.

F ← ⍣( + ×10 °[1⊙3] # Extract and multiply.. +| °(⊂5) # ..or remove leading 5.. +| ⇌ # ..else reverse +) +F [1 2 3] +F [5 6 7] +F "cool!"

You can read more in the Pattern Matching tutorial.

Array Macros

Array macros are a powerful new feature that allow full compile-time metaprogramming.

They allow Uiua code to directly manipulate other Uiua code, enabling a wide range of new possibilities.

F! ←^ ≡$"_ ← _\n" "ABC" +F!(1|2|3) +[A B C B B] # [1 2 3 2 2]

You can read more in the updated Macros tutorial.

Git Modules

You can now prefix a module path with git: to import a git repository from a URL.

~ "git: github.com/uiua-lang/example-module" ~ Upscale +Upscale 3 [1_2 3_4]

In the native interpreter, this automatically creates a Git submodule.

On the web, it fetches a lib.ua file from the repository.

You can read more in the updated Modules tutorial.

+ mask +

+ mask + is a new function that is similar to + find + , but it returns full masks of matches rather than just the first positions.

⦷ " - " "Hey - how-are - you" # [0 0 0 1 1 1 0 0 0 0 0 0 0 2 2 2 0 0 0 0]⊜□¬⦷⊙. " - " "Hey - how-are - you" # {"Hey" "how-are" " you"}

This simplifies a lot of string-processing code in particular. A new strings tutorial has been added as well.

Other Changes

Switch functions now format to use ⟨⟩ brackets. This makes them easier to distinguish from function packs.

F ← (×10|↥2)<2. # This..# 1:5: Function packs are not allowed without a modifier +F ← ⟨×10|↥2⟩<2. # Formats to this +F 0 # 2 +F 5 # 50

+ map + and related functions are no longer experimental! See the + map + docs for an overview.

map 1_2_3 4_5_6 + +# ╭─ +# 1 → 4 +# 2 → 5 +# 3 → 6 +# ╯

The new + &clget + and + &clset + functions provide access to the clipboard.

The interpreter's built-in language server now supports many more features.

There are a ton more! Again, you can read the full changelog here.

💖

As always, I'd like to thank everyone who contributed to this release, whether by directly contributing code, reporting bugs, or just using Uiua and providing feedback.

Uiua is in many ways a novel and unique language, and I think it is only through our collective effort that we can properly explore its design space.

With your help, I hope to continue to improve Uiua to the point of stability.

\ No newline at end of file diff --git a/docs/blog/uiua-0.10.0-text.md b/docs/blog/uiua-0.10.0-text.md new file mode 100644 index 000000000..20fd84311 --- /dev/null +++ b/docs/blog/uiua-0.10.0-text.md @@ -0,0 +1,99 @@ +# Announcing Uiua 0.10.0 + +2024-04-04 + +--- + +Uiua 0.10.0 is now available! + +You can find the full changelog [here](https://uiua.org/docs/changelog#0.10.0---2024-04-04). + +This release contains so many changes, improvements, and new features that I thought it deserved a blog post. +From here on, major releases will be announced in this way. + +While there are many changes, I want to highlight a few of them here. + +## Pattern Matching + +Using [`un`](https://uiua.org/docs/un) on a constant value will now match a pattern. When used with [`try`](https://uiua.org/docs/try), this can be used to conditionally match, extract, and process values. + +```uiua +F ← ⍣( + ×10 °[1⊙3] # Extract and multiply.. +| °(⊂5) # ..or remove leading 5.. +| ⇌ # ..else reverse +) +F [1 2 3] +F [5 6 7] +F "cool!" +``` +You can read more in the [Pattern Matching](https://uiua.org/tutorial/patternmatching) tutorial. + +## Array Macros + +Array macros are a powerful new feature that allow full compile-time metaprogramming. + +They allow Uiua code to directly manipulate other Uiua code, enabling a wide range of new possibilities. + +```uiua +F! ←^ ≡$"_ ← _\n" "ABC" +F!(1|2|3) +[A B C B B] +``` + +You can read more in the updated [Macros](https://uiua.org/tutorial/macros) tutorial. + +## Git Modules + +You can now prefix a module path with `git:` to import a git repository from a URL. +```uiua +~ "git: github.com/uiua-lang/example-module" ~ Upscale +Upscale 3 [1_2 3_4] +``` +In the native interpreter, this automatically creates a Git submodule. + +On the web, it fetches a `lib.ua` file from the repository. + +You can read more in the updated [Modules](https://uiua.org/tutorial/modules) tutorial. + +## [`mask`](https://uiua.org/docs/mask) + +[`mask`](https://uiua.org/docs/mask) is a new function that is similar to [`find`](https://uiua.org/docs/find), but it returns full masks of matches rather than just the first positions. + +```uiua +⦷ " - " "Hey - how-are - you" +``` +```uiua +⊜□¬⦷⊙. " - " "Hey - how-are - you" +``` + +This simplifies a lot of string-processing code in particular. A new [strings](https://uiua.org/tutorial/strings) tutorial has been added as well. + +## Other Changes + +Switch functions now format to use `⟨⟩` brackets. This makes them easier to distinguish from function packs. +```uiua +F ← (×10|↥2)<2. # This.. +F ← ⟨×10|↥2⟩<2. # Formats to this +F 0 +F 5 +``` + +[`map`](https://uiua.org/docs/map) and related functions are no longer experimental! See the [`map`](https://uiua.org/docs/map) docs for an overview. +```uiua +map 1_2_3 4_5_6 +``` + +The new [`&clget`](https://uiua.org/docs/&clget) and [`&clset`](https://uiua.org/docs/&clset) functions provide access to the clipboard. + +The interpreter's built-in language server now supports [many more features](https://marketplace.visualstudio.com/items?itemName=uiua-lang.uiua-vscode). + +There are a ton more! Again, you can read the full changelog [here](https://uiua.org/docs/changelog#0.10.0---2024-04-04). + +## 💖 + +As always, I'd like to thank everyone who contributed to this release, whether by directly contributing code, reporting bugs, or just using Uiua and providing feedback. + +Uiua is in many ways a novel and unique language, and I think it is only through our collective effort that we can properly explore its design space. + +With your help, I hope to continue to improve Uiua to the point of stability. \ No newline at end of file diff --git a/docs/blog/uiua-0.11.0-html.html b/docs/blog/uiua-0.11.0-html.html new file mode 100644 index 000000000..c36940de8 --- /dev/null +++ b/docs/blog/uiua-0.11.0-html.html @@ -0,0 +1,197 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.11.0

You can read this post with full editor features here.

2024-06-02


Uiua 0.11.0 is now available!

You can find the full changelog here.

Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code.

While this release does not have any major new features, it extends the functionality of many primitives, optimizes many common patterns, and fixes a number of bugs.

Here are some of the highlights:

Multi-argument + / reduce +

+ / reduce + takes a dyadic function and applies it "between" all rows of an array.

/+ [1 2 3 4 5] # 15

+ / reduce + can now take multiple arguments if its function takes more than two arguments. Additional arguments are interspersed between the rows and are passed above the main array on the stack.

/(⊂⊂) 0 [1 2 3 4] # [1 0 2 0 3 0 4]

This is particularly useful when used with + content + and + join + to intersperse a delimiter between a list of strings.

/◇(⊂⊂) @, {"cat" "dog" "bird" "fish"} # "cat,dog,bird,fish"

+ json + and + xlsx +

The + json + and + xlsx + functions allow the encoding and decoding of JSON and XLSX data respectively.

+ json + converts an array to a JSON string.

json [1 2 3 4] # "[1,2,3,4]"

It works with + map + s as well.

json map {"name" "age"} {"Dan" 31} # "{"age":31,"name":"Dan"}"

+ ° un + + json + decodes a JSON string.

°json $ {"type": "requires", "content": "json", "ids": [38, 22, 5]} + +# ╭─ +# ⌜content⌟ → ⌜json⌟ +# ⌜ids⌟ → ⟦38 22 5⟧ +# ⌜type⌟ → ⌜requires⌟ +# ╯

+ xlsx + is similar, but is works with binary data rather than strings.

+ take + / + drop + + infinity +

+ take + and + drop + isolate part of an array.

↙ 3 [1 2 3 4 5] # [1 2 3] +↘ 3 [1 2 3 4 5] # [4 5]

Multidimensional indices have always been supported.

↙2_2 . ↯3_4⇡12 + +# ╭─ +# ╷ 0 1 2 3 +# 4 5 6 7 +# 8 9 10 11 +# ╯ +# ╭─ +# ╷ 0 1 +# 4 5 +# ╯

You can now provide + infinity + as one or more of the indices to + take + or + drop + that entire axis.

↙∞_2 . ↯3_4⇡12 + +# ╭─ +# ╷ 0 1 2 3 +# 4 5 6 7 +# 8 9 10 11 +# ╯ +# ╭─ +# ╷ 0 1 +# 4 5 +# 8 9 +# ╯↙1_∞_2 . ↯2_3_4⇡24 + +# ╭─ +# ╷ 0 1 2 3 +# ╷ 4 5 6 7 +# 8 9 10 11 +# +# 12 13 14 15 +# 16 17 18 19 +# 20 21 22 23 +# ╯ +# ╭─ +# ╷ 0 1 +# ╷ 4 5 +# 8 9 +# ╯

Swizzles

Swizzles are a new experimental feature that allow concise manipulation of the stack and extraction from arrays.

Stack swizzles are written with a λ followed by some letters. The stack will be rearranged accordingly. λ formats from ' when followed by letters.

# Experimental! +[λccab 1 2 3] # [3 3 1 2]

Capital letters will + ¤ fix + the corresponding array. This is useful with complex + rows + operations.

# Experimental! +≡(⊂⊂) ? λaBC 1_2 3_4 5_6 + +# ╭─ +# ╷ 1 3 4 5 6 +# 2 3 4 5 6 +# ╯

Array swizzles are written with a followed by some letters. Rows from the array that correspond to the letters will be put on the stack. formats from '' when followed by letters.

# Experimental! +⋊beef [1 2 3 4 5 6] # 2 5 5 6

Capital letters will + ° un + + box + the corresponding row.

# Experimental! +⋊aCB {"Dave" 31 [38 22 5]} # ⌜Dave⌟ [38 22 5] 31

Swizzles are experimental and may change in future versions as their place in the language is explored.

The New Pad

Much of the code for the Uiua website pad has been rewritten. This new pad uses less custom behavior and should work better in more browsers.

If you are reading this on the Uiua website (with full editor features), then all the examples above use this new pad!

💗

Thank you as always to everyone who uses Uiua and helps with its development! Your enthusiasm for the language gives me life.

A special thanks to all of Uiua's sponsors for their continued support 🥰

Again, you can find the full changelog for this release here.

You can join the Uiua Discord to chat about the language, ask questions, or get help.

\ No newline at end of file diff --git a/docs/blog/uiua-0.11.0-text.md b/docs/blog/uiua-0.11.0-text.md new file mode 100644 index 000000000..fe8cbf1de --- /dev/null +++ b/docs/blog/uiua-0.11.0-text.md @@ -0,0 +1,134 @@ +# Announcing Uiua 0.11.0 + +2024-06-02 + +--- + +Uiua 0.11.0 is now available! + +You can find the full changelog [here](https://uiua.org/docs/changelog#0.11.0---2024-06-02). + +Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code. + +While this release does not have any major new features, it extends the functionality of many primitives, optimizes many common patterns, and fixes a number of bugs. + +Here are some of the highlights: + +## Multi-argument [`reduce /`](https://uiua.org/docs/reduce) + +[`reduce /`](https://uiua.org/docs/reduce) takes a dyadic function and applies it "between" all rows of an array. + +```uiua +/+ [1 2 3 4 5] +``` + +[`reduce /`](https://uiua.org/docs/reduce) can now take multiple arguments if its function takes more than two arguments. Additional arguments are interspersed between the rows and are passed above the main array on the stack. + +```uiua +/(⊂⊂) 0 [1 2 3 4] +``` + +This is particularly useful when used with [`content ◇`](https://uiua.org/docs/content) and [`join ⊂`](https://uiua.org/docs/join) to intersperse a delimiter between a list of strings. + +```uiua +/◇(⊂⊂) @, {"cat" "dog" "bird" "fish"} +``` + +## [`json`](https://uiua.org/docs/json) and [`xlsx`](https://uiua.org/docs/xlsx) + +The [`json`](https://uiua.org/docs/json) and [`xlsx`](https://uiua.org/docs/xlsx) functions allow the encoding and decoding of JSON and XLSX data respectively. + +`json` converts an array to a JSON string. + +```uiua +json [1 2 3 4] +``` + +It works with `map`s as well. + +```uiua +json map {"name" "age"} {"Dan" 31} +``` + +[`un °`](https://uiua.org/docs/un) `json` decodes a JSON string. + +```uiua +°json $ {"type": "requires", "content": "json", "ids": [38, 22, 5]} +``` + +`xlsx` is similar, but is works with binary data rather than strings. + +## [`take ↙`](https://uiua.org/docs/take)/[`drop ↘`](https://uiua.org/docs/drop) [`infinity ∞`](https://uiua.org/docs/infinity) + +[`take ↙`](https://uiua.org/docs/take) and [`drop ↘`](https://uiua.org/docs/drop) isolate part of an array. + +```uiua +↙ 3 [1 2 3 4 5] +↘ 3 [1 2 3 4 5] +``` + +Multidimensional indices have always been supported. + +```uiua +↙2_2 . ↯3_4⇡12 +``` + +You can now provide [`infinity ∞`](https://uiua.org/docs/infinity) as one or more of the indices to [`take ↙`](https://uiua.org/docs/take) or [`drop ↘`](https://uiua.org/docs/drop) that entire axis. + +```uiua +↙∞_2 . ↯3_4⇡12 +``` +``` uiua +↙1_∞_2 . ↯2_3_4⇡24 +``` + +## Swizzles + +Swizzles are a new experimental feature that allow concise manipulation of the stack and extraction from arrays. + +Stack swizzles are written with a `λ` followed by some letters. The stack will be rearranged accordingly. `λ` formats from `'` when followed by letters. + +```uiua +# Experimental! +[λccab 1 2 3] +``` + +Capital letters will [`fix ¤`](https://uiua.org/docs/fix) the corresponding array. This is useful with complex [`rows ≡`](https://uiua.org/docs/rows) operations. + +```uiua +# Experimental! +≡(⊂⊂) ? λaBC 1_2 3_4 5_6 +``` + +*Array* swizzles are written with a `⋊` followed by some letters. Rows from the array that correspond to the letters will be put on the stack. `⋊` formats from `''` when followed by letters. + +```uiua +# Experimental! +⋊beef [1 2 3 4 5 6] +``` + +Capital letters will [`un °`](https://uiua.org/docs/un) [`box ◻`](https://uiua.org/docs/box) the corresponding row. + +```uiua +# Experimental! +⋊aCB {"Dave" 31 [38 22 5]} +``` + +Swizzles are experimental and may change in future versions as their place in the language is explored. + +## The New Pad + +Much of the code for the [Uiua website pad](https://uiua.org/pad) has been rewritten. This new pad uses less custom behavior and should work better in more browsers. + +If you are reading this on the Uiua website (with full editor features), then all the examples above use this new pad! + +## 💗 + +Thank you as always to everyone who uses Uiua and helps with its development! Your enthusiasm for the language gives me life. + +A *special* thanks to all of [Uiua's sponsors](https://github.com/sponsors/uiua-lang) for their continued support 🥰 + +Again, you can find the full changelog for this release [here](https://uiua.org/docs/changelog#0.11.0---2024-06-02). + +You can join the [Uiua Discord](https://discord.gg/3r9nrfYhCc) to chat about the language, ask questions, or get help. + diff --git a/docs/blog/uiua-0.12.0-html.html b/docs/blog/uiua-0.12.0-html.html new file mode 100644 index 000000000..f4931ec4e --- /dev/null +++ b/docs/blog/uiua-0.12.0-html.html @@ -0,0 +1,297 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.12.0

You can read this post with full editor features here.

2024-08-16


Uiua 0.12.0 is now available!

You can find the full changelog here.

Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code.

This is a pretty big release! In addition to stable features, it contains a lot of experimental features to try out.

Here are some of the highlights:

New Tutorials

There are two new tutorials on the site:

Scoped Modules

Modules can now be declared without needing a new file.

This is done with ---s and a name.A ~ following the name lets you export names from within into the outer scope.

---MyMod ~ Go + Foo ← 5 + Go ← +1 +--- +Go MyMod~Foo

A module containing a function called Call or New can be called as a function.

---Foo + Call ← /++1⇡ +--- +Foo 5

Using a module name as a macro (with a ! at the end of the name) will make the module's names available inside that scope.

---Foo + A ← 10 + F ← +1 + G ← ×2 +--- +Foo!(G F ×A) [1 2 3]

+ switch +

Dedicated switch function syntax has been replaced with the + switch + modifier.

In addition, it has been expanded to do an implicit + rows + .

⨬(∘|+1|×2) [0 1 2] 5 # [5 6 10]

Existing ⟨⟩s will continue to parse and will format to + switch + with a function pack.

Subscript digits in identifiers

Unlike most programming languages, Uiua identifiers cannot contain digits.

But sometimes you want digits in your names! You can now use subscript digits in identifiers.

These format from a double underscore __ followed by some digits.

Sha__256 ← "todo" # This +Sha₂₅₆ ← "todo" # Formats to this

New Primitive Functionality

Several primitive functions have new functionality

+ ° un + + shape + now generates a + range + array with the given shape.

°△ 2_3_4 + +# ╭─ +# ╷ 0 1 2 3 +# ╷ 4 5 6 7 +# 8 9 10 11 +# +# 12 13 14 15 +# 16 17 18 19 +# 20 21 22 23 +# ╯

+ couple + and + join + are now more permissive of arguments with different ranks. The array with a smaller rank will be repeated.

⊟ 1_2_3 4 + +# ╭─ +# ╷ 1 2 3 +# 4 4 4 +# ╯⊂ [1_2_3 4_5_6] 7 + +# ╭─ +# ╷ 1 2 3 +# 4 5 6 +# 7 7 7 +# ╯

+ keep + will now cycle the counts array.

▽ 0_1_2 [1 2 3 4 5 6] # [2 3 3 5 6 6]

+ keep + also now allows a scalar non-integer to scale an array. This is useful for image and audio arrays.

▽ 0.5 [1 2 3 4 5 6] # [1 3 5] +▽ 1.5 [1 2 3 4 5 6] # [1 1 2 3 3 4 5 5 6]

+ memberof +

+ member + is now deprecated. It was almost always used along with + : flip + .

It has been replaced with + memberof + , which has the exact same functionality, except its arguments are flipped.

F ← ∈"abc" +F "beefcake" # [1 0 0 0 1 1 0 0]

This makes it work nicely with + by + !

⊜□¬⊸∈ " ," "To be, or not" # {"To" "be" "or" "not"}

Experimental Features

This release adds a lot of experimental features to try out.

While it's unlikely that all of these will be eventually stabilized, they are made available for you to try out and see how they feel.

You can view to full list of experimental features here, but here are a few highlights:

More Stack Modifiers

The + but + and + with + modifiers are complements to + on + and + by + .

+ but + keeps its function's last argument on top of the stack while + with + keeps its function's first argument below the outputs on the stack.

# Experimental! +[⤙+ 2 5] # [5 7] +[⤚+ 2 5] # [7 2]

The + above + and + below + modifiers keep all of a function's arguments above or below the outputs on the stack.

# Experimental! +[◠(++) 1 2 3] # [1 2 3 6] +[◡(++) 1 2 3] # [6 1 2 3]

+ chunks + is similar to + windows + except the parts of the array do not overlap.

# Experimental! +⑄ 2_3 °△ 4_9 + +# ╭─ +# ╷ 0 1 2 +# ╷ 9 10 11 +# ╷ +# 3 4 5 +# 12 13 14 +# +# 6 7 8 +# 15 16 17 +# +# +# 18 19 20 +# 27 28 29 +# +# 21 22 23 +# 30 31 32 +# +# 24 25 26 +# 33 34 35 +# ╯ +≡≡□ + +# ╭─ +# ╷ ╓─ ╓─ ╓─ +# ╟ 0 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 +# ╜ ╜ ╜ +# ╯

+ orient + transposes an array's axes by moving the axes at the given indices to the front of the + shape + .

This simplifies complex shape transformations that would otherwise be done with several + transpose + s and + rows + s.

# Experimental! +°△ 2_3_4_5 + +# ╭─ +# ╷ 0 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 103 104 +# 105 106 107 108 109 +# 110 111 112 113 114 +# 115 116 117 118 119 +# ╯ +△ ⤸ 1_3 # [3 5 2 4]

💖

As always, a heartfelt thank-you to everyone in the Uiua community! Your contributions are what make Uiua great.

If you want to support Uiua's development, you can become one of its excellent sponsors!

Again, you can find the full changelog for this release here.

You can join the Uiua Discord to chat about the language, ask questions, or get help.

Media Constants

A final fun note!

A few built-in image and audio constants have been added. These are useful for testing and demonstrating image and audio functions!

Logo +Lena +▽⟜≡▽ 0.5 # Scales the image down +Music
\ No newline at end of file diff --git a/docs/blog/uiua-0.12.0-text.md b/docs/blog/uiua-0.12.0-text.md new file mode 100644 index 000000000..14d478c11 --- /dev/null +++ b/docs/blog/uiua-0.12.0-text.md @@ -0,0 +1,198 @@ +# Announcing Uiua 0.12.0 + +2024-08-16 + +--- + +Uiua 0.12.0 is now available! + +You can find the full changelog [here](https://uiua.org/docs/changelog#0.12.0---2024-08-16). + +Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code. + +This is a pretty big release! In addition to stable features, it contains a lot of experimental features to try out. + +Here are some of the highlights: + +## New Tutorials + +There are two new tutorials on the site: +- [Tacit Code](https://uiua.org/tutorial/tacitcode) +- [Code Tactility](https://uiua.org/tutorial/codetactility) + +## Scoped Modules + +Modules can now be declared without needing a new file. + +This is done with `---`s and a name. +A `~` following the name lets you export names from within into the outer scope. + +```uiua +---MyMod ~ Go + Foo ← 5 + Go ← +1 +--- +Go MyMod~Foo +``` + +A module containing a function called `Call` or `New` can be called as a function. + +```uiua +---Foo + Call ← /++1⇡ +--- +Foo 5 +``` + +Using a module name as a macro (with a `!` at the end of the name) will make the module's names available inside that scope. + +```uiua +---Foo + A ← 10 + F ← +1 + G ← ×2 +--- +Foo!(G F ×A) [1 2 3] +``` + +## [`switch ⨬`]() + +Dedicated switch function syntax has been replaced with the [`switch ⨬`]() modifier. + +In addition, it has been expanded to do an implicit [`rows ≡`](). + +```uiua +⨬(∘|+1|×2) [0 1 2] 5 +``` + +Existing `⟨⟩`s will continue to parse and will format to [`switch ⨬`]() with a function pack. + +## Subscript digits in identifiers + +Unlike most programming languages, Uiua identifiers cannot contain digits. + +But sometimes you want digits in your names! You can now use *subscript* digits in identifiers. + +These format from a double underscore `__` followed by some digits. + +```uiua +Sha__256 ← "todo" # This +Sha₂₅₆ ← "todo" # Formats to this +``` + +## New Primitive Functionality + +Several primitive functions have new functionality + +[`un °`]() [`shape △`]() now generates a [`range ⇡`]() array with the given shape. + +```uiua +°△ 2_3_4 +``` + +[`couple ⊟`]() and [`join ⊂`]() are now more permissive of arguments with different ranks. The array with a smaller rank will be repeated. + +```uiua +⊟ 1_2_3 4 +``` +```uiua +⊂ [1_2_3 4_5_6] 7 +``` + +[`keep ▽`]() will now cycle the counts array. + +```uiua +▽ 0_1_2 [1 2 3 4 5 6] +``` + +[`keep ▽`]() also now allows a scalar non-integer to scale an array. This is useful for image and audio arrays. + +```uiua +▽ 0.5 [1 2 3 4 5 6] +▽ 1.5 [1 2 3 4 5 6] +``` +## [`memberof ∈`]() + +[`member ∊`]() is now deprecated. It was almost always used along with [`flip :`](). + +It has been replaced with [`memberof ∈`](), which has the exact same functionality, except its arguments are flipped. + +```uiua +F ← ∈"abc" +F "beefcake" +``` + +This makes it work nicely with [`by ⊸`]()! + +```uiua +⊜□¬⊸∈ " ," "To be, or not" +``` + +## Experimental Features + +This release adds a *lot* of experimental features to try out. + +While it's unlikely that all of these will be eventually stabilized, they are made available for you to try out and see how they feel. + +You can view to full list of experimental features [here](https://uiua.org/docs/experimental), but here are a few highlights: + +### More Stack Modifiers + +The [`but ⤙`]() and [`with ⤚`]() modifiers are complements to [`on ⟜`]() and [`by ⊸`](). + +[`but ⤙`]() keeps its function's *last* argument on *top* of the stack while [`with ⤚`]() keeps its function's *first* argument *below* the outputs on the stack. + +```uiua +# Experimental! +[⤙+ 2 5] +[⤚+ 2 5] +``` + +The [`above ◠`]() and [`below ◡`]() modifiers keep *all* of a function's arguments above or below the outputs on the stack. + +```uiua +# Experimental! +[◠(++) 1 2 3] +[◡(++) 1 2 3] +``` + +[`chunks ⑄`]() is similar to [`windows ◫`]() except the parts of the array do not overlap. + +```uiua +# Experimental! +⑄ 2_3 °△ 4_9 +≡≡□ +``` + +[`orient ⤸`]() transposes an array's axes by moving the axes at the given indices to the front of the [`shape △`](). + +This simplifies complex shape transformations that would otherwise be done with several [`transpose ⍉`]()s and [`rows ≡`]()s. + +```uiua +# Experimental! +°△ 2_3_4_5 +△ ⤸ 1_3 +``` + +## 💖 + +As always, a heartfelt thank-you to everyone in the Uiua community! Your contributions are what make Uiua great. + +If you want to support Uiua's development, you can become one of its excellent [sponsors](https://github.com/sponsors/uiua-lang)! + +Again, you can find the full changelog for this release [here](https://uiua.org/docs/changelog#0.12.0---2024-08-16). + +You can join the [Uiua Discord](https://discord.gg/3r9nrfYhCc) to chat about the language, ask questions, or get help. + +## Media Constants + +A final fun note! + +A few built-in image and audio constants have been added. These are useful for testing and demonstrating image and audio functions! + +```uiua +Logo +Lena +▽⟜≡▽ 0.5 # Scales the image down +Music +``` diff --git a/docs/blog/what-will-1-look-like-html.html b/docs/blog/what-will-1-look-like-html.html new file mode 100644 index 000000000..8d1db4a8e --- /dev/null +++ b/docs/blog/what-will-1-look-like-html.html @@ -0,0 +1,5 @@ + + + + +

Uiua

Blog Home

What will Uiua 1.0 look like?

You can read this post with full editor features here.

2024-01-19


The Uiua pad page prominently displays the words "Uiua is not yet stable". And so it has been asked: when will Uiua be stable? What features will it have? Is there a roadmap?

This post is to organize and present my thoughts on the future of Uiua.

Stability

Uiua will be made officially stable only after it has been unofficially stable for some time. That is, not until no breaking changes have been made for a long time.

The following language features will need to be nailed down before Uiua can ever be stable.

Stack manipulation

I think working with the stack, at least for up to 3 values, has become mostly pretty nice. However, things start to get complicated when working with more values, as is often necessary. There is some design work to be done here, and it's not out of the question that a very small amount of non-tacitness could be introduced to improve this.

The experimental bind modifier is a potential solution to this problem.

There is a balance to be struc between Uiua's goal of tacitness and its goal of being ergonomic. While the beauty of fully tacit code is a worthy goal, some problems involve data flows that are inherently complex, and so some kind of labeling system may be necessary to make such problems workable.

Box Ergonomics

While I've explored alternatives, I've come to the conclusion that nested arrays are a necessary pest. The data we work with is often nested or ragged, and while there are ways to represent such data with flat structures, those representations are cumbersome in their own ways.

And so boxes are likely here to stay. However, I do think some design work can be done to improve their ergonomics. Currently, Uiua's boxes are very similar to J's, but I think it may be worth it to make their usage a bit more implicit in some cases, closer to the nested arrays of APL or BQN.

System APIs

The current system functions are useful and mostly work. There are definitely implementation gaps which need to be filled. There are a good number of missing filesystem operations, and some other things like UDP sockets and proper interaction with child processes still need to be implemented.

FFI

An FFI system similar to BQN's is planned. This will allow Uiua to call into C libraries and will enable a lot more functionality.

\ No newline at end of file diff --git a/docs/blog/what-will-1-look-like-text.md b/docs/blog/what-will-1-look-like-text.md new file mode 100644 index 000000000..3e285a0af --- /dev/null +++ b/docs/blog/what-will-1-look-like-text.md @@ -0,0 +1,37 @@ +# What will Uiua 1.0 look like? + +2024-01-19 + +--- + +The [Uiua pad](https://uiua.org/pad) page prominently displays the words "Uiua is not yet stable". And so it has been asked: when will Uiua be stable? What features will it have? Is there a roadmap? + +This post is to organize and present my thoughts on the future of Uiua. + +## Stability + +Uiua will be made officially stable only after it has been unofficially stable for some time. That is, not until no breaking changes have been made for a long time. + +The following language features will need to be nailed down before Uiua can ever be stable. + +### Stack manipulation + +I think working with the stack, at least for up to 3 values, has become mostly pretty nice. However, things start to get complicated when working with more values, as is often necessary. There is some design work to be done here, and it's not out of the question that a very small amount of non-tacitness could be introduced to improve this. + +The experimental [`bind`](https://uiua.org/docs/experimental#swizzles) modifier is a potential solution to this problem. + +There is a balance to be struc between Uiua's goal of tacitness and its goal of being ergonomic. While the beauty of fully tacit code is a worthy goal, some problems involve data flows that are inherently complex, and so some kind of labeling system may be necessary to make such problems workable. + +### Box Ergonomics + +While I've explored alternatives, I've come to the conclusion that nested arrays are a necessary pest. The data we work with is often nested or ragged, and while there are ways to represent such data with flat structures, those representations are cumbersome in their own ways. + +And so boxes are likely here to stay. However, I do think some design work can be done to improve their ergonomics. Currently, Uiua's boxes are very similar to J's, but I think it may be worth it to make their usage a bit more implicit in some cases, closer to the nested arrays of APL or BQN. + +### System APIs + +The current [system functions](https://uiua.org/docs/system) are useful and *mostly* work. There are definitely implementation gaps which need to be filled. There are a good number of missing filesystem operations, and some other things like UDP sockets and proper interaction with child processes still need to be implemented. + +### FFI + +An FFI system similar to [BQN's](https://mlochbaum.github.io/BQN/spec/system.html#foreign-function-interface) is planned. This will allow Uiua to call into C libraries and will enable a lot more functionality. \ No newline at end of file diff --git a/docs/combinators/B.svg b/docs/combinators/B.svg new file mode 100644 index 000000000..d0141a4a7 --- /dev/null +++ b/docs/combinators/B.svg @@ -0,0 +1,18 @@ + + + F + G + a + + + diff --git a/docs/combinators/B1.svg b/docs/combinators/B1.svg new file mode 100644 index 000000000..8d3f486a1 --- /dev/null +++ b/docs/combinators/B1.svg @@ -0,0 +1,20 @@ + + + F + G + a + b + + + + diff --git a/docs/combinators/C.svg b/docs/combinators/C.svg new file mode 100644 index 000000000..f46334fbd --- /dev/null +++ b/docs/combinators/C.svg @@ -0,0 +1,18 @@ + + + F + a + b + + + diff --git a/docs/combinators/D.svg b/docs/combinators/D.svg new file mode 100644 index 000000000..c2fe4eac6 --- /dev/null +++ b/docs/combinators/D.svg @@ -0,0 +1,20 @@ + + + F + G + a + b + + + + diff --git a/docs/combinators/D2.svg b/docs/combinators/D2.svg new file mode 100644 index 000000000..fe50b09b8 --- /dev/null +++ b/docs/combinators/D2.svg @@ -0,0 +1,22 @@ + + + F + G + H + a + b + + + + + diff --git a/docs/combinators/E.svg b/docs/combinators/E.svg new file mode 100644 index 000000000..5c3a8cffd --- /dev/null +++ b/docs/combinators/E.svg @@ -0,0 +1,22 @@ + + + F + G + a + b + c + + + + + diff --git a/docs/combinators/I.svg b/docs/combinators/I.svg new file mode 100644 index 000000000..80d52f060 --- /dev/null +++ b/docs/combinators/I.svg @@ -0,0 +1,16 @@ + + + a + a + + diff --git a/docs/combinators/K.svg b/docs/combinators/K.svg new file mode 100644 index 000000000..062b3378d --- /dev/null +++ b/docs/combinators/K.svg @@ -0,0 +1,17 @@ + + + a + a + b + + diff --git a/docs/combinators/KI.svg b/docs/combinators/KI.svg new file mode 100644 index 000000000..5cadf169d --- /dev/null +++ b/docs/combinators/KI.svg @@ -0,0 +1,17 @@ + + + a + b + b + + diff --git a/docs/combinators/N.svg b/docs/combinators/N.svg new file mode 100644 index 000000000..9643dbb4b --- /dev/null +++ b/docs/combinators/N.svg @@ -0,0 +1,21 @@ + + + F + G + a + b + + + + + diff --git a/docs/combinators/R.svg b/docs/combinators/R.svg new file mode 100644 index 000000000..dbcfa1fe2 --- /dev/null +++ b/docs/combinators/R.svg @@ -0,0 +1,24 @@ + + + F + G + H + a + b + c + + + + + + diff --git a/docs/combinators/S.svg b/docs/combinators/S.svg new file mode 100644 index 000000000..2e8510928 --- /dev/null +++ b/docs/combinators/S.svg @@ -0,0 +1,19 @@ + + + F + G + a + + + + diff --git a/docs/combinators/W.svg b/docs/combinators/W.svg new file mode 100644 index 000000000..f18e0bf70 --- /dev/null +++ b/docs/combinators/W.svg @@ -0,0 +1,17 @@ + + + F + a + + + diff --git a/docs/combinators/X.svg b/docs/combinators/X.svg new file mode 100644 index 000000000..68122545f --- /dev/null +++ b/docs/combinators/X.svg @@ -0,0 +1,23 @@ + + + F + G + H + a + b + + + + + + diff --git "a/docs/combinators/\303\212.svg" "b/docs/combinators/\303\212.svg" new file mode 100644 index 000000000..da7520a2a --- /dev/null +++ "b/docs/combinators/\303\212.svg" @@ -0,0 +1,26 @@ + + + F + G + H + a + b + c + d + + + + + + + diff --git "a/docs/combinators/\316\224.svg" "b/docs/combinators/\316\224.svg" new file mode 100644 index 000000000..bdbd02c8e --- /dev/null +++ "b/docs/combinators/\316\224.svg" @@ -0,0 +1,20 @@ + + + F + G + a + b + + + + diff --git "a/docs/combinators/\316\243.svg" "b/docs/combinators/\316\243.svg" new file mode 100644 index 000000000..ce48a6127 --- /dev/null +++ "b/docs/combinators/\316\243.svg" @@ -0,0 +1,19 @@ + + + F + G + a + + + + diff --git "a/docs/combinators/\316\246.svg" "b/docs/combinators/\316\246.svg" new file mode 100644 index 000000000..c759a13b2 --- /dev/null +++ "b/docs/combinators/\316\246.svg" @@ -0,0 +1,21 @@ + + + F + G + H + a + + + + + diff --git "a/docs/combinators/\316\2461.svg" "b/docs/combinators/\316\2461.svg" new file mode 100644 index 000000000..ebd1fdda1 --- /dev/null +++ "b/docs/combinators/\316\2461.svg" @@ -0,0 +1,24 @@ + + + F + G + H + a + b + + + + + + + diff --git "a/docs/combinators/\316\250.svg" "b/docs/combinators/\316\250.svg" new file mode 100644 index 000000000..040805e33 --- /dev/null +++ "b/docs/combinators/\316\250.svg" @@ -0,0 +1,22 @@ + + + F + G + G + a + b + + + + + diff --git "a/docs/combinators/\316\265.svg" "b/docs/combinators/\316\265.svg" new file mode 100644 index 000000000..5cb9c981b --- /dev/null +++ "b/docs/combinators/\316\265.svg" @@ -0,0 +1,22 @@ + + + F + G + a + b + c + + + + + diff --git "a/docs/combinators/\316\275.svg" "b/docs/combinators/\316\275.svg" new file mode 100644 index 000000000..0782f4f1d --- /dev/null +++ "b/docs/combinators/\316\275.svg" @@ -0,0 +1,21 @@ + + + F + G + a + b + + + + + diff --git "a/docs/combinators/\317\201.svg" "b/docs/combinators/\317\201.svg" new file mode 100644 index 000000000..b830f38ef --- /dev/null +++ "b/docs/combinators/\317\201.svg" @@ -0,0 +1,24 @@ + + + F + G + H + a + b + c + + + + + + diff --git "a/docs/combinators/\317\207.svg" "b/docs/combinators/\317\207.svg" new file mode 100644 index 000000000..60762eea6 --- /dev/null +++ "b/docs/combinators/\317\207.svg" @@ -0,0 +1,23 @@ + + + F + G + H + a + b + + + + + + diff --git a/docs/favicon-crayon.ico b/docs/favicon-crayon.ico new file mode 100644 index 000000000..5b372be8d Binary files /dev/null and b/docs/favicon-crayon.ico differ diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 000000000..9d7d73432 Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..69727bd6f --- /dev/null +++ b/docs/index.html @@ -0,0 +1,122 @@ + + + + + Uiua + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+

Uiua (wee-wuh) is a general purpose, stack-based, + array-oriented programming language with a focus on simplicity, beauty, and tacit code.

+

Uiua lets you write code that is as short as possible while remaining readable, so you can + focus on problems rather than ceremony.

+

The language is not yet stable, as its design space is still being explored. However, it is + already quite powerful and fun to use!

+ +

Loading...

+
+
+ + + + + \ No newline at end of file diff --git a/docs/primitives.json b/docs/primitives.json new file mode 100644 index 000000000..1bb29bab8 --- /dev/null +++ b/docs/primitives.json @@ -0,0 +1,1368 @@ +{ + "&ap": { + "args": 1, + "outputs": 0, + "class": "Media", + "description": "Play some audio" + }, + "&args": { + "args": 0, + "outputs": 1, + "class": "Env", + "description": "Get the command line arguments" + }, + "&asr": { + "args": 0, + "outputs": 1, + "class": "Media", + "description": "Get the sample rate of the audio output backend" + }, + "&ast": { + "args": 0, + "outputs": 0, + "modifier_args": 1, + "class": "Media", + "description": "Synthesize and stream audio" + }, + "&camcap": { + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Capture an image from a webcam" + }, + "&cd": { + "args": 1, + "outputs": 0, + "class": "Filesystem", + "description": "Change the current directory" + }, + "&cl": { + "args": 1, + "outputs": 0, + "class": "Stream", + "description": "Close a stream by its handle" + }, + "&clget": { + "args": 0, + "outputs": 1, + "class": "Misc", + "description": "Get the contents of the clipboard" + }, + "&clset": { + "args": 1, + "outputs": 0, + "class": "Misc", + "description": "Set the contents of the clipboard" + }, + "&exit": { + "args": 1, + "outputs": 0, + "class": "Misc", + "description": "Exit the program with a status code" + }, + "&fc": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Create a file and return a handle to it" + }, + "&fde": { + "args": 1, + "outputs": 0, + "class": "Filesystem", + "description": "Delete a file or directory" + }, + "&fe": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Check if a file, directory, or symlink exists at a path" + }, + "&ffi": { + "args": 2, + "outputs": 1, + "class": "Ffi", + "description": "Call a foreign function interface", + "experimental": true + }, + "&fif": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Check if a path is a file" + }, + "&fld": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "List the contents of a directory" + }, + "&fmd": { + "args": 1, + "outputs": 0, + "class": "Filesystem", + "description": "Create a directory" + }, + "&fo": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Open a file and return a handle to it" + }, + "&frab": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Read all the contents of a file into a byte array" + }, + "&fras": { + "args": 1, + "outputs": 1, + "class": "Filesystem", + "description": "Read all the contents of a file into a string" + }, + "&ftr": { + "args": 1, + "outputs": 0, + "class": "Filesystem", + "description": "Move a file or directory to the trash" + }, + "&fwa": { + "args": 2, + "outputs": 0, + "class": "Filesystem", + "description": "Write the entire contents of an array to a file" + }, + "&gifs": { + "args": 2, + "outputs": 0, + "class": "Media", + "description": "Show a gif" + }, + "&httpsw": { + "args": 2, + "outputs": 1, + "class": "Tcp", + "description": "Make an HTTP(S) request", + "deprecated": true + }, + "&ims": { + "args": 1, + "outputs": 0, + "class": "Media", + "description": "Show an image" + }, + "&invk": { + "args": 1, + "outputs": 1, + "class": "Command", + "description": "Invoke a path with the system's default program" + }, + "&memcpy": { + "args": 3, + "outputs": 1, + "class": "Ffi", + "description": "Copy data from a pointer into an array", + "experimental": true + }, + "&memfree": { + "args": 1, + "outputs": 0, + "class": "Ffi", + "description": "Free a pointer", + "experimental": true + }, + "&p": { + "args": 1, + "outputs": 0, + "class": "StdIO", + "description": "Print a value to stdout followed by a newline" + }, + "&pf": { + "args": 1, + "outputs": 0, + "class": "StdIO", + "description": "Print a value to stdout" + }, + "&raw": { + "args": 1, + "outputs": 0, + "class": "Env", + "description": "Set the terminal to raw mode" + }, + "&rb": { + "args": 2, + "outputs": 1, + "class": "Stream", + "description": "Read at most n bytes from a stream" + }, + "&rs": { + "args": 2, + "outputs": 1, + "class": "Stream", + "description": "Read characters formed by at most n bytes from a stream" + }, + "&ru": { + "args": 2, + "outputs": 1, + "class": "Stream", + "description": "Read from a stream until a delimiter is reached" + }, + "&runc": { + "args": 1, + "outputs": 3, + "class": "Command", + "description": "Run a command and wait for it to finish" + }, + "&runi": { + "args": 1, + "outputs": 1, + "class": "Command", + "description": "Run a command and wait for it to finish" + }, + "&runs": { + "args": 1, + "outputs": 3, + "class": "Command", + "description": "Run a command with streaming IO" + }, + "&s": { + "args": 1, + "outputs": 0, + "class": "StdIO", + "description": "Print a nicely formatted representation of a value to stdout" + }, + "&sc": { + "args": 0, + "outputs": 1, + "class": "StdIO", + "description": "Read a line from stdin" + }, + "&sl": { + "args": 1, + "outputs": 0, + "class": "Misc", + "description": "Sleep for n seconds" + }, + "&tcpa": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Accept a connection with a TCP or TLS listener" + }, + "&tcpaddr": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Get the connection address of a TCP socket" + }, + "&tcpc": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Create a TCP socket and connect it to an address" + }, + "&tcpl": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Create a TCP listener and bind it to an address" + }, + "&tcpsnb": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Set a TCP socket to non-blocking mode" + }, + "&tcpsrt": { + "args": 2, + "outputs": 0, + "class": "Tcp", + "description": "Set the read timeout of a TCP socket in seconds" + }, + "&tcpswt": { + "args": 2, + "outputs": 0, + "class": "Tcp", + "description": "Set the write timeout of a TCP socket in seconds" + }, + "&tlsc": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Create a TCP socket with TLS support" + }, + "&tlsl": { + "args": 1, + "outputs": 1, + "class": "Tcp", + "description": "Create a TLS listener and bind it to an address", + "experimental": true + }, + "&ts": { + "args": 0, + "outputs": 1, + "class": "Env", + "description": "Get the size of the terminal" + }, + "&var": { + "args": 1, + "outputs": 1, + "class": "Env", + "description": "Get the value of an environment variable" + }, + "&w": { + "args": 2, + "outputs": 0, + "class": "Stream", + "description": "Write an array to a stream" + }, + "above": { + "glyph": "◠", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Keep all arguments to a function above the outputs on the stack", + "experimental": true + }, + "absolute value": { + "glyph": "⌵", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Get the absolute value of a number" + }, + "add": { + "glyph": "+", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Add values" + }, + "assert": { + "glyph": "⍤", + "args": 2, + "outputs": 0, + "class": "Misc", + "description": "Throw an error if a condition is not met" + }, + "astar": { + "outputs": 2, + "modifier_args": 3, + "class": "Misc", + "description": "Find shortest paths in a graph", + "experimental": true + }, + "atangent": { + "glyph": "∠", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Take the arctangent of two numbers" + }, + "audio": { + "args": 3, + "outputs": 1, + "class": "Encoding", + "description": "Encode audio into a byte array" + }, + "backward": { + "glyph": "˜", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Call a function with its arguments reversed", + "experimental": true + }, + "below": { + "glyph": "◡", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Keep all arguments to a function below the outputs on the stack", + "experimental": true + }, + "bits": { + "glyph": "⋯", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Encode an array as bits (LSB-first)" + }, + "both": { + "glyph": "∩", + "args": 2, + "outputs": 1, + "modifier_args": 1, + "class": "Planet", + "description": "Call a function on two sets of values" + }, + "box": { + "glyph": "□", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Turn an array into a box" + }, + "bracket": { + "glyph": "⊓", + "outputs": 1, + "modifier_args": 2, + "class": "Planet", + "description": "Call two functions on two distinct sets of values" + }, + "but": { + "glyph": "⤙", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Call a function but keep its last argument on the top of the stack", + "experimental": true + }, + "by": { + "glyph": "⊸", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Duplicate a function's last argument before calling it" + }, + "case": { + "outputs": 1, + "modifier_args": 1, + "class": "Misc", + "description": "Call a pattern matching case", + "experimental": true + }, + "ceiling": { + "glyph": "⌈", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Round to the nearest integer towards ∞" + }, + "choose": { + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Get all combinations of k rows from an array", + "experimental": true + }, + "chunks": { + "glyph": "⑄", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Get the n-wise chunks of an array", + "experimental": true, + "deprecated": true + }, + "classify": { + "glyph": "⊛", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Assign a unique index to each unique row in an array" + }, + "complex": { + "glyph": "ℂ", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Make a complex number" + }, + "comptime": { + "outputs": 1, + "modifier_args": 1, + "class": "Comptime", + "description": "Run a function at compile time" + }, + "content": { + "glyph": "◇", + "outputs": 1, + "modifier_args": 1, + "class": "OtherModifier", + "description": "Unbox the arguments to a function before calling it" + }, + "coordinate": { + "glyph": "⟔", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Find the first deep index of one array in another", + "experimental": true, + "deprecated": true + }, + "couple": { + "glyph": "⊟", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Combine two arrays as rows of a new array" + }, + "csv": { + "args": 1, + "outputs": 1, + "class": "Encoding", + "description": "Encode an array into a CSV string" + }, + "datetime": { + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Get the date and time information from a time" + }, + "deal": { + "args": 2, + "outputs": 1, + "class": "Misc", + "description": "Randomly reorder the rows of an array with a seed", + "deprecated": true + }, + "deduplicate": { + "glyph": "◴", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Remove duplicate rows from an array" + }, + "deshape": { + "glyph": "♭", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Make an array 1-dimensional" + }, + "dip": { + "glyph": "⊙", + "outputs": 1, + "modifier_args": 1, + "class": "Planet", + "description": "Temporarily pop the top value off the stack and call a function" + }, + "divide": { + "ascii": "%", + "glyph": "÷", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Divide values" + }, + "do": { + "glyph": "⍢", + "outputs": 1, + "modifier_args": 2, + "class": "IteratingModifier", + "description": "Repeat a function while a condition holds" + }, + "drop": { + "glyph": "↘", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Drop the first n rows of an array" + }, + "dump": { + "args": 0, + "outputs": 0, + "modifier_args": 1, + "class": "Debug", + "description": "Debug print all the values currently on stack without popping them" + }, + "duplicate": { + "glyph": ".", + "args": 1, + "outputs": 2, + "class": "Stack", + "description": "Duplicate the top value on the stack" + }, + "each": { + "glyph": "∵", + "outputs": 1, + "modifier_args": 1, + "class": "IteratingModifier", + "description": "Apply a function to each element of an array or arrays" + }, + "equals": { + "ascii": "=", + "glyph": "=", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for equality" + }, + "eta": { + "glyph": "η", + "args": 0, + "outputs": 1, + "class": "Constant", + "description": "The number of radians in a quarter circle" + }, + "fall": { + "glyph": "⍖", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the indices into an array if it were sorted descending" + }, + "fft": { + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Run the Fast Fourier Transform on an array", + "experimental": true + }, + "fill": { + "glyph": "⬚", + "outputs": 1, + "modifier_args": 2, + "class": "OtherModifier", + "description": "Set the fill value for a function" + }, + "find": { + "glyph": "⌕", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Find the occurences of one array in another" + }, + "first": { + "glyph": "⊢", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the first row of an array" + }, + "fix": { + "glyph": "¤", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Add a length-1 axis to an array" + }, + "flip": { + "glyph": ":", + "args": 2, + "outputs": 2, + "class": "Stack", + "description": "Swap the top two values on the stack" + }, + "floor": { + "glyph": "⌊", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Round to the nearest integer towards ¯∞" + }, + "fold": { + "glyph": "∧", + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Apply a function to aggregate arrays" + }, + "fork": { + "glyph": "⊃", + "outputs": 1, + "modifier_args": 2, + "class": "Planet", + "description": "Call two functions on the same values" + }, + "gap": { + "glyph": "⋅", + "outputs": 1, + "modifier_args": 1, + "class": "Planet", + "description": "Discard the top stack value then call a function" + }, + "gen": { + "args": 1, + "outputs": 2, + "class": "Misc", + "description": "Generate a random number between 0 and 1 from a seed, as well as the next seed" + }, + "get": { + "args": 2, + "outputs": 1, + "class": "Map", + "description": "Get the value corresponding to a key in a map array" + }, + "gif": { + "args": 2, + "outputs": 1, + "class": "Encoding", + "description": "Encode a gif into a byte array" + }, + "graphemes": { + "args": 1, + "outputs": 1, + "class": "Encoding", + "description": "Convert a string to a list of UTF-8 grapheme clusters" + }, + "greater or equal": { + "ascii": ">=", + "glyph": "≥", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for greater than or equal" + }, + "greater than": { + "glyph": ">", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for greater than" + }, + "group": { + "glyph": "⊕", + "args": 2, + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Group elements of an array into buckets by index" + }, + "has": { + "args": 2, + "outputs": 1, + "class": "Map", + "description": "Check if a map array has a key" + }, + "identity": { + "glyph": "∘", + "args": 1, + "outputs": 1, + "class": "Planet", + "description": "Do nothing with one value" + }, + "img": { + "args": 2, + "outputs": 1, + "class": "Encoding", + "description": "Encode an image into a byte array with the specified format" + }, + "indexof": { + "glyph": "⊗", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Find the first index of each row of one array in another" + }, + "infinity": { + "glyph": "∞", + "args": 0, + "outputs": 1, + "class": "Constant", + "description": "The biggest number" + }, + "insert": { + "args": 3, + "outputs": 1, + "class": "Map", + "description": "Insert a key-value pair into a map array" + }, + "inventory": { + "glyph": "⍚", + "outputs": 1, + "modifier_args": 1, + "class": "IteratingModifier", + "description": "Apply a function to each unboxed row of an array and re-box the results" + }, + "join": { + "glyph": "⊂", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Append two arrays end-to-end" + }, + "json": { + "args": 1, + "outputs": 1, + "class": "Encoding", + "description": "Encode an array into a JSON string" + }, + "keep": { + "glyph": "▽", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Discard or copy some rows of an array" + }, + "last": { + "glyph": "⊣", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the last row of an array", + "experimental": true + }, + "layout": { + "args": 2, + "outputs": 1, + "class": "Encoding", + "description": "Render text into an image array", + "experimental": true + }, + "length": { + "glyph": "⧻", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the number of rows in an array" + }, + "less or equal": { + "ascii": "<=", + "glyph": "≤", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for less than or equal" + }, + "less than": { + "glyph": "<", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for less than" + }, + "logarithm": { + "glyph": "ₙ", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Get the based logarithm of a number" + }, + "map": { + "args": 2, + "outputs": 1, + "class": "Map", + "description": "Create a hashmap from a list of keys and list values" + }, + "mask": { + "glyph": "⦷", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Mask the occurences of one array in another" + }, + "match": { + "glyph": "≍", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Check if two arrays are exactly the same" + }, + "maximum": { + "glyph": "↥", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Take the maximum of two arrays" + }, + "member": { + "glyph": "∊", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Check if each row of one array exists in another", + "deprecated": true + }, + "memberof": { + "glyph": "∈", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Check if each row of one array exists in another" + }, + "memo": { + "outputs": 1, + "modifier_args": 1, + "class": "OtherModifier", + "description": "Memoize a function" + }, + "minimum": { + "glyph": "↧", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Take the minimum of two arrays" + }, + "modulus": { + "glyph": "◿", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Modulo values" + }, + "multiply": { + "ascii": "*", + "glyph": "×", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Multiply values" + }, + "negate": { + "ascii": "`", + "glyph": "¯", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Negate a number" + }, + "not": { + "glyph": "¬", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Logical not" + }, + "not equals": { + "ascii": "!=", + "glyph": "≠", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Compare for inequality" + }, + "now": { + "args": 0, + "outputs": 1, + "class": "Misc", + "description": "Get the current time in seconds" + }, + "on": { + "glyph": "⟜", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Call a function but keep its first argument on the top of the stack" + }, + "orient": { + "glyph": "⤸", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Change the order of the axes of an array" + }, + "over": { + "glyph": ",", + "args": 2, + "outputs": 3, + "class": "Stack", + "description": "Duplicate the second-to-top value to the top of the stack" + }, + "parse": { + "glyph": "⋕", + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Parse a string as a number" + }, + "partition": { + "glyph": "⊜", + "args": 2, + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Group sequential sections of an array" + }, + "permute": { + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Get all permutations of k rows from an array", + "experimental": true + }, + "pi": { + "glyph": "π", + "args": 0, + "outputs": 1, + "class": "Constant", + "description": "The ratio of a circle's circumference to its diameter" + }, + "pick": { + "glyph": "⊡", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Index a row or elements from an array" + }, + "pool": { + "outputs": 1, + "modifier_args": 1, + "class": "Thread", + "description": "Spawn a thread in a thread pool" + }, + "pop": { + "glyph": "◌", + "args": 1, + "outputs": 0, + "class": "Stack", + "description": "Discard the top stack value" + }, + "power": { + "glyph": "ⁿ", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Raise a value to a power" + }, + "quote": { + "args": 0, + "outputs": 1, + "modifier_args": 1, + "class": "Comptime", + "description": "Convert a string into code at compile time", + "experimental": true + }, + "random": { + "glyph": "⚂", + "args": 0, + "outputs": 1, + "class": "Misc", + "description": "Generate a random number in the range [0, 1)" + }, + "range": { + "glyph": "⇡", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Make an array of all natural numbers less than a number" + }, + "recv": { + "args": 1, + "outputs": 1, + "class": "Thread", + "description": "Receive a value from a thread" + }, + "reduce": { + "glyph": "/", + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Apply a reducing function to an array" + }, + "regex": { + "args": 2, + "outputs": 1, + "class": "Misc", + "description": "Match a regex pattern" + }, + "remove": { + "args": 2, + "outputs": 1, + "class": "Map", + "description": "Remove the value corresponding to a key from a map array" + }, + "repeat": { + "glyph": "⍥", + "outputs": 1, + "modifier_args": 1, + "class": "IteratingModifier", + "description": "Repeat a function a number of times" + }, + "repr": { + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Convert a value to its code representation" + }, + "rerank": { + "glyph": "☇", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Change the rank of an array's rows" + }, + "reshape": { + "glyph": "↯", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Change the shape of an array" + }, + "reverse": { + "glyph": "⇌", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Reverse the rows of an array" + }, + "rise": { + "glyph": "⍏", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the indices into an array if it were sorted ascending" + }, + "rotate": { + "glyph": "↻", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Rotate the elements of an array by n" + }, + "round": { + "glyph": "⁅", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Round to the nearest integer" + }, + "rows": { + "glyph": "≡", + "outputs": 1, + "modifier_args": 1, + "class": "IteratingModifier", + "description": "Apply a function to each row of an array or arrays" + }, + "scan": { + "glyph": "\\", + "args": 1, + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Reduce, but keep intermediate values" + }, + "select": { + "glyph": "⊏", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Select multiple rows from an array" + }, + "send": { + "args": 2, + "outputs": 0, + "class": "Thread", + "description": "Send a value to a thread" + }, + "setinv": { + "outputs": 1, + "modifier_args": 2, + "class": "InversionModifier", + "description": "Set the un-compatible inverse of a function" + }, + "setund": { + "outputs": 1, + "modifier_args": 3, + "class": "InversionModifier", + "description": "Set the under-compatible inverse of a function" + }, + "shape": { + "glyph": "△", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get the dimensions of an array" + }, + "sign": { + "glyph": "±", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Numerical sign (1, ¯1, or 0)" + }, + "signature": { + "args": 0, + "outputs": 2, + "modifier_args": 1, + "class": "Comptime", + "description": "Get the signature of a function", + "experimental": true + }, + "sine": { + "glyph": "∿", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Get the sine of a number" + }, + "sort": { + "glyph": "⍆", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Sort an array", + "experimental": true + }, + "spawn": { + "outputs": 1, + "modifier_args": 1, + "class": "Thread", + "description": "Spawn a thread" + }, + "sqrt": { + "glyph": "√", + "args": 1, + "outputs": 1, + "class": "MonadicPervasive", + "description": "Take the square root of a number" + }, + "stack": { + "glyph": "?", + "args": 0, + "outputs": 0, + "class": "Debug", + "description": "Debug print all stack values without popping them" + }, + "stringify": { + "args": 0, + "outputs": 1, + "modifier_args": 1, + "class": "Comptime", + "description": "Convert code into a string instead of compiling it", + "experimental": true + }, + "struct": { + "args": 0, + "outputs": 0, + "modifier_args": 1, + "class": "Misc", + "description": "Generate a constructor and getters for a struct", + "experimental": true + }, + "subtract": { + "glyph": "-", + "args": 2, + "outputs": 1, + "class": "DyadicPervasive", + "description": "Subtract values" + }, + "switch": { + "glyph": "⨬", + "outputs": 1, + "modifier_args": 2, + "class": "OtherModifier", + "description": "Call the function at the given index" + }, + "table": { + "glyph": "⊞", + "outputs": 1, + "modifier_args": 1, + "class": "IteratingModifier", + "description": "Apply a function to each combination of rows of some arrays" + }, + "tag": { + "args": 0, + "outputs": 1, + "class": "Misc", + "description": "Generate a unique tag" + }, + "take": { + "glyph": "↙", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "Take the first n rows of an array" + }, + "tau": { + "glyph": "τ", + "args": 0, + "outputs": 1, + "class": "Constant", + "description": "The ratio of a circle's circumference to its radius" + }, + "trace": { + "glyph": "⸮", + "args": 1, + "outputs": 1, + "class": "Debug", + "description": "Debug print the top value on the stack without popping it" + }, + "transpose": { + "glyph": "⍉", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Rotate the shape of an array" + }, + "triangle": { + "glyph": "◹", + "outputs": 1, + "modifier_args": 1, + "class": "AggregatingModifier", + "description": "Apply a function to each shrinking row of an array", + "experimental": true + }, + "try": { + "glyph": "⍣", + "outputs": 1, + "modifier_args": 2, + "class": "Misc", + "description": "Call a function and catch errors" + }, + "tryrecv": { + "args": 1, + "outputs": 1, + "class": "Thread", + "description": "Try to receive a value from a thread" + }, + "type": { + "args": 1, + "outputs": 1, + "class": "Misc", + "description": "Check the type of an array" + }, + "un": { + "glyph": "°", + "outputs": 1, + "modifier_args": 1, + "class": "InversionModifier", + "description": "Invert the behavior of a function" + }, + "under": { + "glyph": "⍜", + "outputs": 1, + "modifier_args": 2, + "class": "InversionModifier", + "description": "Operate on a transformed array, then reverse the transformation" + }, + "unique": { + "glyph": "◰", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get a mask of first occurrences of items in an array" + }, + "utf₈": { + "args": 1, + "outputs": 1, + "class": "Encoding", + "description": "Convert a string to UTF-8 bytes" + }, + "wait": { + "args": 1, + "outputs": 1, + "class": "Thread", + "description": "Wait for a thread to finish and push its results to the stack" + }, + "where": { + "glyph": "⊚", + "args": 1, + "outputs": 1, + "class": "MonadicArray", + "description": "Get indices where array values are not equal to zero" + }, + "windows": { + "glyph": "◫", + "args": 2, + "outputs": 1, + "class": "DyadicArray", + "description": "The n-wise windows of an array" + }, + "with": { + "glyph": "⤚", + "outputs": 1, + "modifier_args": 1, + "class": "Stack", + "description": "Call a function but keep its first argument under the outputs on the stack", + "experimental": true + }, + "xlsx": { + "args": 1, + "outputs": 1, + "class": "Encoding", + "description": "Encode an array into XLSX bytes" + } +} \ No newline at end of file diff --git a/docs/site-d39b5ec66973a734.js b/docs/site-d39b5ec66973a734.js new file mode 100644 index 000000000..de30a8df8 --- /dev/null +++ b/docs/site-d39b5ec66973a734.js @@ -0,0 +1,1689 @@ +let wasm; + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +let WASM_VECTOR_LEN = 0; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(state => { + wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b) +}); + +function makeMutClosure(arg0, arg1, dtor, f) { + const state = { a: arg0, b: arg1, cnt: 1, dtor }; + const real = (...args) => { + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + const a = state.a; + state.a = 0; + try { + return f(a, state.b, ...args); + } finally { + if (--state.cnt === 0) { + wasm.__wbindgen_export_2.get(state.dtor)(a, state.b); + CLOSURE_DTORS.unregister(state); + } else { + state.a = a; + } + } + }; + real.original = state; + CLOSURE_DTORS.register(real, state, state); + return real; +} +function __wbg_adapter_38(arg0, arg1, arg2) { + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8f986d4cbca21e65(arg0, arg1, addHeapObject(arg2)); +} + +function __wbg_adapter_41(arg0, arg1, arg2) { + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h75158f2255be0a59(arg0, arg1, addHeapObject(arg2)); +} + +function __wbg_adapter_44(arg0, arg1) { + wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc4aaa76563b98d1d(arg0, arg1); +} + +function __wbg_adapter_47(arg0, arg1) { + wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha6be839c0c65d365(arg0, arg1); +} + +function __wbg_adapter_50(arg0, arg1, arg2) { + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h58cd35bfb5a0110d(arg0, arg1, addHeapObject(arg2)); +} + +function getCachedStringFromWasm0(ptr, len) { + if (ptr === 0) { + return getObject(len); + } else { + return getStringFromWasm0(ptr, len); + } +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } +} +function __wbg_adapter_459(arg0, arg1, arg2, arg3) { + wasm.wasm_bindgen__convert__closures__invoke2_mut__h626417aa3237ce62(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); +} + +const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1)); +/** +*/ +export class IntoUnderlyingByteSource { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + IntoUnderlyingByteSourceFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_intounderlyingbytesource_free(ptr, 0); + } + /** + * @returns {string} + */ + get type() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.intounderlyingbytesource_type(retptr, this.__wbg_ptr); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var v1 = getCachedStringFromWasm0(r0, r1); + if (r0 !== 0) { wasm.__wbindgen_free(r0, r1, 1); } + return v1; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} +/** +* @returns {number} +*/ +get autoAllocateChunkSize() { + const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr); + return ret >>> 0; +} +/** +* @param {ReadableByteStreamController} controller +*/ +start(controller) { + wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller)); +} +/** +* @param {ReadableByteStreamController} controller +* @returns {Promise} +*/ +pull(controller) { + const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller)); + return takeObject(ret); +} +/** +*/ +cancel() { + const ptr = this.__destroy_into_raw(); + wasm.intounderlyingbytesource_cancel(ptr); +} +} + +const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1)); +/** +*/ +export class IntoUnderlyingSink { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + IntoUnderlyingSinkFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_intounderlyingsink_free(ptr, 0); + } + /** + * @param {any} chunk + * @returns {Promise} + */ + write(chunk) { + const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk)); + return takeObject(ret); + } + /** + * @returns {Promise} + */ + close() { + const ptr = this.__destroy_into_raw(); + const ret = wasm.intounderlyingsink_close(ptr); + return takeObject(ret); + } + /** + * @param {any} reason + * @returns {Promise} + */ + abort(reason) { + const ptr = this.__destroy_into_raw(); + const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason)); + return takeObject(ret); + } +} + +const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1)); +/** +*/ +export class IntoUnderlyingSource { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + IntoUnderlyingSourceFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_intounderlyingsource_free(ptr, 0); + } + /** + * @param {ReadableStreamDefaultController} controller + * @returns {Promise} + */ + pull(controller) { + const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller)); + return takeObject(ret); + } + /** + */ + cancel() { + const ptr = this.__destroy_into_raw(); + wasm.intounderlyingsource_cancel(ptr); + } +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_object_drop_ref = function(arg0) { + takeObject(arg0); + }; + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbg_new_abda76e883ba8a5f = function() { + const ret = new Error(); + return addHeapObject(ret); + }; + imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) { + const ret = getObject(arg1).stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); } + console.error(v0); +}; +imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { + const ret = getObject(arg0) === getObject(arg1); + return ret; +}; +imports.wbg.__wbindgen_is_undefined = function(arg0) { + const ret = getObject(arg0) === undefined; + return ret; +}; +imports.wbg.__wbindgen_boolean_get = function(arg0) { + const v = getObject(arg0); + const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; + return ret; +}; +imports.wbg.__wbindgen_number_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'number' ? obj : undefined; + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); +}; +imports.wbg.__wbindgen_is_null = function(arg0) { + const ret = getObject(arg0) === null; + return ret; +}; +imports.wbg.__wbindgen_is_object = function(arg0) { + const val = getObject(arg0); + const ret = typeof(val) === 'object' && val !== null; + return ret; +}; +imports.wbg.__wbg_crypto_d05b68a3572bb8ca = function(arg0) { + const ret = getObject(arg0).crypto; + return addHeapObject(ret); +}; +imports.wbg.__wbg_process_b02b3570280d0366 = function(arg0) { + const ret = getObject(arg0).process; + return addHeapObject(ret); +}; +imports.wbg.__wbg_versions_c1cb42213cedf0f5 = function(arg0) { + const ret = getObject(arg0).versions; + return addHeapObject(ret); +}; +imports.wbg.__wbg_node_43b1089f407e4ec2 = function(arg0) { + const ret = getObject(arg0).node; + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_is_string = function(arg0) { + const ret = typeof(getObject(arg0)) === 'string'; + return ret; +}; +imports.wbg.__wbg_require_9a7e0f667ead4995 = function() { return handleError(function () { + const ret = module.require; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_msCrypto_10fc94afee92bd76 = function(arg0) { + const ret = getObject(arg0).msCrypto; + return addHeapObject(ret); +}; +imports.wbg.__wbg_randomFillSync_b70ccbdf4926a99d = function() { return handleError(function (arg0, arg1) { + getObject(arg0).randomFillSync(takeObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_getRandomValues_7e42b4fb8779dc6d = function() { return handleError(function (arg0, arg1) { + getObject(arg0).getRandomValues(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbindgen_is_falsy = function(arg0) { + const ret = !getObject(arg0); + return ret; +}; +imports.wbg.__wbindgen_cb_drop = function(arg0) { + const obj = takeObject(arg0).original; + if (obj.cnt-- == 1) { + obj.a = 0; + return true; + } + const ret = false; + return ret; +}; +imports.wbg.__wbg_instanceof_Window_5012736c80a01584 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Window; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_document_8554450897a855b9 = function(arg0) { + const ret = getObject(arg0).document; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_location_af118da6c50d4c3f = function(arg0) { + const ret = getObject(arg0).location; + return addHeapObject(ret); +}; +imports.wbg.__wbg_history_489e13d0b625263c = function() { return handleError(function (arg0) { + const ret = getObject(arg0).history; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_navigator_6210380287bf8581 = function(arg0) { + const ret = getObject(arg0).navigator; + return addHeapObject(ret); +}; +imports.wbg.__wbg_localStorage_90db5cb66e840248 = function() { return handleError(function (arg0) { + const ret = getObject(arg0).localStorage; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_getComputedStyle_ba4609b39055f674 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).getComputedStyle(getObject(arg1)); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_open_43b3c6577af2a808 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + const ret = getObject(arg0).open(v0, v1); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_prompt_8fdcc5597c730ad8 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).prompt(v0); + var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}, arguments) }; +imports.wbg.__wbg_scrollTo_19dc1dbbc8c19fa8 = function(arg0, arg1, arg2) { + getObject(arg0).scrollTo(arg1, arg2); +}; +imports.wbg.__wbg_requestAnimationFrame_b4b782250b9c2c88 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).requestAnimationFrame(getObject(arg1)); + return ret; +}, arguments) }; +imports.wbg.__wbg_fetch_f3adf866d8944b41 = function(arg0, arg1) { + const ret = getObject(arg0).fetch(getObject(arg1)); + return addHeapObject(ret); +}; +imports.wbg.__wbg_setTimeout_73b734ca971c19f4 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = getObject(arg0).setTimeout(getObject(arg1), arg2); + return ret; +}, arguments) }; +imports.wbg.__wbg_settitle_64405a7dab688b2b = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).title = v0; +}; +imports.wbg.__wbg_body_b3bb488e8e54bf4b = function(arg0) { + const ret = getObject(arg0).body; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_head_6c6317d70f23ff16 = function(arg0) { + const ret = getObject(arg0).head; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_createComment_7a1d9856e50567bb = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).createComment(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_createDocumentFragment_5d919bd9d2e05b55 = function(arg0) { + const ret = getObject(arg0).createDocumentFragment(); + return addHeapObject(ret); +}; +imports.wbg.__wbg_createElement_5921e9eb06b9ec89 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).createElement(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_createTextNode_8bce33cf33bf8f6e = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).createTextNode(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_getElementById_f56c8e6a15a6926d = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).getElementById(v0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_querySelector_e21c39150aa72078 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).querySelector(v0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_instanceof_Element_cc034878d52a64fa = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Element; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_id_8071f78aa2301217 = function(arg0, arg1) { + const ret = getObject(arg1).id; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_setclassName_972f4bd6262f9c17 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).className = v0; +}; +imports.wbg.__wbg_classList_d725bcb3b32c27b5 = function(arg0) { + const ret = getObject(arg0).classList; + return addHeapObject(ret); +}; +imports.wbg.__wbg_setscrollLeft_ea3bf3bd376dd783 = function(arg0, arg1) { + getObject(arg0).scrollLeft = arg1; +}; +imports.wbg.__wbg_scrollWidth_a2bdee78f09b4be7 = function(arg0) { + const ret = getObject(arg0).scrollWidth; + return ret; +}; +imports.wbg.__wbg_setinnerHTML_ea7e3c6a3c4790c6 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).innerHTML = v0; +}; +imports.wbg.__wbg_children_0725d024369e02df = function(arg0) { + const ret = getObject(arg0).children; + return addHeapObject(ret); +}; +imports.wbg.__wbg_getAttribute_e867e037f066c410 = function(arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).getAttribute(v0); + var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}; +imports.wbg.__wbg_getBoundingClientRect_35fc4d8fa10e0463 = function(arg0) { + const ret = getObject(arg0).getBoundingClientRect(); + return addHeapObject(ret); +}; +imports.wbg.__wbg_getElementsByTagName_2a045f6645eead77 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).getElementsByTagName(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_hasAttribute_a17d49194d050f19 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).hasAttribute(v0); + return ret; +}; +imports.wbg.__wbg_removeAttribute_c80e298b60689065 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).removeAttribute(v0); +}, arguments) }; +imports.wbg.__wbg_scrollIntoView_4b805e2532108e71 = function(arg0) { + getObject(arg0).scrollIntoView(); +}; +imports.wbg.__wbg_scrollIntoView_569698f4895545a5 = function(arg0, arg1) { + getObject(arg0).scrollIntoView(getObject(arg1)); +}; +imports.wbg.__wbg_setAttribute_d5540a19be09f8dc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + getObject(arg0).setAttribute(v0, v1); +}, arguments) }; +imports.wbg.__wbg_before_ac3792b457802cbf = function() { return handleError(function (arg0, arg1) { + getObject(arg0).before(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_remove_5b68b70c39041e2a = function(arg0) { + getObject(arg0).remove(); +}; +imports.wbg.__wbg_instanceof_ClipboardEvent_a455b365be4677bb = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ClipboardEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_clipboardData_93c130a72996456a = function(arg0) { + const ret = getObject(arg0).clipboardData; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_instanceof_DragEvent_29469534b31c3761 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof DragEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_dataTransfer_2fb708051ee2c64c = function(arg0) { + const ret = getObject(arg0).dataTransfer; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_instanceof_InputEvent_4c8c546dc2c8a0db = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof InputEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_instanceof_ProgressEvent_0193094c90599e88 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ProgressEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_getItem_cab39762abab3e70 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).getItem(v0); + var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}, arguments) }; +imports.wbg.__wbg_setItem_9482185c870abba6 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + getObject(arg0).setItem(v0, v1); +}, arguments) }; +imports.wbg.__wbg_setinnerText_69255282a5d7ed93 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).innerText = v0; +}; +imports.wbg.__wbg_style_e06c9e03355741e9 = function(arg0) { + const ret = getObject(arg0).style; + return addHeapObject(ret); +}; +imports.wbg.__wbg_focus_06621101cc79f5d8 = function() { return handleError(function (arg0) { + getObject(arg0).focus(); +}, arguments) }; +imports.wbg.__wbg_width_85b26c6209197aa9 = function(arg0) { + const ret = getObject(arg0).width; + return ret; +}; +imports.wbg.__wbg_instanceof_HtmlStyleElement_76c02d8d225f4fdb = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLStyleElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_setbehavior_689064979b5313ca = function(arg0, arg1) { + getObject(arg0).behavior = ["auto","instant","smooth",][arg1]; +}; +imports.wbg.__wbg_getPropertyValue_b0f0858c3b5f17dd = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).getPropertyValue(v0); + const ptr2 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}, arguments) }; +imports.wbg.__wbg_removeProperty_cfd836a4f7e5e86e = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).removeProperty(v0); + const ptr2 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}, arguments) }; +imports.wbg.__wbg_setProperty_ff389e5a7fb9910e = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + getObject(arg0).setProperty(v0, v1); +}, arguments) }; +imports.wbg.__wbg_top_322638693276a225 = function(arg0) { + const ret = getObject(arg0).top; + return ret; +}; +imports.wbg.__wbg_right_8b5d6a4fd660b15f = function(arg0) { + const ret = getObject(arg0).right; + return ret; +}; +imports.wbg.__wbg_bottom_9c5a8538fdbb5e16 = function(arg0) { + const ret = getObject(arg0).bottom; + return ret; +}; +imports.wbg.__wbg_left_ec3af38bed003a86 = function(arg0) { + const ret = getObject(arg0).left; + return ret; +}; +imports.wbg.__wbg_newwithsrc_4f8c76cff241f93a = function() { return handleError(function (arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Audio(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlTextAreaElement_75bfdd55ca1a4a97 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLTextAreaElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_value_2bde81aca5570118 = function(arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_setvalue_5b6537234b7d08ee = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).value = v0; +}; +imports.wbg.__wbg_selectionStart_2dc3d6141239a7a2 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).selectionStart; + getDataViewMemory0().setInt32(arg0 + 4 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); +}, arguments) }; +imports.wbg.__wbg_selectionEnd_de210773370d6364 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).selectionEnd; + getDataViewMemory0().setInt32(arg0 + 4 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); +}, arguments) }; +imports.wbg.__wbg_setSelectionRange_2aa3c241274cbc2f = function() { return handleError(function (arg0, arg1, arg2) { + getObject(arg0).setSelectionRange(arg1 >>> 0, arg2 >>> 0); +}, arguments) }; +imports.wbg.__wbg_instanceof_FileReader_985ae057ebe3ba9e = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof FileReader; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_result_3869032b57f861ac = function() { return handleError(function (arg0) { + const ret = getObject(arg0).result; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_new_8515b7401632bd44 = function() { return handleError(function () { + const ret = new FileReader(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_readAsArrayBuffer_6475a86a924a8856 = function() { return handleError(function (arg0, arg1) { + getObject(arg0).readAsArrayBuffer(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlDivElement_a18fc94130bc218e = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLDivElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_close_cef2400b120c9c73 = function() { return handleError(function (arg0) { + getObject(arg0).close(); +}, arguments) }; +imports.wbg.__wbg_enqueue_6f3d433b5e457aea = function() { return handleError(function (arg0, arg1) { + getObject(arg0).enqueue(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_append_d510a297e3ba948e = function() { return handleError(function (arg0, arg1) { + getObject(arg0).append(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_name_ed3cda975cce080d = function(arg0, arg1) { + const ret = getObject(arg1).name; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_length_f2469772b8ec9ea3 = function(arg0) { + const ret = getObject(arg0).length; + return ret; +}; +imports.wbg.__wbg_get_6d8ff52d2078d871 = function(arg0, arg1) { + const ret = getObject(arg0)[arg1 >>> 0]; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_state_b863826253700666 = function() { return handleError(function (arg0) { + const ret = getObject(arg0).state; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_pushState_fc8b2d0c45854901 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + var v1 = getCachedStringFromWasm0(arg4, arg5); + getObject(arg0).pushState(getObject(arg1), v0, v1); +}, arguments) }; +imports.wbg.__wbg_replaceState_c3213575ed65bac2 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + var v1 = getCachedStringFromWasm0(arg4, arg5); + getObject(arg0).replaceState(getObject(arg1), v0, v1); +}, arguments) }; +imports.wbg.__wbg_length_6e2f57e8f5058ac4 = function(arg0) { + const ret = getObject(arg0).length; + return ret; +}; +imports.wbg.__wbg_item_284906f439cece90 = function(arg0, arg1) { + const ret = getObject(arg0).item(arg1 >>> 0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_byobRequest_b32c77640da946ac = function(arg0) { + const ret = getObject(arg0).byobRequest; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_close_aca7442e6619206b = function() { return handleError(function (arg0) { + getObject(arg0).close(); +}, arguments) }; +imports.wbg.__wbg_instanceof_ShadowRoot_72d8e783f8e0093c = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ShadowRoot; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_host_fdfe1258b06fe937 = function(arg0) { + const ret = getObject(arg0).host; + return addHeapObject(ret); +}; +imports.wbg.__wbg_error_09480e4aadca50ad = function(arg0) { + console.error(getObject(arg0)); +}; +imports.wbg.__wbg_log_b103404cc5920657 = function(arg0) { + console.log(getObject(arg0)); +}; +imports.wbg.__wbg_warn_2b3adb99ce26c314 = function(arg0) { + console.warn(getObject(arg0)); +}; +imports.wbg.__wbg_writeText_20fb3f7393d34052 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).writeText(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_files_a4b6a9811697ac84 = function(arg0) { + const ret = getObject(arg0).files; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_getData_b768ea3ff59e2a13 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).getData(v0); + const ptr2 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len2 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len2, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr2, true); +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlInputElement_88bf515ab1d9511d = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLInputElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_value_d4a95e7a0d390578 = function(arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_setvalue_688819688274bec0 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).value = v0; +}; +imports.wbg.__wbg_instanceof_Node_807587297afc161b = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Node; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_parentNode_3e06cf96d7693d57 = function(arg0) { + const ret = getObject(arg0).parentNode; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_childNodes_031aa96d5e3d21b0 = function(arg0) { + const ret = getObject(arg0).childNodes; + return addHeapObject(ret); +}; +imports.wbg.__wbg_previousSibling_076df2178284ef97 = function(arg0) { + const ret = getObject(arg0).previousSibling; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_nextSibling_f6396d6fd0b97830 = function(arg0) { + const ret = getObject(arg0).nextSibling; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_settextContent_cd38ea7d4e0f7260 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).textContent = v0; +}; +imports.wbg.__wbg_appendChild_ac45d1abddf1b89b = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).appendChild(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_cloneNode_629a1b180e91c467 = function() { return handleError(function (arg0) { + const ret = getObject(arg0).cloneNode(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_removeChild_139b30d19f579e41 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).removeChild(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_length_4919f4a62b9b1e94 = function(arg0) { + const ret = getObject(arg0).length; + return ret; +}; +imports.wbg.__wbg_target_b7cb1739bee70928 = function(arg0) { + const ret = getObject(arg0).target; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_defaultPrevented_9e2309e82258aee7 = function(arg0) { + const ret = getObject(arg0).defaultPrevented; + return ret; +}; +imports.wbg.__wbg_cancelBubble_0374b329f66f59b5 = function(arg0) { + const ret = getObject(arg0).cancelBubble; + return ret; +}; +imports.wbg.__wbg_newwitheventinitdict_8ade740b9035eb27 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Event(v0, getObject(arg2)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_composedPath_d1052062308beae5 = function(arg0) { + const ret = getObject(arg0).composedPath(); + return addHeapObject(ret); +}; +imports.wbg.__wbg_preventDefault_c55d86c27b2dfa6e = function(arg0) { + getObject(arg0).preventDefault(); +}; +imports.wbg.__wbg_stopPropagation_dd0d50059627b362 = function(arg0) { + getObject(arg0).stopPropagation(); +}; +imports.wbg.__wbg_setbubbles_3fd649bf0421c5ad = function(arg0, arg1) { + getObject(arg0).bubbles = arg1 !== 0; +}; +imports.wbg.__wbg_addEventListener_e167f012cbedfa4e = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).addEventListener(v0, getObject(arg3)); +}, arguments) }; +imports.wbg.__wbg_addEventListener_14b036ff7cb8747c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).addEventListener(v0, getObject(arg3), getObject(arg4)); +}, arguments) }; +imports.wbg.__wbg_dispatchEvent_190760297f28fb3d = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).dispatchEvent(getObject(arg1)); + return ret; +}, arguments) }; +imports.wbg.__wbg_removeEventListener_b6cef5ad085bea8f = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).removeEventListener(v0, getObject(arg3)); +}, arguments) }; +imports.wbg.__wbg_instanceof_KeyboardEvent_cb701ff8e9ff53cb = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof KeyboardEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_altKey_5a6eb49ec8194792 = function(arg0) { + const ret = getObject(arg0).altKey; + return ret; +}; +imports.wbg.__wbg_ctrlKey_319ff2374dc7f372 = function(arg0) { + const ret = getObject(arg0).ctrlKey; + return ret; +}; +imports.wbg.__wbg_shiftKey_f38dee34420e0d62 = function(arg0) { + const ret = getObject(arg0).shiftKey; + return ret; +}; +imports.wbg.__wbg_metaKey_00fdcfadf1968d45 = function(arg0) { + const ret = getObject(arg0).metaKey; + return ret; +}; +imports.wbg.__wbg_key_a626396efbca2b95 = function(arg0, arg1) { + const ret = getObject(arg1).key; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_instanceof_MouseEvent_465e429c6fab5cee = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof MouseEvent; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_clientX_3967ecd5e962e1b2 = function(arg0) { + const ret = getObject(arg0).clientX; + return ret; +}; +imports.wbg.__wbg_clientY_37d418b8d9c0bb52 = function(arg0) { + const ret = getObject(arg0).clientY; + return ret; +}; +imports.wbg.__wbg_ctrlKey_957c6c31b62b4550 = function(arg0) { + const ret = getObject(arg0).ctrlKey; + return ret; +}; +imports.wbg.__wbg_shiftKey_8c0f9a5ca3ff8f93 = function(arg0) { + const ret = getObject(arg0).shiftKey; + return ret; +}; +imports.wbg.__wbg_altKey_d3fbce7596aac8cf = function(arg0) { + const ret = getObject(arg0).altKey; + return ret; +}; +imports.wbg.__wbg_metaKey_be0158b14b1cef4a = function(arg0) { + const ret = getObject(arg0).metaKey; + return ret; +}; +imports.wbg.__wbg_button_460cdec9f2512a91 = function(arg0) { + const ret = getObject(arg0).button; + return ret; +}; +imports.wbg.__wbg_view_2a901bda0727aeb3 = function(arg0) { + const ret = getObject(arg0).view; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_respond_a799bab31a44f2d7 = function() { return handleError(function (arg0, arg1) { + getObject(arg0).respond(arg1 >>> 0); +}, arguments) }; +imports.wbg.__wbg_clipboard_0d7b5c390c14b0e6 = function(arg0) { + const ret = getObject(arg0).clipboard; + return addHeapObject(ret); +}; +imports.wbg.__wbg_userAgent_58dedff4303aeb66 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).userAgent; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}, arguments) }; +imports.wbg.__wbg_newwithstrandinit_a31c69e4cc337183 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Request(v0, getObject(arg2)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_setmethod_dc68a742c2db5c6a = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).method = v0; +}; +imports.wbg.__wbg_setmode_a781aae2bd3df202 = function(arg0, arg1) { + getObject(arg0).mode = ["same-origin","no-cors","cors","navigate",][arg1]; +}; +imports.wbg.__wbg_instanceof_Response_e91b7eb7c611a9ae = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Response; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_status_ae8de515694c5c7c = function(arg0) { + const ret = getObject(arg0).status; + return ret; +}; +imports.wbg.__wbg_text_a94b91ea8700357a = function() { return handleError(function (arg0) { + const ret = getObject(arg0).text(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_add_e210e3b838bff57f = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).add(v0); +}, arguments) }; +imports.wbg.__wbg_remove_0dd2beafdaa4d9ba = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).remove(v0); +}, arguments) }; +imports.wbg.__wbg_play_69733added0ad2db = function() { return handleError(function (arg0) { + const ret = getObject(arg0).play(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_now_a69647afb1f66247 = function(arg0) { + const ret = getObject(arg0).now(); + return ret; +}; +imports.wbg.__wbg_href_f1d20018a97415a0 = function(arg0, arg1) { + const ret = getObject(arg1).href; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_origin_b1cdab9cfa04b734 = function(arg0, arg1) { + const ret = getObject(arg1).origin; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_pathname_adec1eb7f76356a8 = function(arg0, arg1) { + const ret = getObject(arg1).pathname; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_search_f384756d8e27fd66 = function(arg0, arg1) { + const ret = getObject(arg1).search; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_searchParams_8b40e0942f870b44 = function(arg0) { + const ret = getObject(arg0).searchParams; + return addHeapObject(ret); +}; +imports.wbg.__wbg_hash_50828fbc16613897 = function(arg0, arg1) { + const ret = getObject(arg1).hash; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_newwithbase_ba5e3790a41efd02 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + var v1 = getCachedStringFromWasm0(arg2, arg3); + const ret = new URL(v0, v1); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_setdata_27c6828c5a5a5ce4 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).data = v0; +}; +imports.wbg.__wbg_instanceof_HtmlAnchorElement_7a88f0b97085fa30 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLAnchorElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_target_fed794e9a6ed73fe = function(arg0, arg1) { + const ret = getObject(arg1).target; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_href_31456ceb26f92368 = function(arg0, arg1) { + const ret = getObject(arg1).href; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_instanceof_HtmlSelectElement_c54017bd3db58d85 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLSelectElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_value_9991233a797a5fbc = function(arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbg_sethref_9d76f6c9356e9638 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + getObject(arg0).href = v0; +}, arguments) }; +imports.wbg.__wbg_origin_648082c4831a5be8 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).origin; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}, arguments) }; +imports.wbg.__wbg_pathname_6e6871539b48a0e5 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).pathname; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}, arguments) }; +imports.wbg.__wbg_search_20c15d493b8602c5 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).search; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}, arguments) }; +imports.wbg.__wbg_hash_313d7fdf42f6e7d3 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).hash; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}, arguments) }; +imports.wbg.__wbg_queueMicrotask_12a30234db4045d3 = function(arg0) { + queueMicrotask(getObject(arg0)); +}; +imports.wbg.__wbg_queueMicrotask_48421b3cc9052b68 = function(arg0) { + const ret = getObject(arg0).queueMicrotask; + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_is_function = function(arg0) { + const ret = typeof(getObject(arg0)) === 'function'; + return ret; +}; +imports.wbg.__wbg_length_ae22078168b726f5 = function(arg0) { + const ret = getObject(arg0).length; + return ret; +}; +imports.wbg.__wbg_next_de3e9db4440638b2 = function(arg0) { + const ret = getObject(arg0).next; + return addHeapObject(ret); +}; +imports.wbg.__wbg_value_6d39332ab4788d86 = function(arg0) { + const ret = getObject(arg0).value; + return addHeapObject(ret); +}; +imports.wbg.__wbg_iterator_888179a48810a9fe = function() { + const ret = Symbol.iterator; + return addHeapObject(ret); +}; +imports.wbg.__wbg_new_525245e2b9901204 = function() { + const ret = new Object(); + return addHeapObject(ret); +}; +imports.wbg.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () { + const ret = self.self; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () { + const ret = window.window; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () { + const ret = globalThis.globalThis; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () { + const ret = global.global; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_decodeURI_27d956972029c70b = function() { return handleError(function (arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = decodeURI(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_get_3baa728f9d58d3f6 = function(arg0, arg1) { + const ret = getObject(arg0)[arg1 >>> 0]; + return addHeapObject(ret); +}; +imports.wbg.__wbg_isArray_8364a5371e9737d8 = function(arg0) { + const ret = Array.isArray(getObject(arg0)); + return ret; +}; +imports.wbg.__wbg_instanceof_ArrayBuffer_61dfc3198373c902 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ArrayBuffer; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_new_796382978dfd4fb0 = function(arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Error(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Function(v0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).call(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = getObject(arg0).call(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) { + const ret = getObject(arg0).next(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_done_bfda7aa8f252b39f = function(arg0) { + const ret = getObject(arg0).done; + return ret; +}; +imports.wbg.__wbg_getMonth_e3a0afc07cbc1328 = function(arg0) { + const ret = getObject(arg0).getMonth(); + return ret; +}; +imports.wbg.__wbg_new0_65387337a95cf44d = function() { + const ret = new Date(); + return addHeapObject(ret); +}; +imports.wbg.__wbg_now_b7a162010a9e75b4 = function() { + const ret = Date.now(); + return ret; +}; +imports.wbg.__wbg_is_009b1ef508712fda = function(arg0, arg1) { + const ret = Object.is(getObject(arg0), getObject(arg1)); + return ret; +}; +imports.wbg.__wbg_exec_a29a4ce5544bd3be = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).exec(v0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}; +imports.wbg.__wbg_new_13847c66f41dda63 = function(arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + var v1 = getCachedStringFromWasm0(arg2, arg3); + const ret = new RegExp(v0, v1); + return addHeapObject(ret); +}; +imports.wbg.__wbg_new_b85e72ed1bfd57f9 = function(arg0, arg1) { + try { + var state0 = {a: arg0, b: arg1}; + var cb0 = (arg0, arg1) => { + const a = state0.a; + state0.a = 0; + try { + return __wbg_adapter_459(a, state0.b, arg0, arg1); + } finally { + state0.a = a; + } + }; + const ret = new Promise(cb0); + return addHeapObject(ret); + } finally { + state0.a = state0.b = 0; + } +}; +imports.wbg.__wbg_resolve_570458cb99d56a43 = function(arg0) { + const ret = Promise.resolve(getObject(arg0)); + return addHeapObject(ret); +}; +imports.wbg.__wbg_then_95e6edc0f89b73b1 = function(arg0, arg1) { + const ret = getObject(arg0).then(getObject(arg1)); + return addHeapObject(ret); +}; +imports.wbg.__wbg_then_876bb3c633745cc6 = function(arg0, arg1, arg2) { + const ret = getObject(arg0).then(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); +}; +imports.wbg.__wbg_buffer_b7b08af79b0b0974 = function(arg0) { + const ret = getObject(arg0).buffer; + return addHeapObject(ret); +}; +imports.wbg.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) { + const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_new_ea1883e1e5e86686 = function(arg0) { + const ret = new Uint8Array(getObject(arg0)); + return addHeapObject(ret); +}; +imports.wbg.__wbg_newwithlength_ec548f448387c968 = function(arg0) { + const ret = new Uint8Array(arg0 >>> 0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_buffer_0710d1b9dbe2eea6 = function(arg0) { + const ret = getObject(arg0).buffer; + return addHeapObject(ret); +}; +imports.wbg.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) { + const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0); + return addHeapObject(ret); +}; +imports.wbg.__wbg_length_8339fcf5d8ecd12e = function(arg0) { + const ret = getObject(arg0).length; + return ret; +}; +imports.wbg.__wbg_byteLength_850664ef28f3e42f = function(arg0) { + const ret = getObject(arg0).byteLength; + return ret; +}; +imports.wbg.__wbg_byteOffset_ea14c35fa6de38cc = function(arg0) { + const ret = getObject(arg0).byteOffset; + return ret; +}; +imports.wbg.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) { + getObject(arg0).set(getObject(arg1), arg2 >>> 0); +}; +imports.wbg.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) { + const ret = Reflect.get(getObject(arg0), getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_set_eacc7d73fefaafdf = function() { return handleError(function (arg0, arg1, arg2) { + const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2)); + return ret; +}, arguments) }; +imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + const ret = debugString(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; +imports.wbg.__wbindgen_rethrow = function(arg0) { + throw takeObject(arg0); +}; +imports.wbg.__wbindgen_memory = function() { + const ret = wasm.memory; + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper2036 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 612, __wbg_adapter_38); + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper31222 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 4755, __wbg_adapter_41); + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper31224 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 4755, __wbg_adapter_44); + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper31703 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 4811, __wbg_adapter_47); + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper33801 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 4837, __wbg_adapter_50); + return addHeapObject(ret); +}; + +return imports; +} + +function __wbg_init_memory(imports, memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedDataViewMemory0 = null; + cachedUint8ArrayMemory0 = null; + + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype) + ({module} = module) + else + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({module_or_path} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('site_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync }; +export default __wbg_init; diff --git a/docs/site-d39b5ec66973a734_bg.wasm b/docs/site-d39b5ec66973a734_bg.wasm new file mode 100644 index 000000000..0efc44bfb Binary files /dev/null and b/docs/site-d39b5ec66973a734_bg.wasm differ diff --git a/docs/styles-96bf45e301d5b5e2.css b/docs/styles-96bf45e301d5b5e2.css new file mode 100644 index 000000000..8aedf2874 --- /dev/null +++ b/docs/styles-96bf45e301d5b5e2.css @@ -0,0 +1,1355 @@ +@font-face { + font-family: "Code Font"; + src: url(Uiua386.ttf) format("truetype"); +} + +html * { + font-family: "Segoe UI", "Arial", sans-serif; +} + +html { + font-size: 115%; + font-weight: 500; +} + +body { + margin: 0; +} + +p { + line-height: 1.5em; +} + +h2 { + margin: 1.8em 0 0.5em 0; + padding-bottom: 0.3em; + border-bottom-width: 0.08em; + border-bottom-style: solid; + border-color: #888a; +} + +.header { + position: relative; +} + +a.header, +a:visited.header, +a:link.header { + text-decoration: none; + color: inherit; +} + +a.header::before { + position: absolute; + left: -1.5em; + bottom: 0.4em; + content: "🔗"; + opacity: 0; + font-size: 0.6em; + transition: opacity 0.2s; +} + +a.header:hover::before { + opacity: 0.5; +} + +h1>a>code, +h2>a>code { + font-weight: normal; +} + +button { + border-width: 0; + border-radius: 0.5em; + padding: 0.2em; + display: inline-block; + position: relative; +} + +button:active { + transform: translateY(0.1em); +} + +code { + font-family: "Code Font", monospace; + border-radius: 0.2em; + padding: 0.2em; + position: relative; +} + +th, +td { + padding: 0.3em; + border-radius: 0.5em; +} + +th { + text-align: left; +} + +tr:nth-child(even) { + background-color: #0001; +} + +.bordered-table { + border: 0.2em solid #0005; + border-radius: 0.5em; +} + +.header-centered-table>tr>th { + text-align: center; + +} + +.cell-centered-table>tr>td { + text-align: center; +} + +li { + margin: 0.3em 0; +} + +@media (prefers-color-scheme: dark) { + + body, + #header-uiua, + .spoiler:hover { + color: #d1daec; + } + + body, + .spoiler:hover { + background-color: #141a1f; + } + + #editor { + outline: 0.1em solid #606468; + background-color: #19232d; + } + + .code, + .input-div, + input[type=text], + #settings>*>*>input, + #settings>*>*>select { + color: #d1daec; + background-color: #1d2c3a; + } + + button { + color: #d1daec; + background-color: #1d2c3a; + } + + button:hover { + background-color: #2d3c4a; + } + + a:link { + color: #6fadea; + } + + a:visited { + color: #947bec; + } + + code { + background-color: #0004; + } + + .important-button { + background-color: #33577b; + } + + .important-button:hover { + background-color: #579; + } + + .tutorial-nav>* { + background-color: #1d2c3a; + } + + tr:nth-child(even) { + background-color: #0001; + } + + .glyph-button:hover, + .combinator-diagram { + background-color: #0003; + } + + .code-entry { + caret-color: white; + } + + #subtitle { + color: #d1daecc0; + } +} + +@media (prefers-color-scheme: light) { + + body, + #header-uiua, + .spoiler:hover { + color: #344; + } + + body, + .spoiler:hover { + background-color: #c6e7ec; + } + + #editor { + background-color: #dff2f3; + outline: 0.1em solid #0004; + } + + .code, + .input-div, + input[type=text], + #settings>*>*>input, + #settings>*>*>select { + color: #344; + background-color: #f4f6f6; + } + + button { + color: #344; + background-color: #f6f8f8; + } + + button:hover { + background-color: #fdffff; + } + + a:link { + color: #0099ad; + } + + a:visited { + color: #6a4bfb; + } + + code { + background-color: #fff8; + } + + .important-button { + background-color: #aadae0; + } + + .important-button:hover { + background-color: #bee2e7; + } + + .tutorial-nav>* { + background-color: #f6f8f8; + } + + tr:nth-child(even) { + background-color: #fff1; + } + + .glyph-button:hover, + .combinator-diagram { + background-color: #fffa; + } + + .code-entry { + caret-color: black; + } + + #subtitle { + color: #344c; + } +} + +#top { + margin: 2em auto; + width: max(10em, min(90%, 53em)); +} + +#header { + display: flex; + justify-content: space-between; + align-items: last baseline; + flex-wrap: wrap; + gap: 1em; + margin-bottom: 1em; +} + + +#header-left { + display: flex; + align-items: last baseline; + margin: -1em 0; +} + +#header-uiua { + text-decoration: none; + white-space: nowrap; +} + +#subtitle { + margin-left: 1.5em; + font-size: 1em; + font-weight: bold; + font-style: italic; +} + +.spoiler { + color: #0000; + background-color: #0008; + border-radius: 0.5em; +} + +.long-subtitle { + font-size: 0.9em; +} + +.long-subtitle>div { + display: flex; + gap: 0.5em; + flex-wrap: nowrap; + white-space: nowrap; +} + +#nav { + display: flex; + gap: 1em; + flex-wrap: nowrap; + align-items: baseline; +} + +#links { + font-size: 1.2em; + display: flex; + justify-content: center; + flex-wrap: wrap; + gap: 1em; + margin-bottom: 1em; + align-content: flex-start; +} + +#links>* { + display: flex; + gap: 1em; + flex-wrap: wrap; + justify-content: space-between; + align-content: flex-start; +} + +.main-text { + font-size: 120%; + text-align: center; +} + +.wee-wuh-span { + font-size: 70%; + opacity: 0.8; +} + +.features { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: min(3em, 3vw); + width: min(120%, 90vw); + margin-left: calc(-0.5 * (min(120%, 90vw) - 100%)); +} + +.features>* { + flex: 1 1 22em; + width: 0; +} + +#editor { + border-radius: 0.5em; + position: relative; +} + +#drag-message { + position: absolute; + inset: 0; + display: flex; + justify-content: center; + align-items: center; + background-color: #0008; + font-size: 2em; +} + +#editor-wrapper { + margin-bottom: 0.5em; + font-size: min(1em, 3.5vw); +} + +.small-editor { + font-size: 1.2em; +} + +.medium-editor { + font-size: 1.4em; +} + +#settings { + display: flex; + justify-content: space-between; + font-size: 0.82em; + padding: 0.2em; + gap: 0.5em; +} + +#settings>* { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 0.2em 1em; +} + +#settings-left { + width: 85%; + justify-content: space-between; +} + +#settings-right { + flex-direction: column; + align-items: flex-end; +} + +#settings>*>* { + display: inline-block; + white-space: nowrap; +} + +input[type=number] { + appearance: textfield; + -moz-appearance: textfield; +} + +.code-block { + display: block; + white-space: pre-wrap; + padding: 0.8em; +} + +#settings>*>*>input, +#settings>*>*>select { + border-radius: 0.5em; + border: none; + margin-left: 0.5em; +} + +#settings>*>*>input[type=number] { + width: 3em; +} + +#code-area { + position: relative; +} + +.code-outer { + text-align: left; + border-radius: 0.5em; + width: 100%; + resize: vertical; + box-sizing: border-box; + outline: none; + border: none; + padding: 0.3em; + min-height: 1.8em; + overflow-y: auto; + display: flex; + gap: 0.1em; + overflow-y: hidden; +} + +.code-and-overlay { + width: 100%; + position: relative; +} + +.code-entry { + margin: 0.1em 0 0 0; + padding: 0; + position: absolute; + outline: none; + border: none; + box-sizing: border-box; + /* background-color: #0002; */ + /* color: #0008; */ + background-color: transparent; + color: transparent; + resize: none; + font-family: "Code Font", monospace; + font-size: inherit; + line-height: 1.25em; + overflow-wrap: normal; + white-space: pre; + overflow: hidden; + height: 100%; +} + +.code-entry::selection { + color: transparent; + background-color: #0078d7; +} + +.code-overlay { + margin: 0; + padding: 0; + position: absolute; + width: 100%; + pointer-events: none; + white-space: pre; +} + +.code-line { + height: 1.25em; + padding: 0; + margin: 0; +} + +.line-numbers { + min-width: 1.5em; +} + +@media (prefers-color-scheme: dark) { + .line-numbers { + color: #3f4b5d; + } +} + +@media (prefers-color-scheme: light) { + .line-numbers { + color: #bcc9ca; + } +} + +.code-span { + font-size: 1em; + font-family: "Code Font", monospace; + white-space: pre; + text-decoration: none; +} + +.code-hover { + display: none; + position: fixed; + font-family: "Code Font", monospace; + font-size: 0.7em; + color: #eee; + background-color: #000c; + padding: 0.2em; + border-radius: 0.2em; + pointer-events: none; + z-index: 1; + text-decoration: none; + white-space: pre-wrap; + overflow: visible; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.ctrl-pressed .code-underline:hover { + text-decoration: underline; + cursor: pointer; +} + +.output-frame { + display: flex; + justify-content: space-between; + min-height: 1.9em; +} + +.output-lines { + overflow-x: auto; +} + +.output-diagnostics { + white-space: pre-wrap; + text-align: left; + margin-left: 1.75em; + padding: 0.3em 0; + font-family: "Code Font", monospace; +} + +.output-wrapper { + transform: rotateX(180deg); + overflow-x: auto; +} + +.output { + white-space: pre; + text-align: left; + margin-left: 1.85em; + padding: 0.4em 0; + font-family: "Code Font", monospace; + transform: rotateX(180deg); +} + +.output:empty, +.output-diagnostics:empty { + display: none; +} + +.output-item, +.output-report { + font-family: inherit; +} + +#code-buttons { + margin: 0.2em 0.2em 0.2em 0; + display: flex; + flex-wrap: nowrap; + right: 0; + max-height: 1.5em; +} + +.code-button { + font-size: 0.9em; + margin: 0 0 0 0.2em; + height: auto; + text-align: center; + text-justify: center; +} + +.important-button { + animation: fadeAnimation 2s infinite; +} + +.output-line { + font-family: "Code Font", monospace; + font-size: inherit; + white-space: pre; +} + +.output-wrap-line { + white-space: pre-wrap; +} + +.output-report { + font-size: 0.89em; +} + +.output-error { + color: #f44; +} + +.output-warning { + color: #fb0; +} + +.output-advice { + color: #2af; +} + +.output-style { + color: #0a0; +} + +.output-info { + color: #1cf; +} + +.output-faint { + opacity: 0.75; +} + +.output-fainter { + opacity: 0.55; +} + +.output-media-wrapper { + display: flex; +} + +.output-image { + border-radius: 0.5em; + max-width: 50vw; +} + +.output-image-label { + font-size: 1em; + font-family: "Code Font", monospace; + color: white; + text-shadow: 0 0 0.5em black; + /* put the label in the corner of the image */ + position: absolute; + margin-top: 0.3em; + margin-left: 0.4em; +} + +.output-audio { + border-radius: 0.5em; + max-width: 50vw; +} + +.output-audio-label { + font-size: 1em; + font-family: "Code Font", monospace; + margin-right: 0.5em; + align-self: center; +} + +#code-right-side { + display: flex; + position: absolute; + top: 0.1em; + right: 0.2em; + padding-right: 0.3em; + font-size: min(1em, 3vw); + align-items: center; +} + +#glyphs-toggle-button { + font-weight: bolder; + font-size: 0.9em; +} + +#glyphs-toggle-button:hover:after { + font-size: 0.6em; +} + +.editor-right-button { + font-weight: bolder; + opacity: 0.5; +} + +.editor-right-button:hover { + opacity: 1; +} + +.info-button:hover::after, +.editor-right-button:hover::after, +.experimental-icon:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 1em; + left: calc(-8em - 50%); + bottom: 1.5em; + color: #eee; + padding: 0.2em; + border-radius: 0.2em; + pointer-events: none; +} + +.editor-right-button:hover::after, +.experimental-icon:hover::after { + background-color: #000b; + width: 8em; +} + +.info-button:hover::after { + background-color: #000d; + width: 24em; + white-space: pre-wrap; + text-align: left; +} + +.experimental-icon { + position: relative; +} + +.experimental-icon:hover::after { + left: 100% !important; + bottom: 0 !important; +} + +#example-tracker { + margin-left: 0.5em; + font-size: 0.8em; +} + +.glyph-buttons { + padding: 0.1em; + font-size: 1.4em; + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + align-items: baseline; +} + +.glyph-button { + font-family: "Code Font", monospace; + font-size: 0.87em; + padding: 0.05em; + margin: 0em; + background-color: transparent; +} + +.glyph-button:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 0.7em; + bottom: 100%; + color: #eee; + background-color: #000a; + padding: 0.1em; + border-radius: 0.2em; + left: -1em; + width: 7em; + pointer-events: none; + z-index: 1; + white-space: pre-wrap; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.experimental-glyph-button { + display: none; +} + +.prim-code-a { + text-decoration: none; + white-space: nowrap; +} + +.prim-glyph { + font-weight: 400; +} + +.prim-code:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 0.8em; + bottom: 100%; + color: #eee; + background-color: #000d; + padding: 0.2em; + border-radius: 0.2em; + left: 0; + pointer-events: none; + width: 10em; + text-decoration: none; + white-space: pre-wrap; + overflow: visible; + line-height: 1em; + z-index: 1; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.glyph-doc { + position: absolute; + top: min(10%, 1em); + left: 10%; + padding: 0.5em; + font-size: 0.75em; + border-radius: 0.5em; + max-width: 80%; + white-space: pre-wrap; + font-family: "Code Font", monospace; + z-index: 1; +} + +@media (prefers-color-scheme: dark) { + + .glyph-doc { + background-color: #000c; + } + + .glyph-doc-ctrl-click { + color: #aaa; + } +} + +@media (prefers-color-scheme: light) { + + .glyph-doc { + background-color: #fffd; + } + + .glyph-doc-ctrl-click { + color: #777; + } +} + +.glyph-doc-ctrl-click { + font-size: 0.7em; +} + +.code-font { + font-family: "Code Font", monospace; +} + +.combinator-diagram { + border-radius: 0.5em; + height: 8em; +} + +@media (prefers-color-scheme: dark) { + .stack-function { + color: #d1daec; + } +} + +@media (prefers-color-scheme: light) { + .stack-function { + color: #344; + } +} + +.private-binding>* { + opacity: 0.75; +} + +.module { + color: #d7be8c; +} + +.noadic-function { + color: #ed5e6a; +} + +.monadic-function { + color: #95d16a; +} + +.dyadic-function { + color: #54b0fc; +} + +.triadic-function { + color: #8078f1; +} + +.tetradic-function { + color: #f576d8; +} + +.variadic-function { + background-image: linear-gradient(170deg, + #ed5e6a 34%, + #95d16a 34%, + #95d16a 45%, + #54b0fc 45%, + #54b0fc 56%, + #8078f1 56%, + #8078f1 67%, + #f576d8 67%); +} + +.monadic-modifier { + color: #f0c36f; +} + +.dyadic-modifier { + color: #cc6be9; +} + +.triadic-modifier { + color: #F5A9B8 +} + +.space-character { + border-width: 2px; + border-radius: 0.3em; + border-style: dashed; + margin: 0 -2px; +} + +@media (prefers-color-scheme: dark) { + .string-literal-span { + color: #20f9fc; + } + + .space-character { + border-color: #20f9fc80; + } + + .strand-span { + color: #fff8; + } +} + +@media (prefers-color-scheme: light) { + .string-literal-span { + color: #1c9; + } + + .space-character { + border-color: #1c98; + } + + .strand-span { + color: #0008; + } +} + +.number-literal { + color: #f85; +} + + +.comment-span { + color: #888; +} + +@media (prefers-color-scheme: dark) { + .output-a { + color: #cff; + } + + .output-b { + color: #ccf; + } + + .output-c { + color: #fcf; + } + + .output-d { + color: #fcc; + } + + .output-e { + color: #ffc; + } + + .output-f { + color: #cfc; + } +} + +@media (prefers-color-scheme: light) { + + .output-a { + color: #225; + } + + .output-b { + color: #525; + } + + .output-c { + color: #522; + } + + .output-d { + color: #552; + } + + .output-e { + color: #252; + } + + .output-f { + color: #255; + } +} + +#editor-help { + margin: 0.4em 0 0 0; + font-size: 1em; + opacity: 0.5; + display: flex; + justify-content: space-between; + gap: 0.5em; +} + +#editor-help:empty { + display: none; +} + +#editor-help>* { + line-height: 1em; + margin: 0; + white-space: pre-wrap; +} + +.sound-button { + background-color: transparent; +} + +.tutorial-nav { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 1.1em; + gap: 0.5em; +} + +.tutorial-nav>* { + border-radius: 0.5em; + border-color: #0003; + border-radius: 0.5em; + padding: 0.5em; +} + +.tutorial-nav>*:empty { + background-color: #0000; +} + +.primitive-list { + display: flex; + flex-wrap: wrap; + flex-direction: column; +} + +.primitive-list>* { + margin-bottom: 0.5em; +} + +#ascii-glyphs { + display: flex; + justify-content: space-evenly; + flex-wrap: wrap; +} + +.input-div { + display: flex; + align-items: center; + font-size: 1em; + border-radius: 0.5em; + padding: 0.5em; + width: min(100%, max(30%, 22em)); +} + +input[type=text] { + font-size: 1em; + border-radius: 0.5em; + padding: 0 0.5em; + outline: none; + border: none; + width: 100%; +} + +#function-search { + scroll-margin-top: 1em; + scroll-margin-bottom: 1em; +} + +#function-search-wrapper { + display: flex; + justify-content: space-between; + align-items: center; +} + +.running-text { + animation: fadeAnimation 1s infinite; +} + +.slow-pulse { + animation: pulseAnimation 2s infinite; +} + +@keyframes fadeAnimation { + + 0%, + 100% { + opacity: 0.5; + } + + 50% { + opacity: 1; + } +} + + +@keyframes pulseAnimation { + + 0%, + 100% { + transform: scale(1) translate(0); + } + + 50% { + transform: scale(1, 1.1) translate(0, -0.05em); + } +} + +.uiuism-item { + display: flex; + justify-content: space-between; + align-items: center; +} + +.pls-no-block { + font-size: 0.7em; +} + +a.clean { + text-decoration: none; +} + +.experimental { + color: #db2; +} + +.text-gradient { + background-size: 100%; + background-clip: text; + -webkit-background-clip: text; + -moz-background-clip: text; + -webkit-text-fill-color: transparent; + -moz-text-fill-color: transparent; +} + +.trans { + background-image: linear-gradient(180deg, + #5BCEFA 34%, + #F5A9B8 34%, + #F5A9B8 45%, + #FFFFFF 45%, + #FFFFFF 56%, + #F5A9B8 56%, + #F5A9B8 67%, + #5BCEFA 67%); +} + +.bi { + background-image: linear-gradient(180deg, + #D60270 45%, + #9B4F96 45%, + #9B4F96 64%, + #0038A8 64%); +} + +.pan { + background-image: linear-gradient(180deg, + #FF218C 45%, + #FFD800 45%, + #FFD800 64%, + #21B1FF 64%); +} + +.gay { + background-image: linear-gradient(180deg, + #E40303 30%, + #FFA52C 30%, + #FFA52C 40%, + #FFFF41 40%, + #FFFF41 50%, + #008018 50%, + #008018 60%, + #0000F9 60%, + #0000F9 70%, + #86007D 70%); +} + +.ace { + background-image: linear-gradient(180deg, + #000000 30%, + #A3A3A3 30%, + #A3A3A3 50%, + #FFFFFF 50%, + #FFFFFF 70%, + #800080 70%); +} + +.aro { + background-image: linear-gradient(180deg, + #000000 36%, + #A9A9A9 36%, + #A9A9A9 47%, + #FFFFFF 47%, + #FFFFFF 58%, + #A7D379 58%, + #A7D379 69%, + #3DA542 69%); + +} + +.aroace { + background-image: linear-gradient(180deg, + #ef9007 36%, + #f6d317 36%, + #f6d317 47%, + #FFFFFF 47%, + #FFFFFF 58%, + #45bcee 58%, + #45bcee 69%, + #1e3f54 69%); + +} + +.nb { + background-image: linear-gradient(180deg, + #FCF434 30%, + #FFFFFF 30%, + #FFFFFF 50%, + #9C59D1 50%, + #9C59D1 70%, + #2C2C2C 70%); +} + +.fluid { + background-image: linear-gradient(180deg, + #FF76A4 36%, + #FFFFFF 36%, + #FFFFFF 47%, + #C011D7 47%, + #C011D7 58%, + #000000 58%, + #000000 69%, + #2F3CBE 69%); +} + +.queer { + background-image: linear-gradient(180deg, + #B57EDC 48%, + #FFFFFF 48%, + #FFFFFF 65%, + #4A8123 65%); +} + +.lesbian { + background-image: linear-gradient(180deg, + #d42c00 34%, + #fd9855 34%, + #fd9855 45%, + #FFFFFF 45%, + #FFFFFF 56%, + #d161a2 56%, + #d161a2 67%, + #a20161 67%); +} + +.caution { + background-image: linear-gradient(135deg, + #000000 30%, + #FFF000 30%, + #FFF000 40%, + #000000 40%, + #000000 50%, + #FFF000 50%, + #FFF000 60%, + #000000 60%, + #000000 70%, + #FFF000 70%); +} + +@media (prefers-color-scheme: light) { + + .trans, + .bi, + .pan, + .ace, + .aro, + .aroace, + .gay, + .nb, + .fluid, + .queer, + .lesbian, + .caution { + -webkit-text-stroke: 0.01em #000; + } +} + +@media (prefers-color-scheme: dark) { + + .bi, + .nb, + .ace, + .aro, + .aroace, + .fluid, + .caution { + -webkit-text-stroke: 0.01em #fff8; + } +} \ No newline at end of file diff --git a/docs/styles.css b/docs/styles.css new file mode 100644 index 000000000..8aedf2874 --- /dev/null +++ b/docs/styles.css @@ -0,0 +1,1355 @@ +@font-face { + font-family: "Code Font"; + src: url(Uiua386.ttf) format("truetype"); +} + +html * { + font-family: "Segoe UI", "Arial", sans-serif; +} + +html { + font-size: 115%; + font-weight: 500; +} + +body { + margin: 0; +} + +p { + line-height: 1.5em; +} + +h2 { + margin: 1.8em 0 0.5em 0; + padding-bottom: 0.3em; + border-bottom-width: 0.08em; + border-bottom-style: solid; + border-color: #888a; +} + +.header { + position: relative; +} + +a.header, +a:visited.header, +a:link.header { + text-decoration: none; + color: inherit; +} + +a.header::before { + position: absolute; + left: -1.5em; + bottom: 0.4em; + content: "🔗"; + opacity: 0; + font-size: 0.6em; + transition: opacity 0.2s; +} + +a.header:hover::before { + opacity: 0.5; +} + +h1>a>code, +h2>a>code { + font-weight: normal; +} + +button { + border-width: 0; + border-radius: 0.5em; + padding: 0.2em; + display: inline-block; + position: relative; +} + +button:active { + transform: translateY(0.1em); +} + +code { + font-family: "Code Font", monospace; + border-radius: 0.2em; + padding: 0.2em; + position: relative; +} + +th, +td { + padding: 0.3em; + border-radius: 0.5em; +} + +th { + text-align: left; +} + +tr:nth-child(even) { + background-color: #0001; +} + +.bordered-table { + border: 0.2em solid #0005; + border-radius: 0.5em; +} + +.header-centered-table>tr>th { + text-align: center; + +} + +.cell-centered-table>tr>td { + text-align: center; +} + +li { + margin: 0.3em 0; +} + +@media (prefers-color-scheme: dark) { + + body, + #header-uiua, + .spoiler:hover { + color: #d1daec; + } + + body, + .spoiler:hover { + background-color: #141a1f; + } + + #editor { + outline: 0.1em solid #606468; + background-color: #19232d; + } + + .code, + .input-div, + input[type=text], + #settings>*>*>input, + #settings>*>*>select { + color: #d1daec; + background-color: #1d2c3a; + } + + button { + color: #d1daec; + background-color: #1d2c3a; + } + + button:hover { + background-color: #2d3c4a; + } + + a:link { + color: #6fadea; + } + + a:visited { + color: #947bec; + } + + code { + background-color: #0004; + } + + .important-button { + background-color: #33577b; + } + + .important-button:hover { + background-color: #579; + } + + .tutorial-nav>* { + background-color: #1d2c3a; + } + + tr:nth-child(even) { + background-color: #0001; + } + + .glyph-button:hover, + .combinator-diagram { + background-color: #0003; + } + + .code-entry { + caret-color: white; + } + + #subtitle { + color: #d1daecc0; + } +} + +@media (prefers-color-scheme: light) { + + body, + #header-uiua, + .spoiler:hover { + color: #344; + } + + body, + .spoiler:hover { + background-color: #c6e7ec; + } + + #editor { + background-color: #dff2f3; + outline: 0.1em solid #0004; + } + + .code, + .input-div, + input[type=text], + #settings>*>*>input, + #settings>*>*>select { + color: #344; + background-color: #f4f6f6; + } + + button { + color: #344; + background-color: #f6f8f8; + } + + button:hover { + background-color: #fdffff; + } + + a:link { + color: #0099ad; + } + + a:visited { + color: #6a4bfb; + } + + code { + background-color: #fff8; + } + + .important-button { + background-color: #aadae0; + } + + .important-button:hover { + background-color: #bee2e7; + } + + .tutorial-nav>* { + background-color: #f6f8f8; + } + + tr:nth-child(even) { + background-color: #fff1; + } + + .glyph-button:hover, + .combinator-diagram { + background-color: #fffa; + } + + .code-entry { + caret-color: black; + } + + #subtitle { + color: #344c; + } +} + +#top { + margin: 2em auto; + width: max(10em, min(90%, 53em)); +} + +#header { + display: flex; + justify-content: space-between; + align-items: last baseline; + flex-wrap: wrap; + gap: 1em; + margin-bottom: 1em; +} + + +#header-left { + display: flex; + align-items: last baseline; + margin: -1em 0; +} + +#header-uiua { + text-decoration: none; + white-space: nowrap; +} + +#subtitle { + margin-left: 1.5em; + font-size: 1em; + font-weight: bold; + font-style: italic; +} + +.spoiler { + color: #0000; + background-color: #0008; + border-radius: 0.5em; +} + +.long-subtitle { + font-size: 0.9em; +} + +.long-subtitle>div { + display: flex; + gap: 0.5em; + flex-wrap: nowrap; + white-space: nowrap; +} + +#nav { + display: flex; + gap: 1em; + flex-wrap: nowrap; + align-items: baseline; +} + +#links { + font-size: 1.2em; + display: flex; + justify-content: center; + flex-wrap: wrap; + gap: 1em; + margin-bottom: 1em; + align-content: flex-start; +} + +#links>* { + display: flex; + gap: 1em; + flex-wrap: wrap; + justify-content: space-between; + align-content: flex-start; +} + +.main-text { + font-size: 120%; + text-align: center; +} + +.wee-wuh-span { + font-size: 70%; + opacity: 0.8; +} + +.features { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: min(3em, 3vw); + width: min(120%, 90vw); + margin-left: calc(-0.5 * (min(120%, 90vw) - 100%)); +} + +.features>* { + flex: 1 1 22em; + width: 0; +} + +#editor { + border-radius: 0.5em; + position: relative; +} + +#drag-message { + position: absolute; + inset: 0; + display: flex; + justify-content: center; + align-items: center; + background-color: #0008; + font-size: 2em; +} + +#editor-wrapper { + margin-bottom: 0.5em; + font-size: min(1em, 3.5vw); +} + +.small-editor { + font-size: 1.2em; +} + +.medium-editor { + font-size: 1.4em; +} + +#settings { + display: flex; + justify-content: space-between; + font-size: 0.82em; + padding: 0.2em; + gap: 0.5em; +} + +#settings>* { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 0.2em 1em; +} + +#settings-left { + width: 85%; + justify-content: space-between; +} + +#settings-right { + flex-direction: column; + align-items: flex-end; +} + +#settings>*>* { + display: inline-block; + white-space: nowrap; +} + +input[type=number] { + appearance: textfield; + -moz-appearance: textfield; +} + +.code-block { + display: block; + white-space: pre-wrap; + padding: 0.8em; +} + +#settings>*>*>input, +#settings>*>*>select { + border-radius: 0.5em; + border: none; + margin-left: 0.5em; +} + +#settings>*>*>input[type=number] { + width: 3em; +} + +#code-area { + position: relative; +} + +.code-outer { + text-align: left; + border-radius: 0.5em; + width: 100%; + resize: vertical; + box-sizing: border-box; + outline: none; + border: none; + padding: 0.3em; + min-height: 1.8em; + overflow-y: auto; + display: flex; + gap: 0.1em; + overflow-y: hidden; +} + +.code-and-overlay { + width: 100%; + position: relative; +} + +.code-entry { + margin: 0.1em 0 0 0; + padding: 0; + position: absolute; + outline: none; + border: none; + box-sizing: border-box; + /* background-color: #0002; */ + /* color: #0008; */ + background-color: transparent; + color: transparent; + resize: none; + font-family: "Code Font", monospace; + font-size: inherit; + line-height: 1.25em; + overflow-wrap: normal; + white-space: pre; + overflow: hidden; + height: 100%; +} + +.code-entry::selection { + color: transparent; + background-color: #0078d7; +} + +.code-overlay { + margin: 0; + padding: 0; + position: absolute; + width: 100%; + pointer-events: none; + white-space: pre; +} + +.code-line { + height: 1.25em; + padding: 0; + margin: 0; +} + +.line-numbers { + min-width: 1.5em; +} + +@media (prefers-color-scheme: dark) { + .line-numbers { + color: #3f4b5d; + } +} + +@media (prefers-color-scheme: light) { + .line-numbers { + color: #bcc9ca; + } +} + +.code-span { + font-size: 1em; + font-family: "Code Font", monospace; + white-space: pre; + text-decoration: none; +} + +.code-hover { + display: none; + position: fixed; + font-family: "Code Font", monospace; + font-size: 0.7em; + color: #eee; + background-color: #000c; + padding: 0.2em; + border-radius: 0.2em; + pointer-events: none; + z-index: 1; + text-decoration: none; + white-space: pre-wrap; + overflow: visible; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.ctrl-pressed .code-underline:hover { + text-decoration: underline; + cursor: pointer; +} + +.output-frame { + display: flex; + justify-content: space-between; + min-height: 1.9em; +} + +.output-lines { + overflow-x: auto; +} + +.output-diagnostics { + white-space: pre-wrap; + text-align: left; + margin-left: 1.75em; + padding: 0.3em 0; + font-family: "Code Font", monospace; +} + +.output-wrapper { + transform: rotateX(180deg); + overflow-x: auto; +} + +.output { + white-space: pre; + text-align: left; + margin-left: 1.85em; + padding: 0.4em 0; + font-family: "Code Font", monospace; + transform: rotateX(180deg); +} + +.output:empty, +.output-diagnostics:empty { + display: none; +} + +.output-item, +.output-report { + font-family: inherit; +} + +#code-buttons { + margin: 0.2em 0.2em 0.2em 0; + display: flex; + flex-wrap: nowrap; + right: 0; + max-height: 1.5em; +} + +.code-button { + font-size: 0.9em; + margin: 0 0 0 0.2em; + height: auto; + text-align: center; + text-justify: center; +} + +.important-button { + animation: fadeAnimation 2s infinite; +} + +.output-line { + font-family: "Code Font", monospace; + font-size: inherit; + white-space: pre; +} + +.output-wrap-line { + white-space: pre-wrap; +} + +.output-report { + font-size: 0.89em; +} + +.output-error { + color: #f44; +} + +.output-warning { + color: #fb0; +} + +.output-advice { + color: #2af; +} + +.output-style { + color: #0a0; +} + +.output-info { + color: #1cf; +} + +.output-faint { + opacity: 0.75; +} + +.output-fainter { + opacity: 0.55; +} + +.output-media-wrapper { + display: flex; +} + +.output-image { + border-radius: 0.5em; + max-width: 50vw; +} + +.output-image-label { + font-size: 1em; + font-family: "Code Font", monospace; + color: white; + text-shadow: 0 0 0.5em black; + /* put the label in the corner of the image */ + position: absolute; + margin-top: 0.3em; + margin-left: 0.4em; +} + +.output-audio { + border-radius: 0.5em; + max-width: 50vw; +} + +.output-audio-label { + font-size: 1em; + font-family: "Code Font", monospace; + margin-right: 0.5em; + align-self: center; +} + +#code-right-side { + display: flex; + position: absolute; + top: 0.1em; + right: 0.2em; + padding-right: 0.3em; + font-size: min(1em, 3vw); + align-items: center; +} + +#glyphs-toggle-button { + font-weight: bolder; + font-size: 0.9em; +} + +#glyphs-toggle-button:hover:after { + font-size: 0.6em; +} + +.editor-right-button { + font-weight: bolder; + opacity: 0.5; +} + +.editor-right-button:hover { + opacity: 1; +} + +.info-button:hover::after, +.editor-right-button:hover::after, +.experimental-icon:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 1em; + left: calc(-8em - 50%); + bottom: 1.5em; + color: #eee; + padding: 0.2em; + border-radius: 0.2em; + pointer-events: none; +} + +.editor-right-button:hover::after, +.experimental-icon:hover::after { + background-color: #000b; + width: 8em; +} + +.info-button:hover::after { + background-color: #000d; + width: 24em; + white-space: pre-wrap; + text-align: left; +} + +.experimental-icon { + position: relative; +} + +.experimental-icon:hover::after { + left: 100% !important; + bottom: 0 !important; +} + +#example-tracker { + margin-left: 0.5em; + font-size: 0.8em; +} + +.glyph-buttons { + padding: 0.1em; + font-size: 1.4em; + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + align-items: baseline; +} + +.glyph-button { + font-family: "Code Font", monospace; + font-size: 0.87em; + padding: 0.05em; + margin: 0em; + background-color: transparent; +} + +.glyph-button:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 0.7em; + bottom: 100%; + color: #eee; + background-color: #000a; + padding: 0.1em; + border-radius: 0.2em; + left: -1em; + width: 7em; + pointer-events: none; + z-index: 1; + white-space: pre-wrap; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.experimental-glyph-button { + display: none; +} + +.prim-code-a { + text-decoration: none; + white-space: nowrap; +} + +.prim-glyph { + font-weight: 400; +} + +.prim-code:hover::after { + content: attr(data-title); + position: absolute; + font-family: "Code Font", monospace; + font-size: 0.8em; + bottom: 100%; + color: #eee; + background-color: #000d; + padding: 0.2em; + border-radius: 0.2em; + left: 0; + pointer-events: none; + width: 10em; + text-decoration: none; + white-space: pre-wrap; + overflow: visible; + line-height: 1em; + z-index: 1; + -webkit-text-fill-color: #eee; + -moz-text-fill-color: #eee; +} + +.glyph-doc { + position: absolute; + top: min(10%, 1em); + left: 10%; + padding: 0.5em; + font-size: 0.75em; + border-radius: 0.5em; + max-width: 80%; + white-space: pre-wrap; + font-family: "Code Font", monospace; + z-index: 1; +} + +@media (prefers-color-scheme: dark) { + + .glyph-doc { + background-color: #000c; + } + + .glyph-doc-ctrl-click { + color: #aaa; + } +} + +@media (prefers-color-scheme: light) { + + .glyph-doc { + background-color: #fffd; + } + + .glyph-doc-ctrl-click { + color: #777; + } +} + +.glyph-doc-ctrl-click { + font-size: 0.7em; +} + +.code-font { + font-family: "Code Font", monospace; +} + +.combinator-diagram { + border-radius: 0.5em; + height: 8em; +} + +@media (prefers-color-scheme: dark) { + .stack-function { + color: #d1daec; + } +} + +@media (prefers-color-scheme: light) { + .stack-function { + color: #344; + } +} + +.private-binding>* { + opacity: 0.75; +} + +.module { + color: #d7be8c; +} + +.noadic-function { + color: #ed5e6a; +} + +.monadic-function { + color: #95d16a; +} + +.dyadic-function { + color: #54b0fc; +} + +.triadic-function { + color: #8078f1; +} + +.tetradic-function { + color: #f576d8; +} + +.variadic-function { + background-image: linear-gradient(170deg, + #ed5e6a 34%, + #95d16a 34%, + #95d16a 45%, + #54b0fc 45%, + #54b0fc 56%, + #8078f1 56%, + #8078f1 67%, + #f576d8 67%); +} + +.monadic-modifier { + color: #f0c36f; +} + +.dyadic-modifier { + color: #cc6be9; +} + +.triadic-modifier { + color: #F5A9B8 +} + +.space-character { + border-width: 2px; + border-radius: 0.3em; + border-style: dashed; + margin: 0 -2px; +} + +@media (prefers-color-scheme: dark) { + .string-literal-span { + color: #20f9fc; + } + + .space-character { + border-color: #20f9fc80; + } + + .strand-span { + color: #fff8; + } +} + +@media (prefers-color-scheme: light) { + .string-literal-span { + color: #1c9; + } + + .space-character { + border-color: #1c98; + } + + .strand-span { + color: #0008; + } +} + +.number-literal { + color: #f85; +} + + +.comment-span { + color: #888; +} + +@media (prefers-color-scheme: dark) { + .output-a { + color: #cff; + } + + .output-b { + color: #ccf; + } + + .output-c { + color: #fcf; + } + + .output-d { + color: #fcc; + } + + .output-e { + color: #ffc; + } + + .output-f { + color: #cfc; + } +} + +@media (prefers-color-scheme: light) { + + .output-a { + color: #225; + } + + .output-b { + color: #525; + } + + .output-c { + color: #522; + } + + .output-d { + color: #552; + } + + .output-e { + color: #252; + } + + .output-f { + color: #255; + } +} + +#editor-help { + margin: 0.4em 0 0 0; + font-size: 1em; + opacity: 0.5; + display: flex; + justify-content: space-between; + gap: 0.5em; +} + +#editor-help:empty { + display: none; +} + +#editor-help>* { + line-height: 1em; + margin: 0; + white-space: pre-wrap; +} + +.sound-button { + background-color: transparent; +} + +.tutorial-nav { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 1.1em; + gap: 0.5em; +} + +.tutorial-nav>* { + border-radius: 0.5em; + border-color: #0003; + border-radius: 0.5em; + padding: 0.5em; +} + +.tutorial-nav>*:empty { + background-color: #0000; +} + +.primitive-list { + display: flex; + flex-wrap: wrap; + flex-direction: column; +} + +.primitive-list>* { + margin-bottom: 0.5em; +} + +#ascii-glyphs { + display: flex; + justify-content: space-evenly; + flex-wrap: wrap; +} + +.input-div { + display: flex; + align-items: center; + font-size: 1em; + border-radius: 0.5em; + padding: 0.5em; + width: min(100%, max(30%, 22em)); +} + +input[type=text] { + font-size: 1em; + border-radius: 0.5em; + padding: 0 0.5em; + outline: none; + border: none; + width: 100%; +} + +#function-search { + scroll-margin-top: 1em; + scroll-margin-bottom: 1em; +} + +#function-search-wrapper { + display: flex; + justify-content: space-between; + align-items: center; +} + +.running-text { + animation: fadeAnimation 1s infinite; +} + +.slow-pulse { + animation: pulseAnimation 2s infinite; +} + +@keyframes fadeAnimation { + + 0%, + 100% { + opacity: 0.5; + } + + 50% { + opacity: 1; + } +} + + +@keyframes pulseAnimation { + + 0%, + 100% { + transform: scale(1) translate(0); + } + + 50% { + transform: scale(1, 1.1) translate(0, -0.05em); + } +} + +.uiuism-item { + display: flex; + justify-content: space-between; + align-items: center; +} + +.pls-no-block { + font-size: 0.7em; +} + +a.clean { + text-decoration: none; +} + +.experimental { + color: #db2; +} + +.text-gradient { + background-size: 100%; + background-clip: text; + -webkit-background-clip: text; + -moz-background-clip: text; + -webkit-text-fill-color: transparent; + -moz-text-fill-color: transparent; +} + +.trans { + background-image: linear-gradient(180deg, + #5BCEFA 34%, + #F5A9B8 34%, + #F5A9B8 45%, + #FFFFFF 45%, + #FFFFFF 56%, + #F5A9B8 56%, + #F5A9B8 67%, + #5BCEFA 67%); +} + +.bi { + background-image: linear-gradient(180deg, + #D60270 45%, + #9B4F96 45%, + #9B4F96 64%, + #0038A8 64%); +} + +.pan { + background-image: linear-gradient(180deg, + #FF218C 45%, + #FFD800 45%, + #FFD800 64%, + #21B1FF 64%); +} + +.gay { + background-image: linear-gradient(180deg, + #E40303 30%, + #FFA52C 30%, + #FFA52C 40%, + #FFFF41 40%, + #FFFF41 50%, + #008018 50%, + #008018 60%, + #0000F9 60%, + #0000F9 70%, + #86007D 70%); +} + +.ace { + background-image: linear-gradient(180deg, + #000000 30%, + #A3A3A3 30%, + #A3A3A3 50%, + #FFFFFF 50%, + #FFFFFF 70%, + #800080 70%); +} + +.aro { + background-image: linear-gradient(180deg, + #000000 36%, + #A9A9A9 36%, + #A9A9A9 47%, + #FFFFFF 47%, + #FFFFFF 58%, + #A7D379 58%, + #A7D379 69%, + #3DA542 69%); + +} + +.aroace { + background-image: linear-gradient(180deg, + #ef9007 36%, + #f6d317 36%, + #f6d317 47%, + #FFFFFF 47%, + #FFFFFF 58%, + #45bcee 58%, + #45bcee 69%, + #1e3f54 69%); + +} + +.nb { + background-image: linear-gradient(180deg, + #FCF434 30%, + #FFFFFF 30%, + #FFFFFF 50%, + #9C59D1 50%, + #9C59D1 70%, + #2C2C2C 70%); +} + +.fluid { + background-image: linear-gradient(180deg, + #FF76A4 36%, + #FFFFFF 36%, + #FFFFFF 47%, + #C011D7 47%, + #C011D7 58%, + #000000 58%, + #000000 69%, + #2F3CBE 69%); +} + +.queer { + background-image: linear-gradient(180deg, + #B57EDC 48%, + #FFFFFF 48%, + #FFFFFF 65%, + #4A8123 65%); +} + +.lesbian { + background-image: linear-gradient(180deg, + #d42c00 34%, + #fd9855 34%, + #fd9855 45%, + #FFFFFF 45%, + #FFFFFF 56%, + #d161a2 56%, + #d161a2 67%, + #a20161 67%); +} + +.caution { + background-image: linear-gradient(135deg, + #000000 30%, + #FFF000 30%, + #FFF000 40%, + #000000 40%, + #000000 50%, + #FFF000 50%, + #FFF000 60%, + #000000 60%, + #000000 70%, + #FFF000 70%); +} + +@media (prefers-color-scheme: light) { + + .trans, + .bi, + .pan, + .ace, + .aro, + .aroace, + .gay, + .nb, + .fluid, + .queer, + .lesbian, + .caution { + -webkit-text-stroke: 0.01em #000; + } +} + +@media (prefers-color-scheme: dark) { + + .bi, + .nb, + .ace, + .aro, + .aroace, + .fluid, + .caution { + -webkit-text-stroke: 0.01em #fff8; + } +} \ No newline at end of file diff --git a/docs/text/code_tactility.md b/docs/text/code_tactility.md new file mode 100644 index 000000000..a4a01764b --- /dev/null +++ b/docs/text/code_tactility.md @@ -0,0 +1,127 @@ +# Code Tactility + +One of the strengths of interpreted programming languages, and array languages in particular, is their high level of interactivity. It is very easy to experiment with code, moving data and functions around to get a better sense of the solution to a problem. + +This exercise can be likened to "feeling" the code, turning it around in your hand, poking it, prodding it, inspecting it. + +This section covers a few tools that Uiua provides for making code easier to work with and debug. + +## [stack]() and [trace]() + +Uiua already prints out any values left on the stack when the program ends. This is usually enough for smaller programs, but sometimes, you need to be able to see what values are on the stack somewhere in the middle of the code. + +[stack]() and [trace]() were mentioned near the [beginning](/tutorial/basic#stack-and-trace) of this tutorial. They both print out values from the stack without removing them. [stack]() prints all values while [trace]() only prints one. + +```uiua +5 ? 1 [2 3] "uiua" +``` + +```uiua +5 1 ⸮ ⇡3 "uiua" +``` +As you can see, the line and column number is also printed. + +The formatter will convert two `?`s into [trace](). Try it below. + +```uiua +?? √5 +``` + +Multiple [trace]()'s next to each other will combine to show multiple stack values. + +```uiua +⸮⸮⸮ 1 2 3 4 5 +``` + +[stack]() will show you the boundaries of the functions that values are used in. + +```uiua +G ← /+?⇡ +F ← ×G +F 10 4 +``` + +[stack]() and [trace]() allow you to inspect the stack at a given place in the code. They make it easy to get a quick sense of what values a function is working with. + +## Labels + +Labels allow you to tag an array with a debug-only name. They are written with a `$` immediately followed by an identifier. + +```uiua +$Numbers [1 2 3] +``` + +Labels are *only* visible in debugging outputs. This includes normal interpreter output as well as [stack]() and [trace](). + +Labels will *not* be shown when arrays are formatted using [`&p`]() or format strings. + +```uiua +&p $"--_--" . $TheThing ⇡5 +``` + +You can easily label multiple values with [bracket](). + +```uiua +⊓$Foo$Bar °⊂ [2 3 5 7] +``` + +Labeled arrays cannot be put into arrays together unless they are boxed. + +```uiua +[$a 1 $b 2 $c 3] # Wrong +``` +```uiua +{$a 1 $b 2 $c 3} # Right +``` + +Labels are nice for keeping track of different values as they move around the stack. + +It is not possible to retrieve the label of a value using code. Labels are only for debugging, not for carrying data. + +## Line Manipulation + +Uiua running code right-to-left has a couple unfortunate side effects when it comes to editing. The first you're likely to run into is having to constantly press the `←` key on your keyboard to move the cursor to the left. + +If you type a `;` character, the formatter will flip the current line across it. This allows you to enter code in the same order it is executed. + +```uiua +⇡12;↯3_4 # Format to flip! +``` + +You can put many `;`s on the same line. +```uiua +1;2;3;4 +``` + +Another problems is that if you want to split a line of code into two lines, it is not enough to simply place your cursor at the split point and press Enter, as this puts the lines in the wrong order! + +Instead, you can type `;;` at the point you want to split the code. Upon formatting, the line will be split in a way that preserves the same meaning! + +```uiua +↥⊸⇌;;⊞=.⇡5 # Format to split! +``` + +You can put as many of these splitters in your code as you like, and the formatter will handle them all at once. + +```uiua +"lines";;"the";;"all";;"Split" +``` + +If used in a binding, the code will be wrapped in `()`s. + +```uiua +F ← ⁅∵⋅⚂;;↯⟜⊚ # Format it! +F 5 +``` + +Putting a splitter at the beginning or end of a line will *join* lines rather than splitting them. + +```uiua +1 2 +;3 4 +``` + +```uiua +"Oh"; +"boy!" +``` diff --git a/docs/text/experimental.md b/docs/text/experimental.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/text/files_and_streams.md b/docs/text/files_and_streams.md new file mode 100644 index 000000000..4757a0b5a --- /dev/null +++ b/docs/text/files_and_streams.md @@ -0,0 +1,104 @@ +# Files and Streams + +Uiua has support for reading and writing files from the filesystem. It has helper functions for reading and writing entire files, as well as a stream abstraction for processing files in chunks. This stream abstraction extends to other input/output sources, such as network sockets. + +## Reading and Writing Entire Files + +Loading an entire file into an array is very simple. +For demonstration purposes, this website has a built-in file called `example.txt` that we will work with. + +We can read an entire file as a string with [`&fras`]() (file read all string). + +```uiua +&fras "example.txt" +``` + +If we instead want to read the file into an array of bytes, we can use [`&frab`]() (file read all bytes). + +```uiua +&frab "example.txt" +``` + +To write an entire array to a file, we can use [`&fwa`]() (file write all). The type of the array determines whether the file is written as text or binary. + +```uiua +&fwa "file.txt" "Hello, world!" +``` + +Each editor on this site has a virtual file system, which means that we can read from files after they have been written to. This is useful for testing file writing functions. + +```uiua +&fwa "file.bin" ⇡10 +&frab "file.bin" +``` + +## Streams + +Stream are an abstraction for sending and receiving data in chunks from some source. Similar concepts exist in many programming languages, inluding Uiua. + +In this tutorial, we will focus on using streams to interact with files. However, Uiua also uses streams for other input/output sources, particularly network sockets. + +## Reading Streams + +Streams in Uiua are passed around as *handles* - boxed integer values that can be used to look up the stream in the interpreter. Functions that create streams return these handles, and they attach some metadata about what kind of stream it is for debugging purposes. + +We can use [`&fo`]() (file open) to open a file for reading. This function returns a stream handle. + +```uiua +&fo "example.txt" +``` + +There are a few functions for reading from streams. The most basic two are [`&rs`]() (read string) and [`&rb`]() (read bytes). These functions read at most a certain number of bytes from the stream and return them as a character or byte array, respectively. + +Here, we open a file with [`&fo`]() and then read 10 bytes from it. [`&rb`]() simply puts the bytes in an array, while [`&rs`]() converts them to a string. +``` +&rb 10 &fo "example.txt" +&rs 10 &fo "example.txt" +``` + +If we pass [`infinity`]() as the number of bytes to read, the stream will read until the end of the file. This is functionally equivalent to [`&fras`]() or [`&frab`](). + +```uiua +&rs ∞ &fo "example.txt" +``` + +If we want to read up until some delimiter, we can use [`&ru`]() (read until). This function reads from the stream until it encounters a certain sequence of characters or bytes, and returns everything up to that point. +If the delimiter is not found, the function will read until the end of the stream. + +```uiua +&ru "file" &fo "example.txt" +``` + +In general, you only need to use streams to read from a file if the file is too large to fit in memory. For most use cases, [`&fras`]() and [`&frab`]() are sufficient. + +## Writing Streams + +The [`&w`]() (write) function writes a character or byte array to a stream. It takes the data to write and the stream handle as arguments. + +```uiua +&w "Hello, world!" &fc "file.txt" +``` + +But wait, if we try to read from the file now, it is empty! + +```uiua +&w "Hello, world!" &fc "file.txt" +&fras "file.txt" +``` + +This is because the writes we have made have not been flushed to the file. +Streams should always be closed with [`&cl`]() (close) when they are no longer needed. This will flush any remaining writes to the file and close the file handle. + +```uiua +&cl &w "Hello, world!" . &fc "file.txt" +&fras "file.txt" +``` + +Knowing this, we see that the examples in the section above are actually incorrect! We should close the file even after reading from it. + +[`under`]() can help here. It will automatically close the stream with [`&cl`]() after the block of code is executed. + +```uiua +⍜(&fc "file.txt"|&w "Hello, world!") +&fras "file.txt" +``` \ No newline at end of file diff --git a/docs/text/format_config.md b/docs/text/format_config.md new file mode 100644 index 000000000..32da54a19 --- /dev/null +++ b/docs/text/format_config.md @@ -0,0 +1,62 @@ + +# Uiua Formatter Configuration + +You can configure Uiua's formatter by creating a file called `.fmt.ua` in the directory from which you run the interpreter. This configuration file is also a Uiua program. + +Configuration options are specified by binding values to specific names. + +Example with default values: +```uiua +TrailingNewline ← 1 +CommentSpaceAfterHash ← 1 +MultilineIndent ← 2 +AlignComments ← 1 +IndentItemImports ← 1 +``` +The following configuration options are available: + +### TrailingNewline +Type: boolean + +Default: `1` + +Whether to add a trailing newline to the output. + +--- + +### CommentSpaceAfterHash +Type: boolean + +Default: `1` + +Whether to add a space after the `#` in comments. + +--- + +### MultilineIndent +Type: natural number + +Default: `2` + +The number of spaces to indent multiline arrays and functions + +--- + +### AlignComments +Type: boolean + +Default: `1` + +Whether to align consecutive end-of-line comments + +--- + +### IndentItemImports +Type: boolean + +Default: `1` + +Whether to indent item imports + +--- + diff --git a/docs/text/ranges.md b/docs/text/ranges.md new file mode 100644 index 000000000..f83053538 --- /dev/null +++ b/docs/text/ranges.md @@ -0,0 +1,30 @@ +# Ranges + +Working with regular sequences of numbers is a common task in programming. Many languages handle this with with a `for` loop, but Uiua uses the same thing it uses for most things: arrays. + +## [`range`]() + +[`range`]() is the fundamental range-generating function. It generates a list of integers starting at `0` and ending at `n - 1`. + +```uiua +⇡5 +⇡12 +``` + +If you want to include the end value, you can [`add`]()`1` first. + +```uiua +⇡+1 5 +⇡+1 12 +``` + +[`add`]()`1` afterward to get the range `[1, n]`. + +```uiua ++1⇡ 5 ++1⇡ 12 +``` + +## [`under`]() Tricks + +[`under`]() makes getting more complex ranges simple. \ No newline at end of file diff --git a/docs/text/strings.md b/docs/text/strings.md new file mode 100644 index 000000000..8e7149edf --- /dev/null +++ b/docs/text/strings.md @@ -0,0 +1,139 @@ +# Working with Strings + +There is a common misconception that array languages like Uiua are only really good for mathematical tasks; that rich text processing is better left to more traditional languages. This is not the case! Strings are, after all, just arrays of characters! + +That being said, it may not be immediately clear how to perform common string manipulations in Uiua. This tutorial will cover the basics. + +## Converting numbers with [`parse`]() + +[`parse`]() is the standard way to convert a string to a number. +```uiua +⋕"5.2" +``` +It can also be used on arrays of boxed strings. +```uiua +⋕{"3" "-16" "π" "1e3"} +``` +[`un`]()[`parse`]() will convert numbers to strings. +```uiua +°⋕ 10 +°⋕ [1 2 3] +°⋕ ↯3_4⇡12 +``` + +## Splitting with [`partition`]() + +As discussed in the [Thinking With Arrays](/tutorial/thinkingwitharrays) tutorial, [`partition`]() can be used to split an array by a delimiter. + +First, we create a mask of places where the delimiter is *not* using [`by`]() [`not equals ≠`](). In this case, we'll use the space character. +```uiua +⊸≠@ "Split this string" +``` +[`partition`]() will then split the strings at the places where the mask changes, omitting `0`s. +```uiua +⊜□ ⊸≠@ "Split this string" +``` +Notice that this reads almost as a description of what it does: "Partition box by not equals space" + +[`partition`]() has an alternate functionality when its function has signature `|2.1` instead of `|1.1`. This will perform a reduction operation, similar to [`reduce`](). + +Using [planet notation](/tutorial/advancedstack#planet-notation), we can select the first or last split section. +```uiua +⊜⊙◌ ⊸≠@ "Split this string" +``` +```uiua +⊜⋅∘ ⊸≠@ "Split this string" +``` +For parts of the string that are not the first or last, we can simply [`box`]() and [`select`](). +```uiua +⊏1_3 ⊜□⊸≠@, "lorem,ipsum,dolor,sit,amet" +``` + +[`partition`]() can be nested to split by multiple delimiters. + +For example, if you were reading from a file that contained rows of numbers separated by spaces, you could use [`partition`]() to create a multi-dimensional array. + +Here, the contents of the file will be represented as a multi-line string. We use [`parse`]() as the inner function to parse the numbers. + +```uiua +$ 1 8 4 99 +$ 5 20 0 0 +$ 78 101 1 8 +⊜(⊜⋕⊸≠@ )⊸≠@\n +``` + +This assumes that the two delimiters delimit different dimensions of the array. If they delimit the same dimension, we can use [`not`]() and [`memberof`](). +```uiua +$ 1 8 4 99 +$ 5 20 0 0 +$ 78 101 1 8 +⊜⋕¬⊸∈" \n" +``` + +## Finding substrings with [`mask`]() + +What if we want to split by a non-scalar delimiter? Simply dropping a string delimiter into the code above produces an error. +```uiua should fail +⊜□ ⊸≠" - " "foo - bar - ba-az" +``` +We might try [`find`](). While there may be cases when this output is useful, it is not quite what we want here. +```uiua + ⊸⌕" - " "foo - bar - ba-az" +⊜□ ¬⊸⌕" - " "foo - bar - ba-az" +``` +This is because [`find`]() only marks the start of each matching substring. + +[`mask`]() marks each substring with an increasing number. +```uiua +⊸⦷" - " "foo - bar - ba-az" +``` +This works great with [`partition`]() to split the string how we want. +```uiua + ⊸⦷" - " "foo - bar - ba-az" + ¬⊸⦷" - " "foo - bar - ba-az" +⊜□ ¬⊸⦷" - " "foo - bar - ba-az" +``` +Notice that while [`not`]() leaves parts of the mask negative, [`partition`]() ignores all sections that are not positive. + +## Replacing substrings with [`under`]() + +Because [`under`]() works with [`partition`](), we can use it with [`mask`]() to replace substrings. + +In this example, we replace each row of the [`partition`]()ed array with the string `"orb"`. +```uiua + ⊸⦷ "ab" "abracadabra" + ⊜∘ ⊸⦷ "ab" "abracadabra" +⍜⊜∘≡⋅"orb" ⊸⦷ "ab" "abracadabra" +``` +This can even be used to replace the matches with different strings. +```uiua +⍜⊜□◌ ⊸⦷ "ab" "abracadabra" {"[first]" "[second]"} +``` +Here is how you might replace with a variable number of strings. +```uiua +F ← ⍜⊜□(↙⧻) ⊸⦷ "ab" :°⋕⇡10 +F "abracadabra" +F "abcdefg" +F "ababab|abababab" +``` + +## [`regex`]() + +When a string search operation is especially complicated, you can always fall back to regular expressions using [`regex`](). + +Uiua uses [Rust's regex engine](https://docs.rs/regex) under the hood, so you can use the same syntax as you would in Rust. + +[`regex`]() returns a table of boxed strings. The first element in each row is the match. Subsequent elements are the captures. +```uiua +regex "\\d{3,4}" "(555) 310-1984" +``` +```uiua +regex "a([bc])" "abracadabra" +``` +Optional captures may need [`fill`]() to avoid errors. +```uiua should fail +regex "foo(bar)?(baz)?" "foobar\nfoobaz" +``` +```uiua +⬚""regex "foo(bar)?(baz)?" "foobar\nfoobaz" +``` \ No newline at end of file diff --git a/docs/text/tacit_code.md b/docs/text/tacit_code.md new file mode 100644 index 000000000..c1bdb73ee --- /dev/null +++ b/docs/text/tacit_code.md @@ -0,0 +1,236 @@ +# Tacit Code + +So far, most of the code examples in this tutorial have been fairly short. While Uiua is great for short, simple code, it is designed to be a general-purpose language. Uiua aims to be decent for everything from Code Golf to command-line utilities, from websites to games. + +However, it may not be immediately clear how to write more complex code that does not refer to variable names. + +## What Uiua asks of you + +When you first start using Uiua beyond just simple examples and challenges, you will likely encounter difficulty passing more than a couple values around. + +In disallowing named local variables, Uiua asks something of the programmer that most other languages do not. It asks that you re-orient the way you think about data. How you refer to it, how it flows through a program. + +If you pay the price of this re-orientation, Uiua offers you a few things in return. + +For one, you end up writing a lot less code. When you don't bind lots of local variables and constantly refer to them in expressions, your code ends up being much shorter. This makes scanning through code require less scrolling and jumping around. + +This is one of the many ways that Uiua reduces *ceremony.* Ceremony in a programming language is all the code you have to write that is not directly related to the problem you are trying to solve. This includes everything from minor syntax like braces and keywords to complex boilerplate like interface implementations. Uiua does not eliminate all ceremony (no language can), but it aims to eliminate as much as possible while maintaining a certain level of readability and structure. + +This is not to say that local bindings are not useful in other languages. There are two original motivations for Uiua eliminating local variables: simplicity of implementation, and beauty. + +*If you are not too concerned with performance and implementation, you can skip this paragraph.* Uiua's arrays are garbage-collected via reference counting. This reference count is also used when mutating an array. For example, if you [reverse]() an array when no duplicates exist, the array is simply reversed in place. However, if at least one other copy of the array exists on the stack, the array's entire buffer will be copied, and this new copy will be reversed instead. If variables could be locally bound, a copy would have to be stored for the duration of the variable's scope. Without complex escape analysis, this could lead to unnecessary copies when using local variables. Because values on the stack are cleaned up as they are used, arrays only need to be copied as often as is actually necessary! + +But in the end, the primary motivation for forbidding local variables is that leads to code that is both beautiful and enjoyable to write. This is, of course, highly subjective, but if you've made it this far into the tutorial, then hopefully you've seen some of that beauty, felt some of that joy. + +## The Stack Pitfall + +Being stack-based is Uiua's key to being usable as a pure-tacit language. However, the stack can be an unwieldy tool if used recklessly. Many stack languages have built-in functions for rotating the stack, fishing values up from deep in the stack, or arbitrarily reordering it. While these things are technically possible in Uiua, they are discouraged, and the code for them is verbose by design. + +Uiua encourages a more structured approach to stack manipulation. There are no single functions for rotating the stack or for swapping more than 2 values. + +When complex stack manipulation *is* required, it is usually done with [planet notation](/tutorial/advancedstack#planet-notation). Planet notation allows you to *visualize* the way values move around. + +## A Motivating Example + +The online Uiua pad and the `uiua watch` command in the native interpreter make it easy to write Uiua code interactively. You can easily see the state of the stack after each change you make to the code. + +This iterative process is good for exploring possibilities, and it is the intended way to write Uiua code. However, a naive, ad-hoc approach to stack manipulation often leads to code that is very hard to read. + +As a motivating example, let's attempt to implement the quadratic formula. Given numbers `a`, `b`, and `c`, the roots of the function `ax² + bx + c` can be found via the expression `(-b ± √(b² - 4ac)) / 2a`. + +This is a useful example because it involves juggling 3 arguments that are used in a non-regular way. + +Let's start with the discriminant term ` b² - 4ac`. + +```uiua +Disc ← # Code goes here +Disc 1 2 0 +``` + +To show how you might build up a solution with only stack reordering, we'll only use [`duplicate`](), [`flip`](), [`over`](), and [`dip`]() to attempt to get all the arguments in the right order. + +First, we'll might try to get `a` and `c` next to each other above `b` on the stack. + +```uiua +Disc ← ⊙: +Disc 1 2 0 +``` + +Because `a` and `c` are on top of the stack, making the `4ac` term is easy. + +```uiua +Disc ← ××4 ⊙: +Disc 1 2 0 +``` + +We can get down to `b` with [dip](), create the `b²` term, and [subtract](). + +```uiua +Disc ← -⊙(ⁿ2)××4 ⊙: +Disc 1 2 0 +``` + +That finishes the discriminant. Next, we'll account for [complex]() roots and take the [sqrt](). + +```uiua +Disc ← √ℂ0 -⊙(ⁿ2)××4 ⊙: +Disc 1 2 0 +``` + +We can implement `±` by [couple]()ing the value with itself [negate]()d. + +```uiua +Quad ← ⊟¯. √ℂ0 -⊙(ⁿ2)××4 ⊙: +Quad 1 2 0 +``` + +And now we have a problem. We still need to use `a` and `b` one more time, but they have already been consumed. +`a` and `b` start at the top of the stack, so we can copy them with [over]() and put the rest of out code in two [dip]()s. + +```uiua +Quad ← ⊙⊙(⊟¯. √ℂ0 -⊙(ⁿ2)××4 ⊙:),, +Quad 1 2 0 +``` + +Then we'll [subtract]() `b`... + +```uiua +Quad ← ⊙(-⊙(⊟¯. √ℂ0 -⊙(ⁿ2)××4 ⊙:)),, +Quad 1 2 0 +``` + +...and [divide]() by `2a`. + +```uiua +Quad ← ÷×2⊙(-⊙(⊟¯. √ℂ0 -⊙(ⁿ2)××4 ⊙:)),, +Quad 1 2 0 +``` + +And there we have it, the quadratic formula. + +```uiua +Quad ← ÷×2⊙(-⊙(⊟¯. √ℂ0 -⊙(ⁿ2)××4 ⊙:)),, +Quad 1 2 0 +Quad 1 2 5 +Quad 2 3 1 +``` + +On close inspection, the astute reader may notice that the above code sucks. What's worse, it's not even as bad as it could be. If you hadn't thought to use [over]() and [dip]() in that way, you may have instead used `:⊙:` to rotate 3 values on the stack, making it even more convoluted. + +The problem with reordering stack values this often is that the state of the stack at any point in the code gets harder and harder for the writer to keep in their head. It also makes it much harder for the reader to deduce the state of the stack at a glance. + +## Stack-Source Locality + +The code above is also obtuse for another reason. + +Imagine a person who is less familiar with this code going to read it. It may be someone else, but it may also be a future version of yourself. If they look at the leftmost term `÷×2`, they'll likely be able to quickly tell that it takes two arguments. But how do they figure out what those arguments are? They would have to make their way all the way to the *other side of the function* to find the [over]() that creates the copy of `a`. They would only end up there after having built up the mental model of the state of the stack throughout the *entire function*. + +This obtuseness is the result of the above code violating a fundamental principle of writing good Uiua code, that of *stack-source locality*. Stated simply, **code that creates values should be as close as possible to the code that uses those values**. + +In our example, [divide]() and the [over]() that creates its argument are on opposite sides of the function: a massive violation of stack-source locality. + +This principle is not a formula you can plug values into. It is not a set of procedures that will make code better. It is a guiding tenet meant to shape the way you think about the flow of your data and how you structure your programs. How well a given code snippet maintains stack-source locality is up to interpretation, and different Uiua programmers may interpret it differently, even for the same program. + +## A Better Way + +So how do we write better Uiua code? How do we keep stack-source locality? How do we avoid making the stack so convoluted that our code becomes unreadable? + +The short answer is to make liberal use of [fork](). + +The power of [fork](), [dip](), [gap](), [on](), and [by]() is that they allow access to arbitrary values on the stack *without* reordering it. When the stack maintains its order, it is much easier to reason about values' position on it, since their positions seldom change relative to each other. + +Let's redo the quadratic formula implementation using these modifiers. + +We'll start again with the discriminant. + +```uiua +Disc ← -⊃(××4⊙⋅∘)⋅(ⁿ2) +Disc 1 2 0 +``` + +Notice that when we use planet notation, it is easier to tell which functions are being applied to which values. + +We'll implement the `√` and `±` in the same way as before. + +```uiua +Disc ← ⊟¯. √ℂ0 -⊃(××4⊙⋅∘)⋅(ⁿ2) +Disc 1 2 0 +``` + +Even though `b` has been consumed, we can gain access to it again using another [fork]() and implement the `-b` term. + +```uiua +Quad ← -⊃⋅∘(⊟¯. √ℂ0 -⊃(××4⊙⋅∘)⋅(ⁿ2)) +Quad 1 2 0 +``` + +Then, we can use another [fork]() to add the `/ 2a` part. + +```uiua +Quad ← ÷⊃(×2|-⊃⋅∘(⊟¯. √ℂ0 -⊃(××4⊙⋅∘)⋅(ⁿ2))) +Quad 1 2 0 +``` + +Long lines like this can hurt readability. One thing we can do to alleviate this is split the discriminant onto its own line. + +```uiua +Quad ← ÷⊃(×2)( + -⊃⋅∘( + -⊃(××4⊙⋅∘)⋅(ⁿ2) + ⊟¯. √ℂ0 + ) +) +Quad 1 2 0 +``` + +Alternatively, we can pull the discriminant into its own function. + +```uiua +# A thing of beauty +Disc ← -⊃(××4⊙⋅∘)⋅(ⁿ2) +Quad ← ÷⊃(×2|-⊃⋅∘(⊟¯. √ℂ0 Disc)) +Quad 1 2 0 +``` + +Let's compare this solution to the previous one. To improve the comparison, we'll make the discriminant its own function here as well. + +```uiua +Disc ← -⊙(ⁿ2)××4 ⊙: +Quad ← ÷×2⊙(-⊙(⊟¯. √ℂ0 Disc)),, +Quad 1 2 0 +``` + +The difference is night-and-day. The old, naive solution, even with the benefit of being broken up, still has all of its same issues. + +If we look in the improved solution and do the same search for the source of [divide]()'s arguments, we don't have to go far before finding the [fork]() with `×2` and `-`. Stack-source locality holds for all parts of the code! + +# When to Reorder + +While reordering stack values is discouraged, a little bit of reordering up front can sometimes greatly simplify subsequent code. The recommended place to do this is at the very beginning of a function. + +A function should *take* its arguments in the order that is most natural for calling. If necessary, you may choose to reorder a functions arguments at the beginning of its body so that they are easier to work with inside the function. + +If we for some reason decided that the best calling order for our `Quad` function was `c` `b` `a`, then we could add a reordering step to the beginning and keep the rest of the implementation the same. + +```uiua +Disc ← -⊃(××4⊙⋅∘)⋅(ⁿ2) +Quad ← ( + ⊃(⋅⋅∘|⋅∘|∘) # Reorder + ÷⊃(×2|-⊃⋅∘(⊟¯. √ℂ0 Disc)) +) +Quad 0 2 1 +``` + +Even though the reordering step could be written shorter as `⊃⋅⋅∘:` it is written in a long form here for the benefit of the reader. But you may decide that `⊃⋅⋅∘:` is perfectly clear, and that's fine! + +## Three Rules + +As stated before, the advice in this section is just that, advice. It is not a set of hard and fast rules that must be followed. + +However, if you are the kind of person that *likes* a simple list of rules, then here it is: + +- **Reorder the stack as little as possible** +- **Break up long lines with whitespace or into separate functions** +- **Maintain stack-source locality** + +Like all programming languages (though perhaps more than some), writing Uiua code is as much art as it is science. The deconstruction of a problem, the synthesis of a solution, the care for the reader; these are all things you get a feel for as you work more with the language. \ No newline at end of file diff --git a/site/blog/second-class-functions-html.html b/site/blog/second-class-functions-html.html new file mode 100644 index 000000000..f772a8292 --- /dev/null +++ b/site/blog/second-class-functions-html.html @@ -0,0 +1,13 @@ + + + + +

Uiua

Blog Home

Why doesn't Uiua have first-class functions?

You can read this post with full editor features here.

2023-12-15


People often ask why Uiua doesn't have first-class functions. That is, functions that can be put on the stack and in arrays.

In the beginning, functions were normal array elements. Modifiers popped their functions from the stack like regular values. Functions could be put in arrays, and lists of functions even had some special uses. There was a ! call function which called the top function on the stack. Boxes were not even a dedicated type. They were just functions that took no arguments and returned a single value.

However, as Uiua's development continued, the language began to rely more and more on stack signatures being well-defined. This property catches errors early, enables some optimizations, and allows modifiers to behave differently depending on their function's siganture. That last point lets us avoid having multiple modifiers that work the same way but on different numbers of arguments. For example, Factor has the words bi, 2bi, 3bi, + + , 2tri, and 3tri. Uiua can express all of these and more with just + fork + .

Unfortunately, having first-class functions was at odds with this design. Because functions could be put into arrays and (conditionally) moved around on the stack, the compiler was not able to determine the signature of a function that called a function value. This meant that anywhere the ! call function was used needed a signature annotation nearby, which you better hope was correct, or the code would break somewhere else. It also incurred additional interpreter overhead to get the functions from arrays and made certain types of optimizations impossible.

Other than these design and implementation concerns, the ability to move functions around on the stack made code much harder to read when it was used. You had to keep in your mind not only the values, but the functions that worked on them as well. They were another value you had to deal with, and the related stack manipulation could get quite messy.

And so I settled on a different approach. Functions were removed as an element type and were put elsewhere in the interpreter. Boxes became a type in their own right. The ! call function was removed, and ! was repurposed to be part of defining custom modifiers. Custom modifiers capture the primary use case of first-class functions: injecting some variable code into a function. While they are technically more limited, their uniform structure makes them easier to both read and write. This change also massively simplified the interpreter, as well as the complexity of the language itself.

Despite the downgrading of functions to second-class status, it should be noted that I do like functional programming languages. I just don't think that first-class functions are a good fit for Uiua. In practice, first-class functions are mostly unnecessary if you have higher-order functions, which array languages have had for decades. APL's operators, J's adverbs and conjunctions, and BQN and Uiua's modifiers are all versions of higher-order functions. They allow the mapping, reduction, and general transformation of data in the same way that first-class functions do in other languages.

Now if only I could find a way to get rid of boxes...

\ No newline at end of file diff --git a/site/blog/uiua-0.10.0-html.html b/site/blog/uiua-0.10.0-html.html new file mode 100644 index 000000000..3983afcde --- /dev/null +++ b/site/blog/uiua-0.10.0-html.html @@ -0,0 +1,78 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.10.0

You can read this post with full editor features here.

2024-04-04


Uiua 0.10.0 is now available!

You can find the full changelog here.

This release contains so many changes, improvements, and new features that I thought it deserved a blog post.From here on, major releases will be announced in this way.

While there are many changes, I want to highlight a few of them here.

Pattern Matching

Using + ° un + on a constant value will now match a pattern. When used with + try + , this can be used to conditionally match, extract, and process values.

F ← ⍣( + ×10 °[1⊙3] # Extract and multiply.. +| °(⊂5) # ..or remove leading 5.. +| ⇌ # ..else reverse +) +F [1 2 3] +F [5 6 7] +F "cool!"

You can read more in the Pattern Matching tutorial.

Array Macros

Array macros are a powerful new feature that allow full compile-time metaprogramming.

They allow Uiua code to directly manipulate other Uiua code, enabling a wide range of new possibilities.

F! ←^ ≡$"_ ← _\n" "ABC" +F!(1|2|3) +[A B C B B] # [1 2 3 2 2]

You can read more in the updated Macros tutorial.

Git Modules

You can now prefix a module path with git: to import a git repository from a URL.

~ "git: github.com/uiua-lang/example-module" ~ Upscale +Upscale 3 [1_2 3_4]

In the native interpreter, this automatically creates a Git submodule.

On the web, it fetches a lib.ua file from the repository.

You can read more in the updated Modules tutorial.

+ mask +

+ mask + is a new function that is similar to + find + , but it returns full masks of matches rather than just the first positions.

⦷ " - " "Hey - how-are - you" # [0 0 0 1 1 1 0 0 0 0 0 0 0 2 2 2 0 0 0 0]⊜□¬⦷⊙. " - " "Hey - how-are - you" # {"Hey" "how-are" " you"}

This simplifies a lot of string-processing code in particular. A new strings tutorial has been added as well.

Other Changes

Switch functions now format to use ⟨⟩ brackets. This makes them easier to distinguish from function packs.

F ← (×10|↥2)<2. # This..# 1:5: Function packs are not allowed without a modifier +F ← ⟨×10|↥2⟩<2. # Formats to this +F 0 # 2 +F 5 # 50

+ map + and related functions are no longer experimental! See the + map + docs for an overview.

map 1_2_3 4_5_6 + +# ╭─ +# 1 → 4 +# 2 → 5 +# 3 → 6 +# ╯

The new + &clget + and + &clset + functions provide access to the clipboard.

The interpreter's built-in language server now supports many more features.

There are a ton more! Again, you can read the full changelog here.

💖

As always, I'd like to thank everyone who contributed to this release, whether by directly contributing code, reporting bugs, or just using Uiua and providing feedback.

Uiua is in many ways a novel and unique language, and I think it is only through our collective effort that we can properly explore its design space.

With your help, I hope to continue to improve Uiua to the point of stability.

\ No newline at end of file diff --git a/site/blog/uiua-0.11.0-html.html b/site/blog/uiua-0.11.0-html.html new file mode 100644 index 000000000..c36940de8 --- /dev/null +++ b/site/blog/uiua-0.11.0-html.html @@ -0,0 +1,197 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.11.0

You can read this post with full editor features here.

2024-06-02


Uiua 0.11.0 is now available!

You can find the full changelog here.

Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code.

While this release does not have any major new features, it extends the functionality of many primitives, optimizes many common patterns, and fixes a number of bugs.

Here are some of the highlights:

Multi-argument + / reduce +

+ / reduce + takes a dyadic function and applies it "between" all rows of an array.

/+ [1 2 3 4 5] # 15

+ / reduce + can now take multiple arguments if its function takes more than two arguments. Additional arguments are interspersed between the rows and are passed above the main array on the stack.

/(⊂⊂) 0 [1 2 3 4] # [1 0 2 0 3 0 4]

This is particularly useful when used with + content + and + join + to intersperse a delimiter between a list of strings.

/◇(⊂⊂) @, {"cat" "dog" "bird" "fish"} # "cat,dog,bird,fish"

+ json + and + xlsx +

The + json + and + xlsx + functions allow the encoding and decoding of JSON and XLSX data respectively.

+ json + converts an array to a JSON string.

json [1 2 3 4] # "[1,2,3,4]"

It works with + map + s as well.

json map {"name" "age"} {"Dan" 31} # "{"age":31,"name":"Dan"}"

+ ° un + + json + decodes a JSON string.

°json $ {"type": "requires", "content": "json", "ids": [38, 22, 5]} + +# ╭─ +# ⌜content⌟ → ⌜json⌟ +# ⌜ids⌟ → ⟦38 22 5⟧ +# ⌜type⌟ → ⌜requires⌟ +# ╯

+ xlsx + is similar, but is works with binary data rather than strings.

+ take + / + drop + + infinity +

+ take + and + drop + isolate part of an array.

↙ 3 [1 2 3 4 5] # [1 2 3] +↘ 3 [1 2 3 4 5] # [4 5]

Multidimensional indices have always been supported.

↙2_2 . ↯3_4⇡12 + +# ╭─ +# ╷ 0 1 2 3 +# 4 5 6 7 +# 8 9 10 11 +# ╯ +# ╭─ +# ╷ 0 1 +# 4 5 +# ╯

You can now provide + infinity + as one or more of the indices to + take + or + drop + that entire axis.

↙∞_2 . ↯3_4⇡12 + +# ╭─ +# ╷ 0 1 2 3 +# 4 5 6 7 +# 8 9 10 11 +# ╯ +# ╭─ +# ╷ 0 1 +# 4 5 +# 8 9 +# ╯↙1_∞_2 . ↯2_3_4⇡24 + +# ╭─ +# ╷ 0 1 2 3 +# ╷ 4 5 6 7 +# 8 9 10 11 +# +# 12 13 14 15 +# 16 17 18 19 +# 20 21 22 23 +# ╯ +# ╭─ +# ╷ 0 1 +# ╷ 4 5 +# 8 9 +# ╯

Swizzles

Swizzles are a new experimental feature that allow concise manipulation of the stack and extraction from arrays.

Stack swizzles are written with a λ followed by some letters. The stack will be rearranged accordingly. λ formats from ' when followed by letters.

# Experimental! +[λccab 1 2 3] # [3 3 1 2]

Capital letters will + ¤ fix + the corresponding array. This is useful with complex + rows + operations.

# Experimental! +≡(⊂⊂) ? λaBC 1_2 3_4 5_6 + +# ╭─ +# ╷ 1 3 4 5 6 +# 2 3 4 5 6 +# ╯

Array swizzles are written with a followed by some letters. Rows from the array that correspond to the letters will be put on the stack. formats from '' when followed by letters.

# Experimental! +⋊beef [1 2 3 4 5 6] # 2 5 5 6

Capital letters will + ° un + + box + the corresponding row.

# Experimental! +⋊aCB {"Dave" 31 [38 22 5]} # ⌜Dave⌟ [38 22 5] 31

Swizzles are experimental and may change in future versions as their place in the language is explored.

The New Pad

Much of the code for the Uiua website pad has been rewritten. This new pad uses less custom behavior and should work better in more browsers.

If you are reading this on the Uiua website (with full editor features), then all the examples above use this new pad!

💗

Thank you as always to everyone who uses Uiua and helps with its development! Your enthusiasm for the language gives me life.

A special thanks to all of Uiua's sponsors for their continued support 🥰

Again, you can find the full changelog for this release here.

You can join the Uiua Discord to chat about the language, ask questions, or get help.

\ No newline at end of file diff --git a/site/blog/uiua-0.12.0-html.html b/site/blog/uiua-0.12.0-html.html new file mode 100644 index 000000000..f4931ec4e --- /dev/null +++ b/site/blog/uiua-0.12.0-html.html @@ -0,0 +1,297 @@ + + + + +

Uiua

Blog Home

Announcing Uiua 0.12.0

You can read this post with full editor features here.

2024-08-16


Uiua 0.12.0 is now available!

You can find the full changelog here.

Uiua is a general purpose, stack-based, array-oriented programming language with a focus on tacit code.

This is a pretty big release! In addition to stable features, it contains a lot of experimental features to try out.

Here are some of the highlights:

New Tutorials

There are two new tutorials on the site:

Scoped Modules

Modules can now be declared without needing a new file.

This is done with ---s and a name.A ~ following the name lets you export names from within into the outer scope.

---MyMod ~ Go + Foo ← 5 + Go ← +1 +--- +Go MyMod~Foo

A module containing a function called Call or New can be called as a function.

---Foo + Call ← /++1⇡ +--- +Foo 5

Using a module name as a macro (with a ! at the end of the name) will make the module's names available inside that scope.

---Foo + A ← 10 + F ← +1 + G ← ×2 +--- +Foo!(G F ×A) [1 2 3]

+ switch +

Dedicated switch function syntax has been replaced with the + switch + modifier.

In addition, it has been expanded to do an implicit + rows + .

⨬(∘|+1|×2) [0 1 2] 5 # [5 6 10]

Existing ⟨⟩s will continue to parse and will format to + switch + with a function pack.

Subscript digits in identifiers

Unlike most programming languages, Uiua identifiers cannot contain digits.

But sometimes you want digits in your names! You can now use subscript digits in identifiers.

These format from a double underscore __ followed by some digits.

Sha__256 ← "todo" # This +Sha₂₅₆ ← "todo" # Formats to this

New Primitive Functionality

Several primitive functions have new functionality

+ ° un + + shape + now generates a + range + array with the given shape.

°△ 2_3_4 + +# ╭─ +# ╷ 0 1 2 3 +# ╷ 4 5 6 7 +# 8 9 10 11 +# +# 12 13 14 15 +# 16 17 18 19 +# 20 21 22 23 +# ╯

+ couple + and + join + are now more permissive of arguments with different ranks. The array with a smaller rank will be repeated.

⊟ 1_2_3 4 + +# ╭─ +# ╷ 1 2 3 +# 4 4 4 +# ╯⊂ [1_2_3 4_5_6] 7 + +# ╭─ +# ╷ 1 2 3 +# 4 5 6 +# 7 7 7 +# ╯

+ keep + will now cycle the counts array.

▽ 0_1_2 [1 2 3 4 5 6] # [2 3 3 5 6 6]

+ keep + also now allows a scalar non-integer to scale an array. This is useful for image and audio arrays.

▽ 0.5 [1 2 3 4 5 6] # [1 3 5] +▽ 1.5 [1 2 3 4 5 6] # [1 1 2 3 3 4 5 5 6]

+ memberof +

+ member + is now deprecated. It was almost always used along with + : flip + .

It has been replaced with + memberof + , which has the exact same functionality, except its arguments are flipped.

F ← ∈"abc" +F "beefcake" # [1 0 0 0 1 1 0 0]

This makes it work nicely with + by + !

⊜□¬⊸∈ " ," "To be, or not" # {"To" "be" "or" "not"}

Experimental Features

This release adds a lot of experimental features to try out.

While it's unlikely that all of these will be eventually stabilized, they are made available for you to try out and see how they feel.

You can view to full list of experimental features here, but here are a few highlights:

More Stack Modifiers

The + but + and + with + modifiers are complements to + on + and + by + .

+ but + keeps its function's last argument on top of the stack while + with + keeps its function's first argument below the outputs on the stack.

# Experimental! +[⤙+ 2 5] # [5 7] +[⤚+ 2 5] # [7 2]

The + above + and + below + modifiers keep all of a function's arguments above or below the outputs on the stack.

# Experimental! +[◠(++) 1 2 3] # [1 2 3 6] +[◡(++) 1 2 3] # [6 1 2 3]

+ chunks + is similar to + windows + except the parts of the array do not overlap.

# Experimental! +⑄ 2_3 °△ 4_9 + +# ╭─ +# ╷ 0 1 2 +# ╷ 9 10 11 +# ╷ +# 3 4 5 +# 12 13 14 +# +# 6 7 8 +# 15 16 17 +# +# +# 18 19 20 +# 27 28 29 +# +# 21 22 23 +# 30 31 32 +# +# 24 25 26 +# 33 34 35 +# ╯ +≡≡□ + +# ╭─ +# ╷ ╓─ ╓─ ╓─ +# ╟ 0 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 +# ╜ ╜ ╜ +# ╯

+ orient + transposes an array's axes by moving the axes at the given indices to the front of the + shape + .

This simplifies complex shape transformations that would otherwise be done with several + transpose + s and + rows + s.

# Experimental! +°△ 2_3_4_5 + +# ╭─ +# ╷ 0 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 103 104 +# 105 106 107 108 109 +# 110 111 112 113 114 +# 115 116 117 118 119 +# ╯ +△ ⤸ 1_3 # [3 5 2 4]

💖

As always, a heartfelt thank-you to everyone in the Uiua community! Your contributions are what make Uiua great.

If you want to support Uiua's development, you can become one of its excellent sponsors!

Again, you can find the full changelog for this release here.

You can join the Uiua Discord to chat about the language, ask questions, or get help.

Media Constants

A final fun note!

A few built-in image and audio constants have been added. These are useful for testing and demonstrating image and audio functions!

Logo +Lena +▽⟜≡▽ 0.5 # Scales the image down +Music
\ No newline at end of file diff --git a/site/blog/what-will-1-look-like-html.html b/site/blog/what-will-1-look-like-html.html new file mode 100644 index 000000000..8d1db4a8e --- /dev/null +++ b/site/blog/what-will-1-look-like-html.html @@ -0,0 +1,5 @@ + + + + +

Uiua

Blog Home

What will Uiua 1.0 look like?

You can read this post with full editor features here.

2024-01-19


The Uiua pad page prominently displays the words "Uiua is not yet stable". And so it has been asked: when will Uiua be stable? What features will it have? Is there a roadmap?

This post is to organize and present my thoughts on the future of Uiua.

Stability

Uiua will be made officially stable only after it has been unofficially stable for some time. That is, not until no breaking changes have been made for a long time.

The following language features will need to be nailed down before Uiua can ever be stable.

Stack manipulation

I think working with the stack, at least for up to 3 values, has become mostly pretty nice. However, things start to get complicated when working with more values, as is often necessary. There is some design work to be done here, and it's not out of the question that a very small amount of non-tacitness could be introduced to improve this.

The experimental bind modifier is a potential solution to this problem.

There is a balance to be struc between Uiua's goal of tacitness and its goal of being ergonomic. While the beauty of fully tacit code is a worthy goal, some problems involve data flows that are inherently complex, and so some kind of labeling system may be necessary to make such problems workable.

Box Ergonomics

While I've explored alternatives, I've come to the conclusion that nested arrays are a necessary pest. The data we work with is often nested or ragged, and while there are ways to represent such data with flat structures, those representations are cumbersome in their own ways.

And so boxes are likely here to stay. However, I do think some design work can be done to improve their ergonomics. Currently, Uiua's boxes are very similar to J's, but I think it may be worth it to make their usage a bit more implicit in some cases, closer to the nested arrays of APL or BQN.

System APIs

The current system functions are useful and mostly work. There are definitely implementation gaps which need to be filled. There are a good number of missing filesystem operations, and some other things like UDP sockets and proper interaction with child processes still need to be implemented.

FFI

An FFI system similar to BQN's is planned. This will allow Uiua to call into C libraries and will enable a lot more functionality.

\ No newline at end of file diff --git a/site/text/ranges.md b/site/text/ranges.md new file mode 100644 index 000000000..f83053538 --- /dev/null +++ b/site/text/ranges.md @@ -0,0 +1,30 @@ +# Ranges + +Working with regular sequences of numbers is a common task in programming. Many languages handle this with with a `for` loop, but Uiua uses the same thing it uses for most things: arrays. + +## [`range`]() + +[`range`]() is the fundamental range-generating function. It generates a list of integers starting at `0` and ending at `n - 1`. + +```uiua +⇡5 +⇡12 +``` + +If you want to include the end value, you can [`add`]()`1` first. + +```uiua +⇡+1 5 +⇡+1 12 +``` + +[`add`]()`1` afterward to get the range `[1, n]`. + +```uiua ++1⇡ 5 ++1⇡ 12 +``` + +## [`under`]() Tricks + +[`under`]() makes getting more complex ranges simple. \ No newline at end of file diff --git a/src/algorithm/loops.rs b/src/algorithm/loops.rs index d2c7b3dba..89cd820fd 100644 --- a/src/algorithm/loops.rs +++ b/src/algorithm/loops.rs @@ -570,10 +570,7 @@ fn multi_partition_indices(markers: Array) -> Vec<(isize, Vec)> { *c = 0; } } - let mut shape_muls: Vec = markers - .shape() - .iter() - .rev() + let mut shape_muls: Vec = (markers.shape().iter().rev()) .scan(1, |mul, &dim| { let prev = *mul; *mul *= dim;