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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The Weird and Wonderful Characters of Clojure

106 点作者 robgering大约 11 年前

8 条评论

eudox大约 11 年前
And here&#x27;s how to use Common Lisp reader macros to implement JSON literals: <a href="https://gist.github.com/chaitanyagupta/9324402" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;chaitanyagupta&#x2F;9324402</a>
emidln大约 11 年前
I&#x27;ve been using Clojure for awhile now and it has never previously occurred to me that you could do:<p><pre><code> #(foo %2) </code></pre> instead of<p><pre><code> (fn [_ arg2] (foo arg2)) </code></pre> Thanks!
评论 #7767764 未加载
评论 #7769043 未加载
Totient大约 11 年前
I don&#x27;t understand the difference between fn and fn* . After some brief experimenting in the REPL, they seem to behave exactly the same, the only difference being that fn* is what comes out of macro expanding the #( macro<p>Is there a reason that the #( macro doesn&#x27;t expand to plain old fn?
评论 #7768535 未加载
评论 #7768567 未加载
programnature大约 11 年前
The characters are hard to google, but I&#x27;ve found them sufficiently documented here: <a href="http://clojure.org/reader" rel="nofollow">http:&#x2F;&#x2F;clojure.org&#x2F;reader</a>
kivikakk大约 11 年前
It seems disingenuous to describe &quot;;&quot; as a &quot;comment macro&quot;. It&#x27;s not a macro, it just causes the reader to ignore characters until EOF, \r, or \n. (<a href="https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L505" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;clojure&#x2F;blob&#x2F;master&#x2F;src&#x2F;jvm&#x2F;cloju...</a>)<p>The fact that the CommentReader is dispatched from a table called &quot;macros&quot; (<a href="https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L84" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;clojure&#x2F;blob&#x2F;master&#x2F;src&#x2F;jvm&#x2F;cloju...</a>) means nothing, unless you also call string literals &quot;string macros&quot;, s-expressions &quot;s-exp macros&quot;, etc., since mostly everything is dispatched from that table.
moomin大约 11 年前
Fun article. Should also add in #anything, and discover the weird and wonderful world of the extensible reader.
评论 #7767696 未加载
BostX大约 11 年前
A big Thanx for this!
jcromartie大约 11 年前
Does the author mean &quot;character&quot; in a literary sense? Because many of these things have better names, and in fact &quot;character&quot; is wholly incorrect for anything like &quot;#_&quot; or &quot;#&#x27;&quot; which consist of multiple characters.<p>Also, functions are <i>not</i> methods, and the terms are <i>not</i> interchangeable.<p>All of this is summarized in a much more succinct and correct fashion here: <a href="http://clojure.org/reader" rel="nofollow">http:&#x2F;&#x2F;clojure.org&#x2F;reader</a>
评论 #7768155 未加载
评论 #7768183 未加载