Skip to content

Commit

Permalink
Implement univals() and Str.unival(s)
Browse files Browse the repository at this point in the history
According to S15:490 and following, without the Unicodey role though.
  • Loading branch information
lizmat committed Mar 30, 2014
1 parent d381df4 commit ee7dbc1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/Str.pm
Expand Up @@ -1022,6 +1022,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
method path(Str:D:) returns IO::Path:D {
IO::Path.new(self)
}

method unival(Str:D:) { unival(self.ord) };
method univals(Str:D:) { univals(self) };
}


Expand Down Expand Up @@ -1198,13 +1201,15 @@ multi uniname(|) { die 'uniname NYI on parrot backend' }
multi uniprop(|) { die 'uniprop NYI on parrot backend' }
multi unibool(|) { die 'unibool NYI on parrot backend' }
multi unival(|) { die 'unival NYI on parrot backend' }
multi univals(|) { die 'univals NYI on parrot backend' }
multi unimatch(|) { die 'unimatch NYI on parrot backend' }
#?endif
#?if jvm
multi uniname(|) { die 'uniname NYI on jvm backend' }
multi uniprop(|) { die 'uniprop NYI on jvm backend' }
multi unibool(|) { die 'unibool NYI on jvm backend' }
multi unival(|) { die 'unival NYI on jvm backend' }
multi univals(|) { die 'univals NYI on jvm backend' }
multi unimatch(|) { die 'unimatch NYI on jvm backend' }
#?endif
#?if moar
Expand Down Expand Up @@ -1263,6 +1268,9 @@ multi unival(Int $code) {
!$de || $de eq '1' ?? $nu.Int !! $nu / $de;
}

proto univals(|) {*}
multi univals(Str $str) { $str.ords.map: { unival($_) } }

proto unimatch(|) {*}
multi unimatch(Str $str, |c) { unimatch($str.ord, |c) }
multi unimatch(Int $code, Stringy $pvalname, Stringy $propname = $pvalname) {
Expand Down

0 comments on commit ee7dbc1

Please sign in to comment.