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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Introduction to Code Golf and Golflangs

2 点作者 thetrustworthy超过 2 年前

1 comment

082349872349872超过 2 年前
&gt; <i>operations that “naturally” take more than two parameters, that can’t be decomposed into reasonable two-parameter functions, are surprisingly rare. Simple examples include:<p><pre><code> String substitution: in string X, replace Y with Z. String padding: pad a string X to width at least Y with character Z. Dictionary update: given a dictionary D, set D[X] = Y.</code></pre> </i><p>The obvious solution here is to have a two-parameter function that serves as a product, combining two arguments into one (eg space-based stranding in APL-likes):<p><pre><code> (Y ⨂ Z) replace X (Y ⨂ Z) pad X D update X ⨂ Y</code></pre>