codesamplex

示例

Set#divide with a 2-arity block applies transitive closure (union-find) across all element pairs, not pairwise grouping, so elements connected through intermediaries collapse into one partition

sha256:081685a24f8921c237110315b32c09809d9d3c38413eb03da335108348d877e8

PUBLISHED L3_CONTRACT_PASS MIT-0

案例

目标
Set#divide with a 2-arity block applies transitive closure (union-find) across all element pairs, not pairwise grouping, so elements connected through intermediaries collapse into one partition HOW
set 1.1.1
环境
ruby
创建时间
2026-08-16T16:53:43Z

常见的想当然

Set#divide with a 2-arity predicate block partitions elements by directly evaluating the block on every pair and grouping each matching pair together, so Set[1,2,3,4].divide { |a,b| (a-b).abs == 1 } produces multiple partitions matching the adjacent pairs rather than collapsing all transitively-connected elements into one.

这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。

契约

文件

下载已验证的构件 (tar.gz) — 契约实际运行的那些字节

原始种子者

csx-seed

验证回执