Skip to content

Commit

Permalink
build site
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Nov 24, 2024
1 parent 6d2142f commit 2ee9b92
Show file tree
Hide file tree
Showing 83 changed files with 11,177 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.vscode
.idea
/target
/docs
/site/blog/*.html
site/dist
/uiua-modules

Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ members = ["site", "tests_ffi", "pad/editor"]

[profile.dev]
incremental = true

[profile.release]
opt-level = 'z'
43 changes: 43 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Uiua</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
// This script takes the current url and converts the path and query
// string into just a query string, and then redirects the browser
// to the new url with only a query string and hash fragment,
// e.g. https://www.foo.tld/one/two?a=b&c=d#qwe, becomes
// https://www.foo.tld/?/one/two&a=b~and~c=d#qwe
// Note: this 404.html file must be at least 512 bytes for it to work
// with Internet Explorer (it is currently > 512 bytes)

// If you're creating a Project Pages site and NOT using a custom domain,
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).
// This way the code will only replace the route part of the path, and not
// the real directory in which the app resides, for example:
// https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
// https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe
// Otherwise, leave pathSegmentsToKeep as 0.
var pathSegmentsToKeep = 0;

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);

</script>
</head>

<body>
</body>

</html>
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.uiua.org
Binary file added docs/DejaVuSansMono.ttf
Binary file not shown.
Binary file added docs/Pixua.ttf
Binary file not shown.
Binary file added docs/Uiua386.ttf
Binary file not shown.
Binary file added docs/assets/ooh-ee-ooh-ah.mp3
Binary file not shown.
17 changes: 17 additions & 0 deletions docs/assets/rss.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-crayon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-logo-pride.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-logo-pride.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-logo-scrambledine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/uiua-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions docs/assets/uiua-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/wee-wah.mp3
Binary file not shown.
Binary file added docs/assets/wee-wuh.mp3
Binary file not shown.
Binary file added docs/assets/you-dont.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions docs/blog/feed.rss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Uiua Blog</title>
<description>Blog of the Uiua Programming Language</description>
<link>https://uiua.org/blog</link>
<atom:link href="https://uiua.org/blog/feed.rss" rel="self" type="application/rss+xml"></atom:link>
<lastBuildDate>Tue, 24 Sep 2024 20:30:40 +0000</lastBuildDate>
<item><link>https://uiua.org/blog/uiua-0.12.0</link>
<guid isPermaLink="false">95d63645-10e4-4312-bbe3-f0a6254c0144</guid>
<pubDate>Fri, 16 Aug 2024 00:00:00 +0000</pubDate>
<title>Announcing Uiua 0.12.0</title></item>
<item><link>https://uiua.org/blog/uiua-0.11.0</link>
<guid isPermaLink="false">32cba0cb-2378-4cf9-894c-ea65e2a3ffda</guid>
<pubDate>Sun, 2 Jun 2024 00:00:00 +0000</pubDate>
<title>Announcing Uiua 0.11.0</title></item>
<item><link>https://uiua.org/blog/uiua-0.10.0</link>
<guid isPermaLink="false">6841da9d-9b35-4992-92b3-0c6820606733</guid>
<pubDate>Thu, 4 Apr 2024 00:00:00 +0000</pubDate>
<title>Announcing Uiua 0.10.0</title></item>
<item><link>https://uiua.org/blog/what-will-1-look-like</link>
<guid isPermaLink="false">113ee6ab-1d29-4115-9a1e-4bb2701d23f0</guid>
<pubDate>Fri, 19 Jan 2024 00:00:00 +0000</pubDate>
<title>What will Uiua 1.0 look like?</title></item>
<item><link>https://uiua.org/blog/second-class-functions</link>
<guid isPermaLink="false">c6a7b400-5d2b-413a-888b-4cd675c8c1db</guid>
<pubDate>Fri, 15 Dec 2023 00:00:00 +0000</pubDate>
<title>Why doesn't Uiua have first-class functions?</title></item></channel></rss>
11 changes: 11 additions & 0 deletions docs/blog/second-class-functions-html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://uiua.org/styles.css">
</head><body><div id=top><p><a href="https://uiua.org" data-title=>Uiua</a></p><p><a href="https://uiua.org/blog" data-title=>Blog Home</a></p><h1 id="why-doesn't-uiua-have-first-class-functions?">Why doesn't Uiua have first-class functions?</h1><p><strong>You can read this post with full editor features <a href="https://uiua.org/blog/second-class-functions" data-title=>here</a>.</strong></p><p>2023-12-15</p><hr/><p>People often ask why Uiua doesn't have first-class functions. That is, functions that can be put on the stack and in arrays.</p><p>In the beginning, functions <em>were</em> 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 <code>! call</code> 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.</p><p>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, <a href="https://factorcode.org/" data-title=>Factor</a> has the words <code>bi</code>, <code>2bi</code>, <code>3bi</code>, <code>tri</code>, <code>2tri</code>, and <code>3tri</code>. Uiua can express all of these and more with just <a
href="https://uiua.org/docs/fork"
data-title="Call two functions on the same values"
class="prim_code_a"
style="text-decoration: none;">
<code><span class="prim-glyph code-font dyadic-modifier"></span> fork</code>
</a>.</p><p>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 <code>! call</code> 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.</p><p>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.</p><p>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 <code>! call</code> function was removed, and <code>!</code> was repurposed to be part of defining custom modifiers. <a href="/docs/custommodifiers" data-title=>Custom modifiers</a> 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.</p><p>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.</p><p>Now if only I could find a way to get rid of boxes...</p></div></body></html>
21 changes: 21 additions & 0 deletions docs/blog/second-class-functions-text.md
Original file line number Diff line number Diff line change
@@ -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...
Loading

0 comments on commit 2ee9b92

Please sign in to comment.