TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pure recursively defined sets without looping in Haskell

34 pointsby romesover 2 years ago

2 comments

trompover 2 years ago
The author has provided a type operator for sets (and other datatypes) that let&#x27;s one compute fixpoints of monotone operations like transitive closure on directed graphs with a minimum of effort. While the implementation uses unsafe primitives, the resulting interface is safe and pure. Quite impressive and hopepully something I can make use of in the future...<p>Btw, regarding the introductory example<p>&gt; fibs = 0 : 1 : zipWith (+) fibs (tail fibs)<p>I prefer the more straightforward<p><pre><code> fibs = f 0 1 where f a b = a : f b (a+b)</code></pre>
评论 #32768451 未加载
评论 #32768283 未加载
cryptonectorover 2 years ago
The title is wrong, should be `More recursive definitions`.<p>The title simply engages my pedantic self and makes me want to point out that tail recursion == looping and, really, that recursion is looping.
评论 #32768647 未加载
评论 #32767962 未加载