Thinking in an array language (2022)
Summary
A comprehensive tutorial for ngn/k, an array programming language, with chapters, vocabulary, and exercises for learning.
View Cached Full Text
Cached at: 05/22/26, 09:26 PM
razetime/ngn-k-tutorial
Source: https://github.com/razetime/ngn-k-tutorial
ngn-k-tutorial
An ngn/k tutorial.
- Website: https://razetime.github.io/ngn-k-tutorial
- PDF: https://razetime.github.io/ngn-k-tutorial/ngn_k_tutorial.pdf
- EPUB: https://razetime.github.io/ngn-k-tutorial/ngn_k_tutorial.epub
How to use this tutorial
This tutorial assumes you have some beginner programming knowledge, and a basic understanding of what arrays are.
Most chapters will have Vocabulary and Exercise sections at the end. I suggest getting familiar with the vocabulary
and doing the exercises in each part before moving on the next lesson.
If you are feeling stuck with the tutorial’s content or exercises, please come to the ngn/k room on matrix (recommended), the APL farm, or just open an issue here.
If you would like to check your exercise solutions with mine, you can check the code folder.
Progress
This tutorial is complete, and will not see the addition of any further chapters, unless ngn/k undergoes new changes.
Any other chapter ideas that were previously here may be covered in separate articles, outside this book. No promises though :)
Credits
- ngn many tidbits and useful knowledge on the workings of ngn/k
- @chrispsn, @Traws, @ColTim for ideas on the Prelude chapter, and primitive implementations
- @HoosierEE for help with proofreading and many useful edits
- @DiscoDoug for a lot of help with writing the sudoku chapter
- /u/mandus for reminding me that I had exercises on this tutorial
- @DestyNova for setting up the workflows required for the website, epub and pdf.
- @yakubin for their help on correcting folds and scans
Finally, thanks to all the proofreaders who helped me ensure the quality of this book over the two years spent writing it.
Similar Articles
A principled rethinking of array languages like APL
The article proposes a principled rethinking of array languages like APL by modeling variables as functions of input dimensions, aiming to improve readability and error checking compared to traditional approaches.
Needed 1+1, built a functional programming language
The article describes how a developer built a functional programming language in C, starting from a data structures assignment to evaluate arithmetic expressions, and implementing features like closures, a garbage collector, and a REPL.
Show HN: Nibble
Nibble is a C-like systems programming language implemented in 3000 lines of C that generates LLVM IR without external dependencies or heap allocations. It supports defer, recursion, various types, structs, pointers, and includes graphical demos.
Spatial languages: writing code in 2D
The article explores the concept of writing code in two dimensions, using vertical chaining and 3-arity infix operators to simplify certain expressions, with practical examples like a chicken coop door controller.
An informal tutorial on Joy
A tutorial on the Joy programming language, a functional language based on composition of functions and combinators, using postfix notation and stack-based execution.