Live data from Hacker News

Uiua: A minimal stack-based, array-based language

uiua.org

91–100 of 107 posts

Re: Uiua: A minimal stack-based, array-based language

#91

I had no experience with array languages and decided to give it a try. It took me 4 hours to write FizzBuzz using only Uiua docs for help: # create an array of number 1-100 ns ← ∵(+1)⇡[100] # make a copy of it in a string form "1"-"100" nsStr ← ∵(□$"_") ns # every i % 3 == 0 is replaced with "Fizz", everything else is "" f ← ∵(□▽∶ "Fizz" =0◿3) ns # every i % 5 == 0 is replaced with "Buzz", everything else is "" b ← ∵…

That's some dedication! You can indeed get the maximum item in an array with `/↥`. Here is my fizzbuzz solution: (https://uiua.org/pad?src=fizzbuzz%20%E2%86%90%20%28%0A%20%20...)

Re: Uiua: A minimal stack-based, array-based language

#92

This is actually pretty neat. But I'm having a hard time understanding how to ergonomically write with glyphs. What's the intended workflow. Remembering a bunch of shortcuts to get ⌕ instead of just typing `find` seems harder to read and write. Edit: I think I understand from the language tour. You're supposed to write the ascii names like `find` then running the program converts built-ins to glyphs.

Also, the editor in the language has an expandable dedicated glyph panel (click the "Show Glyphs" or "Hide Glyphs" button on the upper right; on the front page it is expanded by default in the top example and the Pad editor page but then hidden on the rest of the embeds).

That glyph panel is pretty neat because it also serves as a language reference and you can ctrl+click into the documentation pages.

Re: Uiua: A minimal stack-based, array-based language

#93

Hmm, so ⌊×10[⍥^999] yields a list of numbers, but ⌊×10[⍥^1000] yields an audio clip. That's somewhat unexpected. The ^ above stands for the 3-dot cube dice glyph, which gets eaten by the HN backend, so it's ^ instead.

This is shows that you cannot make a language in the vacuum. There are other places and services that you need to integrate with and the use of these glyhps is making it harder. I think using simple words: find, reverse, etc. is probably a better option.

Or it proves that HN's unicode stripping and intentional emoji blocking is making it harder than necessary to communicate some math and programming topics in their preferred notations.

(Also, this language supports the "simple words" approach but autoformats to the glyphs for final "readability".)

Re: Uiua: A minimal stack-based, array-based language

#94

I had no experience with array languages and decided to give it a try. It took me 4 hours to write FizzBuzz using only Uiua docs for help: # create an array of number 1-100 ns ← ∵(+1)⇡[100] # make a copy of it in a string form "1"-"100" nsStr ← ∵(□$"_") ns # every i % 3 == 0 is replaced with "Fizz", everything else is "" f ← ∵(□▽∶ "Fizz" =0◿3) ns # every i % 5 == 0 is replaced with "Buzz", everything else is "" b ← ∵…

That's some dedication! You can indeed get the maximum item in an array with `/↥`. Here is my fizzbuzz solution: ( https://uiua.org/pad?src=fizzbuzz%20%E2%86%90%20%28%0A%20%20... )

Neat solution! Yes, I'm aware of `/↥`, but it finds maximum within a single array of values of the same shape. But what if I have two values of the same shape? E.g. `↥[][1]` throws an error. So I have to either `fill` them to the same shape or use `grade`.

Re: Uiua: A minimal stack-based, array-based language

#95

Earlier quoted context omitted.

I'm always wondering what kind of people prefer this syntax to more classical syntax

Hot take: people who don't touch type.

Oh, you can touch type emoji and symbols today. There are all sorts of interesting Input Method Editors (IMEs) for them. Since Windows 10 there's one by default in Windows if you type Win+. or Win+; (whichever you prefer). You can type and it will filter the emoji by name. It's not quite as nice for mathematical symbol entry, but it does include them (on the tab labeled with an Omega) and is still better than many other input methods for them. macOS has a similar out-of-the-box IME (Control+Command+Space), though it differs on the amount of math symbol support. Linux's most used IME subsystem `ibus` (specifically `ibus-emoji`) if correctly setup should also by default provide an experience for emoji (Super+. like Windows). There are third-party ones as well for most platforms.

Emoji is not just for tap-typing/swipe-typing mobile users. (Also, I think it is really handy as developer to learn your local emoji IME: including emoji in test data is really handy for checking unicode safety in your applications and regularly using any IME at all while in your applications helps you test some accessibility issues that might affect users that must use an IME for there language such as CJK languages and Braille writers and more. English software developers get to overlook a lot of how languages around the world work and can easily break accessibility needs with bad assumptions and it is great that emoji are a grand field leveling tool to bring those experiences to us English speaking developers in a way we can easily "read"/"write".)

