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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A Default Identity Value for Programming

2 点作者 farginay超过 11 年前

2 条评论

npryce超过 11 年前
J has a similar feature: when applied to an empty array, &#x2F;+ returns 0 and &#x2F;* returns 1.<p>J doesn&#x27;t have user-defined types. In a language with user-defined types, you would probably have to declare which operations are monoids.
dvberkel超过 11 年前
I would concur with npryce. I your structure would adhere to the monoid interface and the default value could be cast automatically to the corresponding identity this will work. It wouldn&#x27;t even break mathematics