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.

Clojure's Transducers are as fundamental as function composition

92 pointsby ithayerover 10 years ago

6 comments

telover 10 years ago
What does &quot;as fundamental as function composition&quot; mean here? The article just appears to describe transducers. Transducers <i>compose</i> via (&quot;reverse&quot;) function composition, sure, but that just means that they <i>are</i> functions of a type... and considerably less fundamental than <i>functions</i> since they&#x27;re a specialization of that class of things.<p>They&#x27;re cool and all—I&#x27;ve characterized them (partially, perhaps) as CPS encoded flatmaps over lists and also as stateful left fold transformers, the latter of which being much more general—but they&#x27;re more like a rich ecosystem for list transformations than any kind of <i>fundamental</i> abstraction.
评论 #8248307 未加载
评论 #8248835 未加载
评论 #8248208 未加载
评论 #8249020 未加载
评论 #8248360 未加载
donsover 10 years ago
Title shows author doesn&#x27;t understand programming language design. No, a small set of higher-order functions[1] is not as fundamental as the concept of higher-order functions in the first place.<p>[1]: <a href="http://www.reddit.com/r/haskell/comments/2cv6l4/clojures_transducers_are_perverse_lenses/cjjgbbs?context=3" rel="nofollow">http:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;haskell&#x2F;comments&#x2F;2cv6l4&#x2F;clojures_tra...</a>
评论 #8249360 未加载
moominover 10 years ago
If you ignore the arities, ignore the internal state, and correctly observe the unwritten rules, yes transducers act like function composition. I looked into this here: <a href="http://www.colourcoding.net/blog/archive/2014/08/16/lets-write-a-transducer.aspx" rel="nofollow">http:&#x2F;&#x2F;www.colourcoding.net&#x2F;blog&#x2F;archive&#x2F;2014&#x2F;08&#x2F;16&#x2F;lets-wri...</a><p>I think Rich&#x27;s innovation here is extremely clever and quite subtle, but it&#x27;s pretty Clojure-specific, both in terms of the problem it solves and the way it solves it.
评论 #8247251 未加载
评论 #8248181 未加载
dschiptsovover 10 years ago
Subset of high-order functions are more fundamental than operations defined for a whole set?)<p>Clojure&#x27;s are more fundamental than other languages?
anon4over 10 years ago
What is the difference (or what is gained) from transducing a reducer over mapping (filtering, etc) a list and reducing it? Is it a clojure-specific optimisation?
评论 #8249733 未加载
rebcabinover 10 years ago
In addition to map transducers (which are 1-to-1) and filter transducers (which are many-to-1), flatMap transducers (which are 1-to-many) should be fundamental.
评论 #8249743 未加载