Author: lwall Date: 2009-04-10 21:26:13 +0200 (Fri, 10 Apr 2009) New Revision: 26182
Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: rename hash/pair reversal to "invert" Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-04-10 18:44:27 UTC (rev 26181) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-04-10 19:26:13 UTC (rev 26182) @@ -15,8 +15,8 @@ Moritz Lenz <mor...@faui2k3.org> Tim Nelson <wayl...@wayland.id.au> Date: 19 Feb 2009 extracted from S29-functions.pod - Last Modified: 8 Apr 2009 - Version: 4 + Last Modified: 10 Apr 2009 + Version: 5 The document is a draft. @@ -636,9 +636,9 @@ Returns a junction which will only match against another value if none of the keys in the hash matches. -=item reverse +=item invert - our List multi method reverse ( %hash: ) is export { + our List multi method invert ( %hash: ) is export { map -> $k, $v { $v X=> $k }, %hash.kv; } @@ -653,11 +653,11 @@ Like hash assignment insofar as it accepts either C<Pair> objects or alternating keys and values; however, unlike assignment, when a duplicate key is detected, coerces the colliding entry's value to an -array and pushes the Pair's value onto that array. Hence to reverse +array and pushes the Pair's value onto that array. Hence to invert a hash containing duplicate values without losing (associative) information, say: - %out.push(%in.reverse) + %out.push(%in.invert) Note that when reading the values of such a hash, you must not assume that all the elements are arrays, since the first instance of a key @@ -703,9 +703,9 @@ class Pair does Associative {...} -=item reverse +=item invert - our List multi method reverse ( $pair: ) is export { + our List multi method invert ( $pair: ) is export { $pair.value X=> $pair.key }