No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add README Jun 13, 2018
t Add README Jun 13, 2018
.gitignore Initial Commit Jun 12, 2018
.travis.yml Initial Commit Jun 12, 2018
Changes Initial Commit Jun 12, 2018
LICENSE Initial Commit Jun 12, 2018
META6.json Include a source url Jun 12, 2018
README.md Add README Jun 13, 2018
dist.ini Initial Commit Jun 12, 2018

README.md

NAME

OrderedHash - A hash that you specify the possible keys and theirs order

SYNOPSIS

use OrderedHash;

my %oh1 does OrderedHash = b => 2, c => 3, a => 1;

say %oh1.keys;                                      # (a b c)
say %oh1.values;                                    # (1 2 3)
say %oh1.kv;                                        # (a 1 b 2 c 3)
say %oh1.pairs;                                     # (a => 1 b => 2 c => 3)

my %oh2 does OrderedHash[Int] = b => 2, a => 1;

say %oh2.keys;                                      # (a b)
say %oh2.values;                                    # (1 2)
say %oh2.kv;                                        # (a 1 b 2)
say %oh2.pairs;                                     # (a => 1 b => 2)

%oh2<c> = 3;
say %oh2;                                           # {a => 1, b => 2, c => 3}

# %oh2<d> = "error";                                # dies

my %oh3 does OrderedHash[:keys<c b a>] = b => 2, c => 1, a => 3;

say %oh3.keys;                                      # (c b a)
say %oh3.values;                                    # (1 2 3)
say %oh3.kv;                                        # (c 1 b 2 a 3)
say %oh3.pairs;                                     # (c => 1 b => 2 a => 3)

my %oh4 does OrderedHash[Str, :keys<c b a>] = b => "b", c => "a", a => "c";

say %oh4.keys;                                      # (c b a)
say %oh4.values;                                    # (a b c)
say %oh4.kv;                                        # (c a b b a c)
say %oh4.pairs;                                     # (c => a b => b a => c)

DESCRIPTION

OrderedHash is ...

AUTHOR

Fernando Correa de Oliveira fernandocorrea@gmail.com

COPYRIGHT AND LICENSE

Copyright 2018 Fernando Correa de Oliveira

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.