-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
2,656 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.vscode | ||
.idea | ||
/target | ||
/docs | ||
site/dist | ||
|
||
*.wav | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
www.uiua.org |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
second-class-functions: 2023-12-15 - Why doesn't Uiua have first-class functions? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# What will Uiua 1.0 look like? | ||
|
||
2023-12-20 | ||
|
||
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. | ||
|
||
### Box Ergonomics | ||
|
||
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 cumbersom 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 function](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. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html><html lang="en"><head> | ||
<title>Uiua</title> | ||
<link rel="icon" href="/favicon.ico"> | ||
<noscript> | ||
<style> | ||
.jsonly { | ||
display: none | ||
} | ||
</style> | ||
</noscript> | ||
<!-- Begin Single Page Apps for GitHub Pages --> | ||
<script type="text/javascript"> | ||
// Single Page Apps for GitHub Pages | ||
// MIT License | ||
// https://github.com/rafgraph/spa-github-pages | ||
// This script checks to see if a redirect is present in the query string, | ||
// converts it back into the correct url and adds it to the | ||
// browser's history using window.history.replaceState(...), | ||
// which won't cause the browser to attempt to load the new url. | ||
// When the single page app is loaded further down in this file, | ||
// the correct url will be waiting in the browser's history for | ||
// the single page app to route accordingly. | ||
(function (l) { | ||
if (l.search[1] === '/') { | ||
var decoded = l.search.slice(1).split('&').map(function (s) { | ||
return s.replace(/~and~/g, '&') | ||
}).join('?'); | ||
window.history.replaceState(null, null, | ||
l.pathname.slice(0, -1) + decoded + l.hash | ||
); | ||
} | ||
}(window.location)) | ||
</script> | ||
<!-- End Single Page Apps for GitHub Pages --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="A stack-based array programming language"> | ||
<script type="module">import init from '/site-be70e8ef94b8a566.js';init('/site-be70e8ef94b8a566_bg.wasm');</script> | ||
|
||
<link rel="stylesheet" href="/styles-756c927f52338ba2.css"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="preload" href="/site-be70e8ef94b8a566_bg.wasm" as="fetch" type="application/wasm" crossorigin=""> | ||
<link rel="modulepreload" href="/site-be70e8ef94b8a566.js"></head> | ||
|
||
<body> | ||
<div id="top"> | ||
<div id="header"> | ||
<div id="header-left"> | ||
<h1><a id="header-uiua" href="/"></a><img src="/uiua-logo.png" style="height: 1em" alt="Uiua"> Uiua</h1> | ||
<p id="subtitle">A stack-based array programming language</p> | ||
</div> | ||
<div id="nav"> | ||
<p><a class="pls-no-block" href="https://github.com/sponsors/uiua-lang">Support Uiua's development</a></p> | ||
<p><a href="/">Home</a></p> | ||
</div> | ||
</div> | ||
<div> | ||
<div id="links"> | ||
<div> | ||
<a href="/install">Installation</a> | ||
<a href="/docs">Documentation</a> | ||
<a href="/tour">Language Tour</a> | ||
</div> | ||
<div> | ||
<a href="/docs/basic" class="slow-pulse">Tutorial</a> | ||
<a href="/pad">Pad</a> | ||
<a href="/blog">Blog</a> | ||
<a href="https://discord.gg/3r9nrfYhCc">Discord</a> | ||
<a href="https://github.com/uiua-lang/uiua">GitHub</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<p class="main-text">Uiua <span class="wee-wuh-span">(<i>wee-wuh</i>)</span> is a general purpose, stack-based, | ||
array-oriented programming language with a focus on simplicity, beauty, and <a href="https://en.wikipedia.org/wiki/Tacit_programming">tacit</a> code.</p> | ||
<p class="main-text">Uiua lets you write code that is as short as possible while remaining readable, so you can | ||
focus on problems rather than ceremony.</p> | ||
<noscript> | ||
<p>JavaScript is required on this site. Please enable it and reload the page.</p> | ||
</noscript> | ||
<h3 class="jsonly running-text">Loading...</h3> | ||
</div> | ||
</div> | ||
|
||
|
||
</body></html> |
Oops, something went wrong.