218 results for "":
Recursive iterators in Rust
I’ve been looking for this blog post everywhere, but it doesn’t exist, so I guess it’s my turn to write about Some Fun with Rust.
The task at hand
Let’s say you have a recursive, acyclic data structure, like so:
struct Node {
values: Vec<i32>,
children: Vec<Node>,
}
This allows you to represent a tree-like structure:
[1, 2, 3]
/\
/ \
/ \
/ \
/ \
[4, 5] [6, 7]
Dynamic linker speed and correctness
In the last article, we managed to load a program (hello-dl) that uses a single
dynamic library (libmsg.so) containing a single exported symbol, msg.
Our program, hello-dl.asm, looked like this:
global _start
extern msg
section .text
_start:
mov rdi, 1 ; stdout fd
mov rsi, msg
mov rdx, 38 ; 37 chars + newline
mov rax, 1 ; write syscall
syscall
xor rdi, rdi ; return code 0
mov rax, 60 ; exit syscall
syscall
Day 5 (Advent of Code 2020)
Time for another day of Advent of Code 2020.
For Day 5, we’re going to have to do…
Let me guess: more parsing?
Correct!
So there’s an airline that uses binary space partitioning when referring to seats - there’s 128 rows and 8 columns. The first 7 characters are either F (Front, for the lower half) and B (back, for the upper half), and the last 3 are L (Left, for the lower half) or R (Right, for the upper half).
Day 13 (Advent of Code 2022)
The day 13 puzzle needs a speech therapist.
???
…because it has an awful lisp!! Ahhhahahahhhh
Are you ok? What is.. what is going on with you?
No but seriously we have what are ostensibly S-expressions, except they use JSON-adjacent notation:
[1,1,3,1,1]
[1,1,5,1,1]
[[1],[2,3,4]]
[[1],4]
[9]
[[8,7,6]]
[[4,4],4,4]
[[4,4],4,4,4]
[7,7,7,7]
[7,7,7]
[]
[3]
[[[]]]
[[]]
[1,[2,[3,[4,[5,6,7]]]],8,9]
[1,[2,[3,[4,[5,6,0]]]],8,9]
2020 Retrospective
Against all odds, it looks like the year 2020 will actually come to an end - in less than a day now. I know! Hard to believe for me too.
A lot of things have happened for me personally, and professionally. It’s been a big year in many ways, and I feel like, to get some closure, I need to highlight some of them.
From “looking at graphs” to “driving to the hospital”
Day 3 (Advent of Code 2022)
Part 1
I’m not sure where the day 3 challenge is going, because the problem statement for the first part is kinda convoluted.
As usual we have an input, like this:
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw
Each line represents the contents of a “rucksack”, divided in two halves (which are called “compartments”), so for line 1:
rock 0.9.8 is out
A little less than two months after the previous release, I’m happy to announce
that the ooc compiler rock 0.9.8, codename columbia is now out.
The impatients can readily skip to the release notes, but for those who prefer a narrative, let me tell you why I’m excited about this release.
String interpolation
We’ve thrown around this idea a lot since the early versions of rock since we have a few rubyists in our ranks, but only recently Alexandros Naskos took matters into his own hands and just implemented the fuck out of it.
Proc macro support in rust-analyzer for nightly rustc versions
I don’t mean to complain. Doing software engineering for a living is a situation of extreme privilege. But there’s something to be said about how alienating it can be at times.
Once, just once, I want to be able to answer someone’s “what are you working on?” question with “see that house? it wasn’t there last year. I built that”.
Instead for now, I have to answer with: “well you see… support for proc macros was broken in rust-analyzer for folks who used a nightly rustc toolchain, due to incompatibilities in the bridge (which is an unstable interface in the first place), and it’s bound to stay broken for the foreseeable future, not specifically because of technical challenges, but mostly because of human and organizational challenges, and I think I’ve found a way forward that will benefit everyone.”
Lestac: The Making Of
Update: Lestac is now available in Early Access on itch.io! Read more on the official page
So, Lestac is out! Ain’t that something? For those who don’t know, it’s Sylvain and I’s entry for Ludum Dare 28, a video game jam that happens every four months.
Here’s how it looks:
You can play it now if you haven’t yet - it’s available for Linux, OS/X, and Windows. And then you can come back and read this postmortem if you will!
Trying to use nix
Now that my website is deployed as a container image, I wanted to give
nix a try. I’m still doing it the old-fashioned way right
now: with a Dockerfile, running cargo in a “builder” image, copying stuff
out of there into a slimmer image (that still has an Ubuntu base, even though
distroless images are a
thing now).
But why?
I was mostly interested in nix because some parts of my website have pretty big
native dependencies. futile itself mostly relies on sqlite3 and some JS engine
(used to be quickjs, currently duktape because MSVC Windows builds). But the
asset processing pipeline, salvage (which I’d like to integrate with futile
at some point) has a bunch more!