Git Product home page Git Product logo

uiua's People

Contributors

aprzn123 avatar ariymarkowitz avatar arseniykorobenko avatar aspiringlich avatar axbannaz avatar bhansconnect avatar billy-yoyo avatar bkdj avatar citizen428 avatar dependabot[bot] avatar detegr avatar expitau avatar gatorhog avatar gifti258 avatar ifreilicht avatar joaofelipe3 avatar johnbakhmat avatar jonathanperret avatar kaikalii avatar krftdnr avatar memark avatar omnikar avatar pythongirl325 avatar qexat avatar romanpro100 avatar shnarazk avatar twolodzko avatar vap0r1ze avatar wackbyte avatar zollerboy1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uiua's Issues

thoughts on rotate stack?

  • i am not saying to include this feature,
  • but i often wonder what would be the pros and cons of rotate stack?
  • note: it's very limited in scope, and should not be confused with restack
  • but yeah, the problem with readability may still be there if implemented without much thought

i have seen it in dirs gnu-utils group:

$ pushd --help | grep -EniA 1 "(\+|-)n"
1:pushd: pushd [-n] [+N | -N | dir]
2-    Add directories to stack.
--
9:      -n      Suppresses the normal change of directory when adding
10-             directories to the stack, so only the stack is manipulated.
--
13:      +N     Rotates the stack so that the Nth directory (counting
14-             from the left of the list shown by `dirs', starting with
--
17:      -N     Rotates the stack so that the Nth directory (counting
18-             from the right of the list shown by `dirs', starting with

$ popd --help | grep -EniA 1 "(\+|-)n"
$ help dirs | grep -EniA 1 "(\+|-)n"```

&httpsw test does not work in Nix build environment

Nix build enviroment is pure and does not allow internet access:

Error: failed to lookup address information: Temporary failure in name resolution
   ╭─[:1:18]
 1 │ &httpsw "GET / " &tcpc "example.com:443"
   │                  ─────  
───╯
  in &tcpc at 1:18', src/primitive/mod.rs:897:33

Fetching urls from the Internet during tests does not seem like a good idea anyway.

Did anyone manage to use it with Emacs?

I try to use Emacs as an editor. To have Emacs automatically reload the file, I add:

(global-auto-revert-mode t)

When Emacs saves the file, it actually creates a new file which makes uiua miss it and display "failed to load /home/stephane/tmp/uiua/main.ua: No such file or directory (os error 2)". So, I tell Emacs not to make backup files, thus overwriting the file instead of creating a new one:

(setq make-backup-files '())

Now, uiua no longer complains, Emacs reloads the file if it is changed by an external program (I tested with vi and with uiua fmt) but not when it was changed by used uiua interactively: Emacs continues to display the old file, even when uiua changed it.

Add git tags

Hi! Maintainer for the AUR package here!

I (and other downstream packagers) would really appreciate it if the uiua project made use of git tags to tag releases.

At the moment, I see that 0.0.5 is released on crates.io, but no git tags are available.

No crates.io crate

This repo has been around for a while but it seems there's no crates.io package published.

It would be beneficial to publish this on crates (ASAP in my opinion) as it'll allow easier install with cargo install uiua but also to allow others to use the library as a dependency easier.

At the very least it'll reserve the crate for future use before someone else does so.

Reduce on swap behaves the same as reduce on noop

grafik
grafik

As you can see, noop and swap behave the same in a reduce, but , for example does its thing

Issue is i have no idea what the actual behaviour should be. Maybe this is correct? An explanation on how unary functions are handled would be nice. My initial understanding was that

5_7_8
/-

is equal to

8 7 5
--

Obviously this doesnt make sense since then the behaviour of /. doesnt line up at all. It would be nice to get a good explanation on how things are applied

Why execute from right to left?

The choice to execute code from right to left feels really weird to me. Mainly because of two reasons:

  1. Coming from writing systems where text is written left to right It just feels a lot more natural to read in that direction, but reading Uiua programs from left to right makes them very difficult to understand.

  2. Because Uiua code is executed right to left It seems to me that the natural way to write Uiua code is also right to left.
    However, every time you type a symbol your cursor is placed to the right of that symbol. This means that if you want to type multiple symbols you have to constantly move your cursor to the left, over the newly added symbols. This feels really clunky.

I'm curious about the rationale of this decision and if there is any possiblity that it might be reevaluated at some point in the future.

PS: I will admit that I'm not a very familiar with stack based languages so maybe there is some crucial thing here that I just don't get.

Move data between threads.

I want to make a concurrent application in Uiua. Is there any way to move data between threads at the moment? Not sure if this is even possible without mutability

easier way to make HTTPS requests (pretty please)

I'm trying to make a function that automatically grabs the input data for advent of code problems (Because why not) and unfortunately my raw HTTP requests are not going through. After a lot of eye-pressing and "400 Bad Request" errors (I'm not terribly familiar with web protocols) I figured out that the problem was that I wasn't going through HTTPS. Now, implementing RSA and dual elliptic curve encryption in uiua might be a fun way to burn a few months, but I'm lazy.

Could you provide another special function to, you know, do that?

Windows 10 prompts me with a dialog on how to run .ua files

Thanks for making uiua! The docs are very clear, and the inline 'glyph - name' everywhere is very nice.

image

Steps:

  • cargo install uiua
  • mkdir my_dir
  • cd my_dir
  • uiua init
  • on completion (and every invocation of uiua watch), the dialog opens up.
  • "Hello World" prints out to the console

Closing the dialog window seems like its okay, but ideally it wouldn't have any at all.

I'd expect only the hello world to print and no prompt at all to open a text file in my editor.

Nix build broken by tests which access the internet

uiua> &httpsw example:
uiua> &httpsw "GET / " &tcpc "example.com:443"
uiua> thread 'primitive::tests::prim_docs' panicked at '
uiua> Example failed:
uiua> &httpsw "GET / " &tcpc "example.com:443"
uiua> Error: failed to lookup address information: Temporary failure in name resolution
uiua>    ╭─[:1:18]
uiua>  1 │ &httpsw "GET / " &tcpc "example.com:443"
uiua>    │                  ─────
uiua> ───╯
uiua>   in &tcpc at 1:18', src/primitive/mod.rs:897:33
uiua> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
uiua>
uiua>
uiua> failures:
uiua>     primitive::tests::prim_docs
uiua>
uiua> test result: FAILED. 10 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
uiua>
uiua> error: test failed, to rerun pass `--lib`
error: builder for '/nix/store/zxcvmnknvzkdb0n8gwgjn41xdy2kmjh8-uiua-0.0.14.drv' failed with exit code 101
┏━ 1 Errors:
┃ error: builder for '/nix/store/zxcvmnknvzkdb0n8gwgjn41xdy2kmjh8-uiua-0.0.14.drv' failed with exit code 101
┣━ Dependency Graph:
┃ ⚠︎ uiua-0.0.14 failed with exit code 101 after ⏱︎ 5m54s in checkPhase
┣━━━
┗━ ∑︎ ⚠︎ Exited after 1 build failures at 02:39:15 after 5m54s

Nix generally requires its builds to be self contained/pure, so it goes to some lengths to prevent builds from depending on external factors. In service of this, by default it disables internet access during the build.

I think there should be some setting to make nix less strict if we want to keep the test. I'll look into it.

Non-equivalence between unicode and glyph / significant whitespace

There seems to be a difference between the functions with and without whitespace. An example:

zipWithIndex ← ' ∶⇡⧻,
zipWithIndex (-) [1 2 5 79]

stack: [1 3 7 78]

here, the function works as expected, but if you remove the whitespace between the ' and the rest of the function, it does not work

zipWithIndex ← '∶⇡⧻,
zipWithIndex (+) [1 2 5 79]

stack: 
[1 2 5 79]
[0 1 2 3]
+

However in both cases , substituting bind instead of ' gives the first answer. Curiously, it does not get substituted with ' in either case.

I recognize this might be abuse of bind and thus out of scope. Tested on the online pad

Signature of function with infinite repetition and break is calculated incorrectly

The following code compiles, even though it shouldn't

readLines ← (|0.1 ⍥(|1.1 ⊂∶ □ ⎋=0 ⧻ . &sc)∞ [])
readLines

foo actually returns two values here, because when the repetition breaks, the empty string is still on the stack on top of the array of strings, but the signature checker thinks that the function only returns one value.

Feature request: disable update checking

I had a bit of a frustrating experience on the train yesterday trying to use uiua with a patchy internet connection (it would hang for unpredictable amounts of time depending on whether I had mobile signal).

It would be nice to have an option to disable the update checking. Happy to raise a PR for this, but I could use some pointers! Specifically, I'm not sure how to add a global option, which seems like the nicest way to do this, when clap us derived on an enum. Maybe it's preferable just to add options to each command that checks for updates?

[meta] add the "why" in commit body too

  • add the "why" in commit body too: even 1-2 sentences will suffice.
  • it will function as dod (defense of design) itself 😃 ; and hence will super reduce any nagging annoying questions
  • also, don't ever post only links there, make sure the crux of the reasoning is understandable right there in the plain text commit body 😃
  • this will also act as a last chance to think about if the change/design is good

uiua/site/src/other.rs

Lines 17 to 19 in eff92d4

<h1 id="design">"Design"</h1>
<p>"This page explains the reasons for some of Uiua's design decisions."</p>
<p>"It serves as a "<a href="https://news.knowledia.com/US/en/articles/more-software-projects-need-defenses-of-design-85ea9e23ffd85f5fde5a2d3d42001393cbce169a">"defense of design"</a>"."</p>

examples:

  • 81afa83 & a117396: "change dip's glyph" ( to )
    the arrow felt super apt: it moves the current position of the stack one position towards right for the next operation.
  • 07378ef (#84): "formatting of ascii glyph functions"
  • 27bcc47 01df557: "call it [share] lives" then reversion: "rename lives to share"

Add dump function

I'd like to have a dump function that debug prints the whole stack without popping the values.

It would be very useful for debugging if you have left the stack in the right order after some operations.

Formatter: Special treatment of shebangs

Would it be possible for the formatter to specially handle shebangs at the beginning of a file? That means that no space is put between # and ! in the first line regardless of config.comment_space_after_hash?

This would allow to simply run a uiua file directly under Linux for example:

#!/bin/env -S uiua run

"Hello World"
./main.ua
"Hello World"

Crash when using CTRL+D with `&sc`

Came across this crash when playing around with user input. A single file with &sc is enough to reproduce.

Running:

$ uiua run main.ua
The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: /home/$USER/.cache/cargo/registry/src/index.crates.io-6f17d22bba15001f/uiua-0.0.4/src/sys.rs:551

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: The interpreter has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
main.ua:1:1
&sc

   ╭─[main.ua:1:1]
 1 │ &sc
   │ ───
───╯

any way to combine two lines of codes with some separator?

hi! thanks for such a wonderful language & project

  • i was wondering if there's any way to combine two lines of codes into one?
# Sharing in names as the symbols may change
intd = flip dip mod floor divide over over  # intd ← ∶ →◿ ⌊÷ ,,
div = max * +1 range                        # div ← ↥ × +1 ⇡

# TESTS
intd2 +1 range6                             # intd2 +1 ⇡6   # [0 1 1 2 2 3] [1 0 1 0 1 0]
div 6                                       # div 6         # [1 1 3 2 5 3]

I was thinking something like any of these:

(div 6) (intd2 +1 ⇡6) # [1 1 3 2 5 3]
div 6; intd2 +1 ⇡6 # [1 1 3 2 5 3]

so, like here,

  • the div 6 depends the output of previous command to be on the stack
  • being able to combine these 2 in one would make the connection clear,
  • and hence be super helpful in documenting changes while developing the function.

and: the rest others here can be commented out or even deleted as they are all same, but this outlier has to be there

  • being in separate line, either of these is susceptible to deletion while doing cleaning up
  • and being multi-line, these require additional line breaks before & after for distinction

a screenshot took midway during cleanup of brainstorming done on the smartphone

uiua / uiua watch unwrapped result is PathNotFound

Unexpected Behaviour:

Running uiua or uiua watch (after uiua init) causes a crash due to an unwrap()'ed Result.

Message:  called `Result::unwrap()` on an `Err` value: Error { kind: PathNotFound, paths: [""] }
Location: src/main.rs:182

Source code:

uiua/src/main.rs

Lines 177 to 183 in 3603b8c

fn watch(open_path: &Path) -> io::Result<()> {
let (send, recv) = channel();
let mut watcher = notify::recommended_watcher(send).unwrap();
watcher
.watch(Path::new(""), RecursiveMode::Recursive)
.unwrap();

Likely Cause:

I don't think the empty sting "" does not represent the current directory on MacOS.

Fix:

Using Path::new(".") fixed the issue for me locally

Details

Rustc Version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
Cargo Version: cargo 1.72.1 (103a7ff2e 2023-08-15)
Uiua Commit: #3603b8c
OS: MacOS Sonoma 14.0

Are the permalink URLs to the uiua pad compressed in any way?

I just saw this in the discord:

https://uiua.org/pad?src=Z2NkIOKGkCA74o2lKOKOiz0wLuKXvyzihpLihqfihqUsLCniiJ4KYXJyR2NkIOKGkCBnY2TiiqLiiLbiiqLih4wuCmNvbXBsZXhTcXVhcmUg4oaQIFvihpIow5fDlzIpLcOXLuKItsOXLiws4oqi4oi24oqi4oeMLl0KcGFpcnMg4oaQIC_iioLiip7iioIuKzHih6EKc29ydCDihpAg4oqP4oyCLgoKdHJpcGxldHMg4oaQICgKICBwYWlycwogIOKWveKJoSg84oqi4oi24oqi4oeMLikuICMgZmlsdGVyIGZvciBvbmx5IHNvcnRlZCBwYWlycwogIOKJoShjb21wbGV4U3F1YXJlKSAjIGdldCB0cmlwbGV0cwogIOKWveKJoSg9MWFyckdjZCkuICMgZmlsdGVyIG91dCByZXBlYXRzCiAg4omhKOKKguKItuKImi8r4oG_Mi4pICMgZ2VuZXJhdGUgdGhpcmQgbnVtYmVyCiAgLiAjIHNhdmUgZm9yIGxhdGVyCiAg4omhKC8rKSAjIHN1bQogIOKGkuKItiAjIGJyaW5nIGNvbnN0YW50IGZvcndhcmQKICDiiLoow7cpICMgZmluZCByYXRpb3MKICA9MOKXvzEuICMgYnVpbGQga2VlcCBhcnJheQogIOKGkuKWvS4gIyBrZWVwIHJhdGlvCiAg4oaS4pa94oi2ICMga2VlcCB0cmlwbGV0CiAgw5cgIyBtdWx0aXBseSByYXRpbyBhbmQgdHJpcGxldAogIOKJoSgvw5cpICMgcmVkdWNlIGludG8gcHJvZHVjdAopCgp0cmlwbGV0cyAzMCAxMjA=

That's 844 characters for the base 64 portion of the URL, and it's not that big of a snippet. I just wanted to mention that if you throw the same source code through lz-string's url-safe compressor, it gives a string of 636 characters.

I assume that array languages generally do not compress very well in the "repeated substring" sense, but the thing is that lz-string also compresses by limiting itself to characters actually in the dictionary. Since there are only 68 unique characters in this linked example (and that's because of the amount of comments), this already saves about two bits per char compared to a regular UTF-8 conversion.

I'm not sure how one might add this in a backwards compatible way (also a variant algorithm more dedicated to uiua's particular "text distribution" might be more appropriate, let me know if you want me to look into that)

Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT

Hi!

Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (including static analysis tools and compilers like Rustc, Clang, Clangd, Clang Tidy, and many others) - the results are available here. So that's why I think it's worth trying to apply PGO to Uiua.

I can suggest the following things to do:

  • Evaluate PGO's applicability to Uiua tooling (like the compiler).
  • If PGO helps to achieve better performance - add a note to Uiua's documentation about that. In this case, users and maintainers will be aware of another optimization opportunity for Uiua.
  • Provide PGO integration into the build scripts. It can help users and maintainers easily apply PGO for their own workloads.
  • Optimize prebuilt binaries with PGO.

Here are some examples of how PGO is already integrated into other projects' build scripts:

After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO.

For the Rust projects, I recommend starting with cargo-pgo.

Wrong stack signature inferred when `pick`ing function from array

The following code behaves as expected:

choose ← ! ⊡∶(|1 +1)_(|1 ×4)_(|1 ÷3) .

choose 0
choose 1
choose 2

Output with uiua from commit 5cdb0e7:

1
4
0.6666666666666666

However, if I add a stack signature (or try passing choose to a modifier that expects a single-output function, like each), then it fails:

Error: Function signature mismatch: declared |1.1 but inferred |1.2
   ╭─[..../sig.ua:1:10]
 1 │ choose ← |1 ! ⊡∶(|1 +1)_(|1 ×4)_(|1 ÷3) .
   │          ──  
───╯

Note I was as explicit as possible giving signatures to the functions in the array.

[Feature Request] Allow passing --no-format to 'uiua watch'

The formatter is awesome, and it's great to have a consistent codestyle everywhere, but I prefer deciding when the formatter is ran, so my only option at the moment is uiua run --no-format.

I'm running uiua watch from a terminal outside my editor, and my editor doesn't reload files immediately after saving them, meaning I get 'are you sure you want to write the file, since its changed on disk' every time the formatter changes something immediately after I write my file.

My current workaround (with Powershell) is to 'watch' manually:

while (1) { uiua run .\path\to\file.ua --no-format; sleep(0.25); clear; }

Additionally being able to tell uiua watch which file specifically I'd like it to watch would be nice.

Thank you!

Binding inside functions would be very useful

Hi there,

Currently when you try to bind inside a function, you get a syntax error, but it would be very useful to be able to do this. It could work as a sort of optional function arguments, while keeping all the benefits of a tacit programming language.

Example code:

MyAdd ← (
	Var ← 
	AnotherVar ← 
	+ Var AnotherVar
)
MyAdd 5 5

expected output:

10

current output:

Error: Expected term or `)`, found ` `
   ╭─[:2:5]
 2 │     Var ←
   │        ─  
───╯

P.S.
Even if you don't end up implementing this, it would be nice if the documentation and the error were clearer about this

Comma instead of underscore

Have you considered using a comma instead of an underscore for the tacit vector notation?

Writing 1,2,3,4 strikes me as much more intuitive than 1_2_3_4.

Of course that would require over getting a new symbol, but that doesn’t seem a bad trade off.

a way to convert glyphs back into name

what

a way to convert glyphs back into name

use cases

  • super helpful in migration from breaking changes in glyph designation like in #58
  • documentation or tutorial material where showing names make more sense

e.g. for "showing names more sensible":

  • recommended font dejavu not suitable or not to the liking - say for print media like books
  • in a beginner tutorial - where you are introducing this language to newcomers & you want to start with names
  • in accessibility critical usage: i.e. for people with eye sight problems
  • where you (content creator/book author) can't expect reader to remember specifics of any language as you are covering huge breadth of prog langs/paradigms
  • better searchability of keywords

Interpreter crashes with if under is used incorrectly

This just happened to me on the current master branch.

The application panicked (crashed).
Message:  source slice length (1) does not match destination slice length (2)
Location: src/algorithm/dyadic.rs:1065

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 7 frames hidden ⋮                               
 8: core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail::he28e939c009d96d8
    at <unknown source file>
 9: uiua::algorithm::dyadic::<impl uiua::array::Array<T>>::untake::{{closure}}::h5e9361cfc8866fc7
    at <unknown source file>
10: uiua::algorithm::dyadic::<impl uiua::array::Array<T>>::untake::hcd3e5b469f645a78
    at <unknown source file>
11: uiua::primitive::<impl uiua::primitive::defs::Primitive>::run::h6fc3d8da369377c9
    at <unknown source file>
12: uiua::run::Uiua::exec::h15c55a0fdd63db50
    at <unknown source file>
13: uiua::run::Uiua::call_with_span::hd4cd9164130fa999
    at <unknown source file>
14: uiua::primitive::<impl uiua::primitive::defs::Primitive>::run::h6fc3d8da369377c9
    at <unknown source file>
15: uiua::run::Uiua::exec::h15c55a0fdd63db50
    at <unknown source file>
16: uiua::run::Uiua::exec_global_instrs::h781ded5870d44b97
    at <unknown source file>
17: uiua::run::Uiua::items::h133190d7a873af9f
    at <unknown source file>
18: uiua::run::Uiua::load_impl::h8f42d637ccbc264e
    at <unknown source file>
19: uiua::run::Uiua::load_file::h3ee99052fbdc9632
    at <unknown source file>
20: uiua::main::he5b6e4bfb8db3e21
    at <unknown source file>
21: std::sys_common::backtrace::__rust_begin_short_backtrace::h39b867a29983d447
    at <unknown source file>
22: _main
    at <unknown source file>
Error: The interpreter has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
./day03.ua:4:3
[1_0 0_1]
⍉
≥÷2⧻∶/+.⊢.
⍜'↙1

   ╭─[./day03.ua:4:3]
 4 │ ⍜'↙1
   │   ─  
───╯

Unimplemented Unicode escape in @

When using @ (character) to create a Unicode character that does not display directly, the output shows a syntax which includes the Unicode code point. Running

+ 8192 @\0

gives:

@\u{2000}

If you then use the same syntax in the source, it is not recognized:

Error: Invalid escape character 'u'
   ╭─[:1:1]
 1 │ @\u{2000}
   │ ───  
───╯

Using the web page implementation of Uiua.

How to put named functions on the stack without calling them?

The examples for the &i and use functions both show how to import functions from another file that puts these functions onto the stack:

&i "example.ua"
double ← use "double" .
square ← use "square"
square double 5

However, the examples don't show the contents of example.ua, so I don't exactly know how to export these functions there. It seems that I'm supposed to put the named functions into an array onto the stack in example.ua, but I don't know how to put functions onto the stack without calling them. I tried it like this:

# example.ua
double = *2
double

and like this:

# example.ua
double = *2
[double]

but these both throw Error: Stack was empty when evaluating argument 2.

I can put the function on the stack by doing this:

# example.ua
double = *2
[(double)]

but then it's wrapped in an anonymous function and not named anymore.

How can I get this to work?

'call' and '!' not behaving the same

This pad

arr ← [□ "1" □ "2"]

∵call arr

throws the following error:

Error: Stack was empty when evaluating index
   ╭─[:3:2]
 3 │ ∵call arr
   │  ────  
───╯
  in ! at 3:2

but the following pad does not

arr ← [□ "1" □ "2"]

∵! arr

Enable naming stack values for debugging.

Especially when modifying a complex function, it can become easy to mix up stack values. This is made much worse by some functions where most values are the same shape. It can be easy to be left with a stack of values that are too big to print (or even worse, not very meaningful if printed), that are the same shape, and that are accidentally out of order. The only visible symptom is the final output being wrong.

Being able to somehow annotate a stack value with a name that will flow it around as it is moved and duplicated on the stack would be very useful. The name would clear whenever doing any modifying operation (I think that would be most ergonomic). Then a parallel to dump could be added dumpnames. Not sure on best names, but could theoretically work like this:

name "x" [1 2 3]
name "y" [4 5 6]
dumpnames
# "x"
# "y"
,
dumpnames
# "x"
# "y"
# "x"
+
dumpnames
# "x"
# "" If we want to be super helpful maybe we could print "unnamed with shape ..." or just the shape for unnamed things.

(website playground) panicked at 'range end index 12 out of range for slice of length 9'

Hi, it's me again 😅. It seems that I found another runtime error x)

Program

func ← ↯[⧻∶⧻]..
func [3 5 2]

⌂≡(⊗).

Expected output

Not sure, I wanted to try grades to understand what it did

Actual output

None. "Running" blinks forever.

Console

Full traceback in the next comment.

Specs

Browser: Google Chrome 118.0.5993.32 (Official Build) beta (64-bit)

[BUG?] Under Deshape

Hey @kaikalii,

I have been adding Uiua to my array-language-comparisons repo and I think I found a bug. This code:

Mat ← ↯3_4⇡12

⍜⇌♭ Mat

yields

[3 2 1 0 7 6 5 4 11 10 9 8]

when I would expect it to yield:

╭─           
╷ 11 10 9 8  
   7  6 5 4  
   3  2 1 0  
            ╯

similar to the way under deshape works in BQN. Maybe I am doing something wrong though or the behaviour is intended.

Uiua Pad Link: https://uiua.org/pad?src=Mat%20%E2%86%90%20%E2%86%AF3_4%E2%87%A112%0A%0A%E2%8D%9C%E2%87%8C%E2%99%AD%20Mat


On an unrelated note, I've been playing with Uiua all day since the ArrayCast recording and it is awesome. It is probably my second favorite language now after BQN. I love the . and : combinators for C and W. Tacit programming feels amazing in Uiua.

Add Cargo.lock file

I'm packaging for nixpkgs rn, and noticed you didn't have a .lock file. Is this an oversight or on purpose?

LFR (aka RTL) comment?

hi! thanks for such a wonderful language & tooling.

as uiua's execution is LFR (#2) , so, i think having a same direction comment would help a lot in breaking down the code while reading & trying to understand.

otherwise now, at least how i do it - it becomes very very cumbersome to track down where things are going wrong.

  • first break the line at left of the operation
  • move line up
  • move cursor down & comment the line
  • move cursor back up to make edits

Attached is a screenrecord of how i do it currently (it's a bit slow, increase its playback speed to save time):

uiua.lang.comments.rtl.lfr.konsole_HxAfQIufcG.mp4

(website playground) panicked at 'capacity overflow' with using `range`

Hi!

I recently discovered uiua through a code_report video. It looked very interesting so I wanted to try it out. So far it is very fun!

While playing with it, I encountered what I think is a bug:

Program

In the website playground, I have typed the following program:

test ← +⇡
test 15 10

r ← ⇡
r 3

Expected output

[10 11 12 13 14 15 16 17 18 19 20 21 22 23 24]
[0 1 2]

Actual output

None. Instead, "Running" is being displayed forever.

Console

The following errors are printed:

site-11b5530f73ff5e21.js:384 panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5
Uncaught RuntimeError: unreachable

Full traceback: www.uiua.org-1696081573340.txt

Specs

Browser: Google Chrome 118.0.5993.32 (Official Build) beta (64-bit)


Hopefully, this report gives enough information to be useful. Thank you in advance for your response!

open github discussions?

  • i don't know if it would become messy (read: duplicate/super-noob riddled) or not - given the beginner stage of the language & newcomer influx it would be getting
  • but i think having a place to clear doubts is required.

^

  • there is already discord (as mentioned in readme) but many ppl don't like/use that...
  • there can be others like telegram, discourse, zulipchat or what not - but previous point can apply to that too
  • so, having github would be path of least resistance i guess....

[Suggestion] Program solver

Hello!

Thanks so much for making this amazing language!

I'm learning it, but as with most languages and array languages especially, there are so many better ways of solving a problem that I don't know of.

Some languages (elisp, haskell, etc) have program solvers that can write simple programs for you using the least amount of functions possible by either iterating through all possible combinations of inputs until the correct output is reached, or by doing something smarter.

Emacs lisp has the package suggest.el that does it, and it has some awesome documentation that outlines alternatives for different languages.

Here's an example of its output:

;; Inputs (one per line):
"Hello. World!"

;; Desired output:
'("hello" "world")

;; Suggestions (press C-c C-c to update):

(s-split-words (downcase "Hello. World!")) ;=> ("hello" "world")
                                           
(apply #'s-split-words (list (downcase "Hello. World!"))) ;=> ("hello" "world")
                                                          
(s-split-words (car (list (downcase "Hello. World!")))) ;=> ("hello" "world")
                                                        
(s-split-words (last (list (downcase "Hello. World!")))) ;=> ("hello" "world")

It would be amazing if someone made a program like this for Uiua, especially now that so many are learning it.

Maybe this is the wrong place to put an issue like this, please tell me if there's a better place to put it.

Thank you!

Index out of bounds: the len is 0 but the index is 0

The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: src\algorithm\monadic.rs:150

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: The interpreter has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
E:\WindowsUserSpace\Desktop\Uiua\main.ua:1:1
⇌⊜[]≠@ ."Oh boy, neat!"

   ╭─[E:\WindowsUserSpace\Desktop\Uiua\main.ua:1:1]
 1 │ ⇌⊜[]≠@ ."Oh boy, neat!"
   │ ─
───╯

it's the same as ⇌[""""]

Uiua installed from the AUR crashes on startup

I installed from the AUR using the latest stable Rust (from Rustup) and whenever I try to run Uiua it panics like so:

~ $ uiua init
Profiling... warmup 1/3The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Run(3:1: "Cannot infer function signature: /'s function · has 0 args, expected 2")
Location: src/profile.rs:92

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Installing via Cargo works like normal, though.

`&pf` does not flush stdout

I am trying to create a prompt for an input box, but it does not seem like &pf actually flushes stdout.

Code:

prompt ← (&sc &pf "> ")

&p prompt

Running:

$ uiua run main.ua
hello
> hello

I would expect that the > be printed right away, but it does not get printed until after I hit enter.

Changing "> " to "> \n" fixes the issue, but now I have an extra newline:

>
hello
hello

Also, thank you for making Uiua! I have been enjoying using it for the little side project I'm currently working on.

Do you have some sort of community hub?

Hi there, I was wondering if you guys needed any help with the website or graphics in general. I think it's a pretty cool project and I thought I could maybe help out. I didn't see any way of getting in contact with you, and I saw there is no community hub anywhere, no Discord server or Matrix group. Maybe we could make one?

Cheers.

why not convert "ascii" having glyphs names too?

i had seen that right when that commit was made, but i resisted the temptation to ask immediately
07378ef

but now i can't stop 😅
so, why this exception??

uiua/site/src/tutorial.rs

Lines 170 to 172 in 07378ef

<p>"Functions whose glyphs are ASCII do "<em>"not"</em>" format from their names. For example, "<Prim prim=Trace/>":"</p>
<Editor example="~5"/>
<Editor example="trace 5"/> // Should fail

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.