Re: Uiua: A minimal stack-based, array-based language

#96
post #76

Earlier quoted context omitted.

That's a good start! I'm not exactly great with array langauges myself, but I think it's simpler to fill an array with □"Fizz", one with □"Buzz", one with □"FizzBuzz", then create another indexing array and use pick: ⍉[∵(□$"_"+1)⇡100 [⍥.99□"Fizz"] [⍥.99□"Buzz"] [⍥.99□"FizzBuzz"]] +∵(×2=0◿5+1)⇡100 ∵(=0◿3+1)⇡100 ≡⊡ ⍉ There are probably a few more simplifications experienced array programmers can apply.

https://code.jsoftware.com/wiki/NYCJUG/FizzBuzz gives a solution in J of: FB=:((0 i.~15 3 5|]){::'FizzBuzz';'Fizz';'Buzz';":)"0 FB i.100 I unfortunately don't know enough J or Uiua to be able to translate that Perhaps someone else can step in!

Luckily the Uiua language creator stepped in to help us out :)

Re: Uiua: A minimal stack-based, array-based language

#97

What an interesting and pleasing little language! I like the use of non-ASCII Unicode glyphs and symbols for some functions/commands. It makes me wonder why (since we now have rich graphical user interfaces as opposed to monochrome ASCII command-line dumb terminals that were prevalent in the mid-early history of computers) more languages don't support those. On a related note, I think it would be interesting to resea…

Speaking of ancient hieroglyphs, there is a long lineage of symbol-based languages and it is interesting to follow their ebb and flow over time: APL is one of the oldest languages, existing alongside contemporaries like COBOL. In the ancient mainframe era when everything was up for grabs and few things felt set in stone (including character encodings and the format of punch cards, and the sorts of keyboards used to punch those cards) APL was there trying to save punch card space (but not keyboard space, there were some huge APL-focused keyboards) by using a heavily math notation-influenced symbolic language.

Of course, as such things go, APL's appeal fell as the mainframe world settled on EBCDIC or ASCII (depending on if you were an IBM shop or not) as a "universal" character encoding and also as saving punch card space was less of a problem as other storage systems became more prominent.

Uiua seems a fun "emoji-native" take on "your grandmother's" APL. (BQN is generally cited as among the first "Unicode-native" in the APL family. Beyond the stack language changes as neither APL nor BQN are stack languages, Uiua swaps some niftier emoji-based choices for operators that feel fresher and less "ancient math hieroglyphics" and little bit more "texting your modern friend who in this case is a computer" hieroglyphics.)

Re: Uiua: A minimal stack-based, array-based language

#99

I'm a big fan of stack-based languages conceptually, but they always seem to fall flat when it comes to basic reading comprehension. APL has the same issue, as does J. Factor did improve on this a little bit by eschewing the symbol fetish but it was still very difficult to rapidly scan the code for functionality. I'm not convinced the approach shown here is a good pairing with the human brain.

I'm always wondering what kind of people prefer this syntax to more classical syntax

Akshually APL can be considered more classical than algol-style languages, since it originated as mathematical notation for teaching programming on a blackboard in class.

Lisp beats APL by a few years though, so there it really depends on whether you value lisp's seniority or APL's connection to math notation traditions more when judging how "classical" a language syntax is.

Re: Uiua: A minimal stack-based, array-based language

#100

What an interesting and pleasing little language! I like the use of non-ASCII Unicode glyphs and symbols for some functions/commands. It makes me wonder why (since we now have rich graphical user interfaces as opposed to monochrome ASCII command-line dumb terminals that were prevalent in the mid-early history of computers) more languages don't support those. On a related note, I think it would be interesting to resea…

Speaking of ancient hieroglyphs, there is a long lineage of symbol-based languages and it is interesting to follow their ebb and flow over time: APL is one of the oldest languages, existing alongside contemporaries like COBOL. In the ancient mainframe era when everything was up for grabs and few things felt set in stone (including character encodings and the format of punch cards, and the sorts of keyboards used to p…

It is a fun "emoji-native" take, but I think "fun" almost sells it short.

It feels like there really is something special about how the combination of all the little things make it more than the sum of its parts. On a language level therews a stack + absence of operator overloading + simple array model to make it easier to reason about. On an interface level there is word-based input with autoformatting, and a zero-install web-based interface with reminder tooltips and clickable links.

The examples are a lot easier for me to read through than with other array languages I've tried. And I've seriously tried both Dyalog and BQN! I think they're brilliant, but something just refuses to click in my brain for them.

Post reply on HN