Rust + Machine Learning: 014

nonsensetwice
{nonsensecodes}
Published in
2 min readNov 3, 2023

--

This is part of my participation in the #100DaysOfCode challenge. This round, I’m learning Rust and Machine Learning (ML) and developing violette: a portable ML system and JavaScript API in Rust.

I’ve been so wrapped up in learning probability — really, just pursuing a greater education in the mathematics underlying Machine Learning (ML) — that I just about forgot that learning Rust was also on the table for this round of #100DaysOfCode. So for 014, I returned to the Rust Programming Language and worked my way through chapter 4: ownership.

The concept of ownership, as it is applied in Rust, seems pretty straightforward. A particular scope can have ownership of a given variable, and that ownership can be moved to other scopes, and returned to prior scopes, even if the change in scope lies within the same function but begins a few lines further down.

I annotate everything: PDFs, ebooks, paper books, magazines, and bathroom stalls with your mom’s phone number.

I’m under the impression that the creators of Rust came from a low level language — like some C language — moved to writing JavaScript (JS), said “What the fuck is this shit,” and journeyed forth to create a programming language that would be no where near as … quirky as JS. They wanted something that could be as powerful and capable as JS but that would also serve as a strong foundational software-building language.

I don’t know, I’m just shooting from the hip and I’m probably wrong. But damn, the rails built into Rust to constrain writing and manage data flow is intense. At least for someone (me) coming from good ol’ vanilla JS.

Still, this is a lot of fun to learn. I’m throwing all kinds of errors and discovering compilation constraints that aren’t explicitly expressed in the text, such as declaring unused variables. The code examples have all kinds of that shit and when I execute cargo run, I’m yelled at by the Rust compiler.

Just so much fun.

I don’t know how far into the chapter I am. I’m not looking ahead, I’m just plodding along.

014/100

Read day 013 here.

--

--

nonsensetwice
{nonsensecodes}

Reading & Writing. Music & Movement. Coffee & Code. Chaotic Great.