WeSearch

Why Not Tail Recursion?

·5 min read · 0 reactions · 0 comments · 17 views
#programming#functional programming#futhark#recursion#Futhark#Troels Henriksen#Scheme#Haskell
⚡ TL;DR · AI summary

The article discusses the limitations of recursion in the Futhark programming language. Futhark does not support recursive functions due to its focus on generating efficient code for GPUs. Instead, it offers a looping construct that mimics tail recursion without using stack space.

Key facts
Original article
Futhark-lang
Read full at Futhark-lang →
Opening excerpt (first ~120 words) tap to expand

Why not tail recursion? Posted on January 20, 2026 by Troels Henriksen This post was inspired by this discussion on /r/ProgrammingLanguages. Futhark is unusual among functional programming languages in not allowing functions to be recursive. This is to some extent justified by Futhark being a parallel language, and recursive looping being an intrinsically sequential operation, and therefore less crucial. However, most nontrivial parallel algorithms still involve some amount of sequential looping, and so this capability cannot be left out entirely. The reason Futhark still does not allow recursive functions is due to our goal of generating code for restricted targets, most notably GPUs, where recursion is at best inefficient and often impossible, due to restrictions on stack usage.

Excerpt limited to ~120 words for fair-use compliance. The full article is at Futhark-lang.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from Futhark-lang