Perl 6可以基于归类进行排序或比较吗? [英] Can Perl 6 sort or compare based on collations?

查看:40
本文介绍了Perl 6可以基于归类进行排序或比较吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cmp 运算符可以在代码编号上工作,或者至少这是我认为的功能,因为文档对此没有明确规定,也没有提及任何本地化内容。

The cmp operator works on code numbers, or at least that's what I think it does because the docs aren't explicit on that and don't mention any localization stuff.

我可以按其他归类排序?我知道我告诉 sort 如何进行比较,但我认为它必须已经存在(某处) 。

Can I make it sort by other collations? I know I tell sort how to compare, but I figure it must be in there already (somewhere).

推荐答案

整理功能可以作为实验功能

my @list = <a ö ä Ä o ø>;
say @list.sort;                     # (a o Ä ä ö ø)

use experimental :collation;
say @list.collate;                  # (a ä Ä o ö ø)
$*COLLATION.set(:tertiary(False));
say @list.collate;                  # (a Ä ä o ö ø)

请提供有关此功能的反馈以帮助其退出实验状态,并包含在v6.d中。

Please give feedback on this feature to help it move out of the "experimental" state and be included in v6.d.

这篇关于Perl 6可以基于归类进行排序或比较吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