The Twin Algorithms
summary
Argues that several STL numerics (iota, accumulate, partial_sum, inner_product) descend from APL and that twin algorithms — scans and reductions — are visually and semantically paired, a fact revealed quickly on tryapl.org. Demonstrates an APL not-equal scan to strip HTML tags, then translates it into C++20/23 ranges (views, zip_transform, partial_sum later in C++26), showing the C++ version works but needs temporaries and verbose plumbing. Shows outer product to count LRUD moves, cites kx sale (~$100M for a 50KB k binary) and the three-reverse rotate implementation (Doug McIlroy).
AI-written summary · about
chapters (7)
- 0:00Introduction and motivation
- 16:51Connections between C++ and APL
- 43:37Reduce and scan algorithms
- 54:26Filtering HTML tags with scan
- 1:09:53Outer product in C++ and APL
- 1:23:29Rotate and reverse symmetry
- 1:31:48Summary and call to learn languages
related talks
01h 01mAlgorithm Intuition (part 2 of 2)
01h 01mAlgorithm Intuition (part 1 of 2)
57mRange Algorithms, Views and Actions: A Comprehensive Guide
46mC++ Fundamentals - Algorithms
01h 04mBetter Code: Data Structures
05mC++ Sequential Considered Harmful
04mEuclid's Algorithm & STL
01h 23mAlex Stepanov, Generic Programming in Cpp, and the STL
