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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Elixir/Unix style pipe operations in Ruby

5 点作者 bonquesha99超过 6 年前

1 comment

pmontra超过 6 年前
I quote one of the examples<p><pre><code> &quot;https:&#x2F;&#x2F;api.github.com&#x2F;repos&#x2F;ruby&#x2F;ruby&quot;.pipe do URI.parse Net::HTTP.get JSON.parse.fetch(&quot;stargazers_count&quot;) yield_self { |n| &quot;Ruby has #{n} stars&quot; } Kernel.puts end #=&gt; Ruby has 15115 stars </code></pre> Not having to type the |&gt; like in Elixir is two shift keys less, which is good. I&#x27;m not sure about readability, because one has to spot the .pipe at the beginning of the block, but it shouldn&#x27;t be a problem.<p>Now, if we only had pattern matching with the exact syntax of Elixir and not some monstrosity I saw around in proposals and other languages...
评论 #18656217 未加载