在 APL 中,如何从给定的整数集中计算最小的未使用正整数?

发布于 2024-08-04 08:31:22 字数 34 浏览 6 评论 0原文

例如,给定 1 8 4 9 0 2 ,返回 3。谢谢。

For example, given 1 8 4 9 0 2 , return 3. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

椵侞 2024-08-11 08:31:22
  {⍬⍴(⍳1+⍴⍵)~⍵} 1 8 4 9 0 2

3

  {⍬⍴(⍳1+⍴⍵)~⍵} 1 8 4 9 0 2

3

美男兮 2024-08-11 08:31:22

尝试

((⍳⍴n)∊n)⍳0

((iota rho n) element n) iota 0

这或多或少是选择下一个可用文件关系号的标准习惯用法。

Try

((⍳⍴n)∊n)⍳0

or

((iota rho n) element n) iota 0

This is more or less the standard idiom for choosing the next available file tie number.

子栖 2024-08-11 08:31:22

全部使用的情况似乎有“一加最大”作为答案,但是否“来自”列表则是另一个问题。

@Paul,您使用 APL385 作为浏览器的字体吗?这似乎已经澄清了很多事情。

The case where they are all used seems to have "one plus the largest" as the answer, but whether that is "from" the list is another question.

@Paul, are you using APL385 as your browser's font? That seems to have cleared up many things from this end.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文