Better HN
topnewbestaskshowjobs
Log inSign up

carlkcarlk

31 karma · joined Oct 30, 2024 (2y ago) · 18 submissions

Submissions

1.

Sex, Censorship, and the 1990s Fight over Campus Computing(medium.com ↗)

4 points · by carlkcarlk · 1mo ago · discuss

comment 5mo ago · link · parent

Interesting! I hadn't heard of DH parameters before. I worked this out from first principles starting from turtle graphics and ended up with four primitive operations: yaw, pitch, roll, and move. Not surprisingly, the parameter count comes out the same.

If I want to understand DH, I guess I'll need to add another tab to the spreadsheet.

3.

Show HN: A 2D and 3D robot arm simulator built in Excel(github.com ↗)

1 points · by carlkcarlk · 5mo ago · 2 comments

comment 11mo ago · link · parent

I’ve been enjoying Embassy most at the application pattern layer: long-lived device tasks that hide timing and coordination behind a small, typed async API. For example:

loop { let btn = ir.wait_for_press().await; // use btn }

Meanwhile the compiler builds the state machine for you.

I think this style is an emergent property of async + no-std that hasn’t really been collected or named yet. A lot of discussion focuses on HALs, bring-up, or executors, but less on how people structure applications once those pieces are in place.

Brad Gibson and I talked about some of these ideas in this (free) article on how Embassy shines on embedded devices: https://medium.com/@carlmkadie/how-rust-embassy-shine-on-emb...

I’ve also started an open repo to experiment with and document these patterns: https://github.com/carlkcarlk/device-kit

Would love links to other repos that use Embassy at this higher, application-oriented level.

comment 1y ago · link · parent

I used multiple AI agents (and Lean) to formally validate a Rust algorithm. Along the way the AI tried to hide missing proofs. I describe the process and surprises.

comment 1y ago · link · parent

This talk explains some recent Busy Beaver and Turing machine results using simple programs and shows how to visualize them efficiently. It’s aimed at programmers interested in long-running computations, big numbers, and algorithmic complexity.

7.

New Turing Machine Results with Simple Programs and Fast Visualizations [video](youtube.com ↗)

2 points · by carlkcarlk · 1y ago · 1 comment

comment 1y ago · link · parent

Here is the [final function in Python](https://towardsdatascience.com/how-to-optimize-your-python-p...): (Regular Python `int` is arbitrary precision, but immutable, so I use `gmpy2.xmpz` instead.)

    def tetrate(a, tetrate_acc):
        assert is_valid_other(a), "not a valid other"
        assert is_valid_accumulator(tetrate_acc), "not a valid accumulator"
        assert a > 0, "we don't define 0↑↑b"

        exponentiate_acc = xmpz(1)
        for _ in count_down(tetrate_acc):
            multiply_acc = xmpz(1)
            for _ in count_down(exponentiate_acc):
                add_acc = xmpz(0)
                for _ in count_down(multiply_acc):
                    for _ in range(a):
                        add_acc += 1
                multiply_acc = add_acc
            exponentiate_acc = multiply_acc
        return exponentiate_acc
And here is the final function in Rust: (I used `&mut` instead of returned values because I don't think Rust guarantees that returned owned values aren't copied.)

    fn tetrate(a: u32, acc: &mut BigUint) {
        assert!(a > 0, "we don’t define 0↑↑b");

        let mut exp = BigUint::from(1u32);
        for () in acc.count_down() {
            let mut mul = BigUint::from(1u32);
            for () in exp.count_down() {
                let mut add = BigUint::ZERO;
                for () in mul.count_down() {
                    for _ in 0..a {
                        add += 1u32;
                    }
                }
                mul = add;
            }
            exp = mul;
        }
        *acc = exp;
    }

comment 1y ago · link · parent

Yes, the article figures that with a limit of 64GB of memory, with simple nested loops, you could only loop about 10^(165 billion) steps.

To get 10^^15 steps, the article assumes "any amount of zero-initialized memory". (It calls that assumption "unrealistic but interesting".)

comment 1y ago · link · parent

Python version: https://towardsdatascience.com/how-to-optimize-your-python-p...

11.

How to Optimize Rust for Slowness: Inspired by New Turing Machine Results(medium.com ↗)

55 points · by carlkcarlk · 1y ago · 14 comments

comment 2y ago · link · parent

In school we learn to "solve" y = x² and get x = ±√y. But they never teach that (or why) you can't solve y = x −c sin(x) and get a nice equation. That's always bugged me. Instead of learning Galois theory, I cheated and used Python's free SymPy package to search for unsolvable equations.