#uiua — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #uiua, aggregated by home.social.
-
@jonocarroll I would have used an APL-like solution in #Uiua: ⍜∩⊥₁₀↻¯
-
-
Back in November, I decided I was going to attempt this year's Advent of Code in uiua as far as I could.
Uiua is a tacit (no variable bindings - state is on the stack) array-programming language, strongly influenced by APL and BQN - some things were obviously going to be pretty easy in it, but I was concerned about managing larger programs in a tacit paradigm. However, given I've not done much array programming, I thought the challenge would be good for me.Unexpected complication: I had flu - badly enough that I did have a fever and was clearly not entirely there for the second week of AoC. This meant that several of the later days had a lot of debugging needed...
My worries finally happened in Day 9 Part 2. Trying to write a relatively complex algorithm in uiua - with flu - meant that I lost track of the state of the stack somewhere. I tried debugging the code a few times [I even tried throwing LLMs at it as a last resort¹... which confidently told me multiple things that weren't true about the problem space and the code... and never found any issues - so much for the future of coding] but uiua's debugging functionality seems to rely on you using VSCode [sigh].
In the end, I solved everything but Day 9 Pt 2 and Day 10 pt 2 in uiua - it excelled at a lot of the problems (Day 11 Pt 2 was fun, although I wish uiua had built in matrix maths).
The last 2 days I finally wandered back to the unsolved parts and solved Day 9 and 10 pts2 in Julia - my solution to Day 9 was exactly the approach I tried to implement in uiua, but the Julia implementation worked perfectly first time (thanks, local variable bindings!).So, I think it was worth it - using uiua for most of AoC did make me think a bit different for some of them - but I remain somewhat unconvinced that tacitness is a great match for more complex algorithms. (And it's worth noting that uiua's basket of operators includes several that were implemented *because* the community found it hard to solve AoC problems in stock uiua without them!)
The most fun was using the fft operator (yes, uiua has one) to solve Day 4 (both parts) in a way I don't think Eric expected - it wasn't *optimal*, but it was *fun*.
(footnote about LLMs in reply)
-
CW: Advent of Code Day 10 in Uiua with flu (solution to pt2 discussed)
So, pt1 is of course pretty trivial with a basic search, which boded poorly for pt2.
It looks like it's a underdetermined set of equations so we probably reduce with row reduction (easyish in Uiua) and then use the much shorter resulting bottom row to evaluate the (hopefully small) candidate space of integer solns to the remaining unknowns... and recurse up to eliminate potential solutions as we add constraints?
But I also have flu and am going to have to write this myself in Uiua so it might wait to the weekend. People using Z3 in Python are, of course, cheating. ;)
-
A bit behind on AoC because I had a busy day yesterday (so I only had time to write down how to do the thing the trivial way and think about representations in uiua) and now I seem to have flu which isn't helping with the backlog :D
[I also have to finish off Day 2 Pt2 which I deliberately attempted in a "clever and asymptotically much faster than naïve" approach, but is thus actually harder than my solutions to days 3-7 have been :D ]
-
CW: AoC 2025 Day 7 ... pt2 soln
I am surprised to see people deciding that *memoisation* is the correct speedup for pt2 - you can just do pt1 but counting "how many beams" are overlapping (so if splitter 1 and splitter 2 both split into a space, you add the weights from both input beams to get the combined beam weight in that space), Then you just sum the weights at the end.
This was fairly nice in uiua except I forgot about fix and generally had some time working with arrays where I wanted to do different things to different rows/columns/etc.
-
CW: Advent of Code Day 6 in uiua
This was pretty easy - array programming languages are made for this kind of thing - mostly complicated by my deciding to forget about boxes when doing part 2 (and spend time on an overcomplex attempt with dynamic fills instead for a while).
Similar thing with Day 5, where I got most of the way into a solution before realising that I was just reimplementing fold less well...
-
CW: Advent of Code 2025 Day 4 code uiua
And, thanks to #uiua 's built in gif support, it just needed a small edit to keep the history of the grid and a &fwa "out.gif" gif 24 to output this animation of the sequence of barrels being removed:
-
CW: Advent of Code 2025 Day 4 code uiua
More effort needed in parsing and initialising for the fft convolution approach - all this is setup in the "Init" function - but the core logic is pretty dense (and I think could be denser as I get better at using subscripted on/by instead of forks with different selectors to preserve values - Convolve can probably be shorter before the first fft).
If you remove one of the "gaps" at the left of the final line and replace it with an &ims you get a nice b/w image of the final state. (and you can modify the internal loop with a suitabley surrounded ⟜&ims to display the intermediate states if you want).
(This is pt2 - for pt1 most of the same logic applies, but you can just do the bits inside the loop without needing the loop [and the handling is simpler because you don't need to accumulate after the functions])
Parse ← ≡₀°□=@@⊜□⊸≠@\n &fras
Kernel ← [1_1_1 1_0_1 1_1_1]
Pad ← ↻⊙∩⌞(⬚0↙)∩(˙⊂)◡(⌊÷₂⟜(-₁+)∩⧻)Init ← 1 Pad Kernel Parse⟜(0)
Convolve ← ⌵⁅×°fft×∩fft⊃(⊙⋅)(⟜⧻⋅∘)
Mask ← ⊸₂(×⊙⋅∘)<4
Apply ← /+/+⟜₂(⍜⊡(×0)⊚ ⊙◌)
Accum ← ⟜₃(+⊙⋅⋅∘)⋅⋅⋅∘⍢(Accum Apply Mask ◡Convolve◌|≠0) Init "input"
-
CW: Advent of Code Day 4 in uiua
Uiua has a built in fft operator... and this problem can be viewed as a convolution of the barrel map with a 3x3 "0" shaped adjacency kernel.
So, obviously that's how I solved this - with a little finicky work at the start to pad the input and kernel correctly (also made easier than in many languages thanks to uiua's multidimensional "rotate" and "take" operators, and the very useful "fill" as a modifier). -
#AdventOfCode 2025 started today. I've got all 500 stars from previous editions, mostly in #Rust, some in #Elixir, and this year #Uiua will probably my language of choice. My solution for today was written in Uiua (104 chars), Elixir (649 chars), and Rust (658 chars), just for fun.
Whatever your preferred language is, or whatever language you want to learn, https://adventofcode.com/ is for you. This and the Synacor challenge (same author) is how I really got serious in Rust back in 2015.
-
CW: AoC 2025 Day 1 in Uiua
I've completed "Secret Entrance" - Day 1 - Advent of Code 2025 #AdventOfCode https://adventofcode.com/2025/day/1
Doing this in #uiua and I'm rusty so this is probably inefficient for pt2 but I wanted to chunk it into logical pieces. Listing is the parser and took me the longest to think about before I got to this version of it :D
Listing ← ≡₀(⋕⍣°(⊂@r)(⊂@-↘1) °□) ⊜□ ⊸≠@\n &fras "input"
Loops ← /+⁅-0.5÷ 100⌵ Listing
Moves ← ⍜⊙⌵◿ 100 Listing
Positions ← \(◿ 100 +)⊂ [50] Moves
Counts ← /+⨬(×⊙(±) ⊸≤ ⌵|⋅⋅0|≤ ⊙(⌵-100)) ⊸(+1±) Moves ⍜⇌ (↘ 1) Positions
+ Counts Loopshttps://codeberg.org/aoanla/Advent-of-code/src/branch/main/2025/01 for the fully commented version (as I was thinking about it out loud in the file)
-
@desttinghim You might also enjoy #uiua! It's inspired by BQN but also has stack language features -- I find it very elegant. It's written in rust, so I'm not sure if it's as easy to embed from zig.
https://www.uiua.org/ -
Tu connais Brainfuck ? C'est marrant mais inutilisable.
Ben dans la série "ésotérique MAIS (apparemment) utilisable dans la vraie vie"
Mes neurones ont surchauffé.
Il en reste juste assez pour envoyer ce pouët. Après, paracétamol, codéine, dodo, glace sur le front. -
@a #uiua ?
https://apl.wiki/Uiua
"overloading of ambivalent functions is removed" -
did a thing
https://uiua.org/pad?src=0_17_0-dev_1__UCDihpAgKAogIOKXv-KCgiviiKnijIriioMow5figojijLUv4oSCfMOXNMO3z4Av4oigKQogIOKNnC3DlyDimoJfMV_imoIgMV8wLjVf4pqCIMKkCikKClIg4oaQIOKNnCjijYnima3igoJ8UMO34oqD4oqh4oKAKC3Dt-KCgik6KeKHoS4K4oip4oKD4oyfKFLiip_ijIriirjDtykgMTYvOSAzLzIgNC8zIDI1Ngo=
#uiua #programming #graphics -
@robertpi I had the same feeling somehow, and I discovered #uiua..
https://www.uiua.org/
A stack based, table oriented language.
In the online editor you can created images, sounds, animations and now voxels..
Some super interesting concepts like inverse of functions...
It could look like an esolang but it's far more than that and the tooling is great. -
Implementing small math problems can really help to cement your knowledge of fundamental operators...
https://jcarroll.com.au/2025/05/03/rotation-with-modulo/
I implemented a 'rotate digits with modulo' in #rstats :rstats: #julialang :julia: #apl :apl: and #uiua :uiua: and had a great time doing so!
-
grafiks
https://uiua.org/pad?src=0_16_0-dev_1__V2lkdGggIOKGkCAyNTYKSGVpZ2h0IOKGkCAyNTYKU2l6ZSAgIOKGkCDiip8gV2lkdGggSGVpZ2h0CgpXaWR0aCBIZWlnaHQKJCQgUDMKJCQgXyBfCiQkIDI1NQokJAomcGYKClBpeGVsIOKGkCAoCiAgy5ziioIwLjUgw7cgLeKCgVNpemUKKQoK4pmt4oKC4oehU2l6ZQriiaEoCiAgJmVwZiAkIlxyU2NhbmxpbmVzIHJlbWFpbmluZzogXyAiIMucLUhlaWdodOKKuOKKoi4KICBQaXhlbAopCgomcCAvJCJfXyIg4omhKOKWoSQiXyBfIF9cbiIgwrBb4oqZ4oqZ4oiYXSDijIrDlzI1NS45OTkpCgomZXAgIlxyRG9uZS4gICAgICAgICAgICAgICAgICIKCiMg4omh4omhIiZwICQiXyBfIF8iLiDijIrDlzI1NS45OTkiCg==
(this... can't really run on the pad)
#uiua #raytracinginoneweek -
Real shame #Uiua is another open project locked closed community (Discord + MS GitHub) 😞
-
I wrote up my experience of using #uiua for 2024's #AdventOfCode. Many languages could learn a lesson or two from the frankly beautiful developer experience of Uiua's web repl.
https://blog.probablyfine.co.uk/2025/01/04/attempting-advent-of-code-2024-using-uiua.html
-
i've been messing with the uiua programming language lately and i'm enjoying it so far because no other language has ever made it feel so much like i'm a wizard writing little magic spells
(using the funny symbols isn't actually as bad as it looks, you just type in the name of one and it converts for you, and you can hover over them to see the description again. luckily everything else about this language also feels like magic spells)
-
I am extremely behind on my #Exercism practice but I'm overjoyed to hear that they've added a #Uiua track
https://exercism.org/tracks/uiua
and a #Roc track
https://exercism.org/tracks/roc
I've joined both, which should gradually appear in my tracker of which problems I've solved in which languages https://github.com/jonocarroll/exercism-solutions