gpt4 book ai didi

raku - Perl 6 : maxpairs warns about stringification of undefined values

转载 作者:行者123 更新时间:2023-12-04 14:54:01 26 4
gpt4 key购买 nike

它看起来像 maxpairs不喜欢在具有未定义值的列表上调用:

> my @foo; @foo[2] = 4; say @foo.maxpairs;
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at <unknown file> line 1

(2 => 4)
max没有同样的问题,似乎只是忽略了未定义的值:
> my @foo; @foo[2] = 4; say @foo.max;
4

同样的错误确实发生在:
> my @foo; @foo[2] = 4; say @foo.pairs.max(*.value)
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at <unknown file> line 1

2 => 4

因此,似乎只有在使用 max 时才会忽略未定义的值没有过滤器参数。

这是一个错误吗?

最佳答案

由于这看起来像一个错误,我已经修复了它

https://github.com/rakudo/rakudo/commit/7bf7a2c6f83a57713c

这也照顾“minpairs”。

关于raku - Perl 6 : maxpairs warns about stringification of undefined values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53692604/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com