Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 3.53 KB

File metadata and controls

39 lines (27 loc) · 3.53 KB

The Little Aligner

🌐 English · Japanese

In the tradition of "The Little Schemer."

This is not a reference and not a textbook — the guide is the textbook. This is a drill book: a long conversation of small questions and small answers, each one a half-step past the last. It teaches your hands the parts of Align that are unlike other languages — pipelines, match, Move, arenas, and turning data sideways into columns — until the idioms come out on their own.

It does not tour every syntax form or library module. It has succeeded when a problem you have not seen before makes you ask the Align questions on your own: What is the shape of the data? Is this a flow, a choice, or a control circle? Who owns it, how long does it live, which columns will the machine touch, and where is the cost written? The aim is not to leave you acquainted with Align. It is to make you an aligner.

How to use it

Read a question. Answer it out loud before reading the answer. If you were right, keep going; if you were wrong, back up a few questions — the answer was built there. When a program appears, you may run it (alignc run), but try to be the compiler first: most questions can be answered with nothing but the previous page.

Keeping align-repl open beside the book suits the drill rhythm: it starts empty, an answer is one line, and the program grows with you instead of becoming a new file per question. Predict the answer, type it, and compare. It compiles and runs natively rather than interpreting, so a wrong prediction is corrected by the real compiler; :list shows the program the chapter has built up so far, and :save turns it into a file when a drill grows into something you want to keep. See chapter 16 of the guide.

Some answers are one word. Some questions look identical to the one before — the difference is the lesson. And when a rule has earned it, it is carved into a Commandment.

After the first trip through the book, take one program you liked and read it again without running it. Predict its answer. Trace the data. Point to where every value dies. Count the passes, allocations, and copies. The final chapter teaches this second reading. Recognition makes a page feel familiar; recall makes the language yours.

The chapters

  1. Toys — values, bindings, and functions
  2. Do It Againmap
  3. Keep Somewhere and field projections
  4. Collapse It — reductions: sum, count, reduce, and friends
  5. Chains — whole pipelines, and why they cost one loop
  6. One of Many — sum types and match
  7. Maybe, or It FailedOption, Result, ?
  8. Whose Is It? — Copy, Move, arenas, and .clone()
  9. Turn It Sidewayssoa: data as columns
  10. Count Me by Namegroup_by, agg, dict_encode
  11. Do It Until — the loop expression, when a pipeline can't say it
  12. Do It Apart — Pure work, par_map, and structured tasks
  13. Four at a Time — explicit SIMD, vectors, and masks
  14. The Big Crunch — mmap, zero-copy pipelines, and putting it all together
  15. Read It Four Ways — answer, flow, lifetime, and work

Everything here runs with today's alignc. Bon appétit.