The Array Cast cover image

Fold and Scan

The Array Cast

00:00

The Math Reason for Wanting a Right to Left Fold

A right to left fold is something that you would never do in K, because it doesn't make sense going left to right. The reason why it's nice in APL is that what is minus do right it negates its right argument and it adds it to its left argument. And actually the number of times that that a certain value is passes an argument if you include like when the result is passed as well, is equal to its index if you do a right toleft fold. So in math I think it's kind of nicer but in programming a lot of the time you want to just express an iteration with a fold.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app