Created
January 13, 2017 04:22
-
-
Save samcv/9555fb141eca8f0da718fd6e26a0620f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $folder = "UNIDATA"; | |
#my $names = slurp "$folder/NameAliases.txt"; | |
my %points; | |
# NameAliases.txt | |
# 0 Codepoint (Hex) | |
# 1 NameAlias | |
# 2 NameAlias type | |
# sub path($cp, +@a) { say "\@.perl: @a.perl()"; @a.reduce({ $^a{$^b}:exists ?? $^a{$^b} !! $^a{$^b} = {} }) }; | |
sub read-file ( $property, $file ) { | |
my $file-txt = slurp "$folder/$file.txt"; | |
for $file-txt.lines { | |
next if .starts-with('#') or .match(/^\s*$/); | |
my @parts = .split(';'); | |
my %hash; | |
%hash{@parts[0]}{$property}{@parts[1]}<type> = @parts[2]; | |
apply-to-cp(%hash) | |
} | |
} | |
read-file("NameAlias", "NameAliases" ); | |
sub apply-to-cp ($hashy) { | |
for $hashy.kv -> $key, $value { | |
my $cp = $key.parse-base(16); | |
say $hashy if $cp == 0; | |
%points{$cp} = $value; | |
} | |
} | |
say %points{0}.perl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment