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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A Simply Arited Concatenative Language

80 点作者 jamesbowman超过 7 年前

9 条评论

etatoby超过 7 年前
&gt; <i>In our notation, it&#x27;s just drop dup (^2) + (^2) - abs. Simple, readable, beautiful.</i><p>Considering how the author is not presenting a language for stack manipulation, but for defining functions of fixed arity, I fail to see how that style is supposed to be simpler or more readable than the usual formulation, in the syntax of your choice, for example: fun x y z -&gt; x^2 + y^2 - abs y<p>&gt; <i>programming is finally liberated from von-Neumann style</i><p>No, it&#x27;s not.<p>Not until you show me how a sorting algorithm (say) written in that FP&#x2F;FL (J?)-inspired style is just as readable, but with less potential bugs.<p>Also, not until you show me how a complex algorithm written in that style can be more easily synthesized to a FPGA or some other non-von Neumann computing platform.<p>I will agree that &#x27;;&#x27; is a nice idea, but extraordinary claims require extraordinary evidence.<p>In particular, the article fails to explain what device is supposed to replace recursion or unbounded iteration, that allow Turing-completeness (and modern software as a consequence) to exist in the first place.
评论 #15578761 未加载
zokier超过 7 年前
I feel like the syntax could do with bit more explanation. For example in &quot;(* ) + (* )&quot; the use of parenthesis is not explained anywhere as far as I can tell. Also, shouldn&#x27;t it be &quot;(* ) `+` (* )&quot; instead if &quot;+&quot; is used as an infix function instead of postfix, i.e. so that the expression desugars into &quot;(* ) ; (* ) +&quot;
评论 #15577393 未加载
评论 #15577177 未加载
tom_mellior超过 7 年前
Since nobody else seems to care, I&#x27;ll just put this out here: &quot;arited&quot; is really rather weird. I would say &quot;aritied&quot; instead (pronounced &quot;ari-teed&quot;, not &quot;ari-tied&quot;).<p>Does anyone know of a parallel construction turning any word ending in &quot;-ity&quot; into a past participle?
评论 #15583113 未加载
Mathnerd314超过 7 年前
Author&#x27;s implementation in rust: <a href="https:&#x2F;&#x2F;github.com&#x2F;suhr&#x2F;esobsc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;suhr&#x2F;esobsc</a><p>The parser and AST have tests, which clear up some of the syntax confusion, but it doesn&#x27;t have the function definitions used in the last code example.
评论 #15577738 未加载
ghusbands超过 7 年前
The main invention here is being able to write a function as drop dup (^2) + (^2) - abs, meaning the same as fn(x,y,z)=&gt;( x * x + y * y - abs(y)).<p>But, it does not read at all naturally for a concatenative language. The first two atoms (drop, dup) work in the usual fashion (directly and immediately affecting the stack). Then, the (^2) is just a syntactic input for the + after it, which is now an infix operator, also consuming the (^2) after it. But these _still_ don&#x27;t yet affect the stack, as the - is also consuming atoms and it consumes the final abs. Then, the expression so built is run against the current stack. It gives the impression of elegance and flexibility by throwing away the very thing that makes concatenative languages what they are.<p>There are better solutions, like using a scratch space (like the return stack, given in another comment) or otherwise explicitly making given atoms input or output from&#x2F;to a non-default location.
astrobe_超过 7 年前
&lt;rant&gt;<p>The &quot;why concatenative programming matters&quot; example is a strawman to begin with. The correct solution in standard Forth is &quot;DUP &gt;R DUP * SWAP * + R&gt; ABS -&quot; not the rot3 garbage they exhibit (yes, I ignored the useless z parameter because it&#x27;s beyond the idiocy I can deal with).<p>Same goes for the (ab+cd) example, that simply writes &quot;* &gt;R * R&gt; +&quot;.<p>Two stacks, problem solved. Forth lets you use the return stack for a reason. If you&#x27;re a chicken, just provide a second user stack and hide the return stack. Problem solved.<p>But I guess that introducing and writing about the <i>powerful</i> (this word, really, should be treated as an intellectual smell) &quot;;&quot; operator is more fun. The only problem is that this operator actually doesn&#x27;t work on stacks but arrays. Oops.<p>But, hey, can have infix notation!<p>&lt;&#x2F;rant&gt;
评论 #15578712 未加载
评论 #15578807 未加载
drallison超过 7 年前
Posted 20 days or so ago but did not find many upvotes. My comments on the original post are still relevant:<p>-----<p>1 point by drallison 20 days ago [-]<p>Interesting but incomplete paper, apparently cited in from Redit although located on github.<p>Sadly, there is no information about who the author might be. One of the redit comments suggests that the author is gopher9.<p>The paper does cite as examples several of James Purdy&#x27;s lanugage experiments. He is evincarofactum@github.
评论 #15590840 未加载
xelxebar超过 7 年前
I only recently found out about J and had never heard about APL before. Is the dc (predecessor of the bc cli calculator) syntax in the same family here?
Chiba-City超过 7 年前
This is lovely. Its treatment of arity reads like an implicit pattern matching against tuples across the operators.