Skip to content

[Track] Add Rust implementations across the curriculum #168

Description

Motivation

The README lists Python, TypeScript, Rust, and Julia as the four languages.
A scan of catalog.json shows the actual coverage today:

Language Lessons Coverage
Python 427 98.2%
Julia 4 0.9% (Phase 1 only)
TypeScript 2 0.5% (Phase 16 only)
Rust 1 0.2% (Phase 10 L01 bpe.rs)

I'd like to open a long-running track adding Rust implementations to lessons where Rust is a natural fit — pure algorithms, from-scratch math, byte-level work, inference internals. The existing phases/10-llms-from-scratch/01-tokenizers/code/bpe.rs already sets a clean precedent (single file, stdlib-only, lives alongside the Python version), and I'll follow that convention.

Approach

  • One PR per lesson — keeps reviews fast (per CONTRIBUTING.md).
  • Single .rs file in the lesson's existing code/ directory, no Cargo.toml.
  • Mirrors the Python's structure and printed output so readers can diff the two.
  • README Lang column updated to Python, Rust in the same PR; node site/build.js run.

First batch (proposed order)

  1. Phase 2 L02 linear-regression-from-scratch — pure stdlib math, classic starter
  2. Phase 2 L03 logistic-regression-classification
  3. Phase 3 L01 the-perceptron
  4. Phase 3 L03 backpropagation-from-scratch
  5. Phase 7 L02 self-attention-from-scratch

Happy to reorder if there are phases you'd rather see covered first.

Out of scope (for now)

  • Lessons that depend on heavy framework parity (PyTorch/JAX internals).
  • Lessons whose Python uses regex with lookarounds (e.g. Phase 10 L02) — Rust's regex crate doesn't support these without an external dep. I'll revisit those after the no-deps baseline is established.

First PR coming shortly against Phase 2 L02. Will link it here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions