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.

Understanding Clojure Transducers Through Types

73 pointsby jkkrameralmost 11 years ago

4 comments

rrradicalalmost 11 years ago
There are some interesting comments at the bottom from Rich Hickey.
gippalmost 11 years ago
<p><pre><code> trans :: (b -&gt; a) -&gt; (c -&gt; a -&gt; c) -&gt; c -&gt; b -&gt; c </code></pre> in Haskell is just<p><pre><code> trans f reduce c = reduce c . f </code></pre> isn&#x27;t it? What am I missing here?
评论 #8154453 未加载
评论 #8154905 未加载
kvbalmost 11 years ago
Seems like parametricity ensures that<p><pre><code> Transducer a b </code></pre> is isomorphic to<p><pre><code> b -&gt; [a] </code></pre> Am I missing something?
评论 #8160410 未加载
评论 #8160408 未加载
pronalmost 11 years ago
&gt; ...a level of abstraction that I think has not been expressed much in the world of dynamically typed languages, although the techniques are two decades old in the Haskell community in a statically typed setting<p>Calling Clojure &quot;dynamically typed&quot; in this context (or any context), is confusing, as it is more of a mashup of a few ideas from functional and OO languages than a typical dynamically typed language. For example, Clojure does not have dynamic dispatch (except for multimethods, which are a limited form of dynamic dispatch) other than that offered by OO polymorphism (interfaces&#x2F;protocols). In other words, it lacks the most important mechanism that lends dynamically typed languages like JavaScript and Ruby their power.<p>It is a language that, like Java&#x2F;C#&#x2F;Go, is based on interfaces, which are then mixed with some functional concepts. Unlike the aforementioned OO languages, Clojure usually uses only a handful of such abstractions (or interfaces; or protocols). So, while the translation to Haskell requires such concepts as type classes and higher-rank types, this has nothing to do with dynamic typing, and a lot to do with plain old OO polymorphism.
评论 #8154100 未加载
评论 #8154626 未加载
评论 #8154523 未加载
评论 #8154911 未加载
评论 #8154763 未加载