Better HN
topnewbestaskshowjobs
Log inSign up

stellartux

14 karma · joined Jun 17, 2021 (5y ago) · 9 submissions

Submissions

comment 6mo ago · link · parent

If this is your article, you have a typo in learns_priority/3, "move_priority #> 0" should be "P #> 0".

comment 11mo ago · link · parent

Sounds a bit like Clojure's "recur". https://clojuredocs.org/clojure.core/recur

comment 1y ago · link · parent

Hung explicitly refers to every usage of the word but a hanging. Meat is hung, people are hanged.

comment 3y ago · link · parent

This seems to work.

table:has(> tbody > tr > td > div > span > a[href="user?id=USERNAME"])

comment 4y ago · link · parent

TwilioQuest is quite good. It teaches JavaScript and Python, including setting up the runtimes and some basic git stuff.

https://www.twilio.com/quest

comment 4y ago · link · parent

There are few easier ways built in to do some of the file functions you've made, instead of `open(f -> read(f, String), "input")` you can use `readchomp("input")`. There's also `readlines` which is equivalent to `open(f -> read(f, String), "input") |> f -> split(f, "\n")`, and `eachline` which is like `readlines` but returns a generator instead of an array.

There are curried forms of the operators that might make it easier to write functional code, like instead of `x -> x == "0"` you can write `==("0")`. Another useful thing is you can broadcast pipes, so instead of `x |> xs -> f.(xs)` or `x |> Map(f)`, you can write `x .|> f`.

It's funny that the first section is about everything loading as a matrix and not knowing the easy way to load things as a vector, I had the opposite problem and every problem that has a matrix I've ended up making a giant vector then reparsing the first line to figure out what dimensions to reshape it to. I'll have to try `readdlm`, I'm currently working through the older AoC years in Julia.

comment 5y ago · link · parent

I made a synth a few years back that lets you use a bytebeat formula as a signal generator. The `t` variable which represents the 8kHz sample rate of the audio in a typical bytebeat is instead proportional to the frequency of the pitch of the pressed key. There is also a `tt` variable, "tempo time", where the sample rate is proportional to a global tempo, making it easy to make beatsynced rhythms. The bytebeat itself can be written in either JavaScript, WebAssembly Text format, or a little stack based language that can be written in either RPN or S-expressions, which compiles to Wasm and is basically a thin wrapper around the Wasm semantics, which is why it doesn't include the DUP and SWAP commands from the original Glitch machine. It works with WebMIDI too, so you can hook up a keyboard to it.

It's here if anyone wants to play about with it. https://stellartux.github.io/websynth/

comment 5y ago · link · parent

Oh yeah, you're right, they've been added since I last looked into it. Nice!

comment 5y ago · link · parent

Most of the Web Audio stuff has already been present in all major browsers for a little while, this mostly standardises what's already there. The main thing that this brings in that up until now was just a feature of Chrome is the AudioWorklet, so real-time low-level audio processing in JS worklets will work cross-browser when its implemented in the other browsers. It's very difficult to implement low-level audio processing off of the main thread in non-Chromium browsers at the moment.