2min chapter

The Array Cast cover image

Fold and Scan

The Array Cast

CHAPTER

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.

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode