TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Understanding Clojure Transducers Through Types

73 点作者 jkkramer将近 11 年前

4 条评论

rrradical将近 11 年前
There are some interesting comments at the bottom from Rich Hickey.
gipp将近 11 年前
<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 未加载
kvb将近 11 年前
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 未加载
pron将近 11 年前
&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 未加载