/
Number.pm6
32 lines (27 loc) · 1017 Bytes
/
Number.pm6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use v6.c;
use XML::XPath::Types;
use XML::XPath::Utils;
role XML::XPath::FunctionCall::Number {
method !fn-floor(ResultType $set, Int $index, Int $of) {
die 'functioncall floor() requires no parameter' unless @.args.elems == 1;
my $converter = sub ($r){
$r.floor
};
self!help-one-arg($set, $index, $of, $converter);
}
method !fn-ceiling(ResultType $set, Int $index, Int $of) {
die 'functioncall ceiling() requires no parameter' unless @.args.elems == 1;
my $converter = sub ($r){
say "r = $r ceiling -> ", $r.ceiling, " ", $r.perl, " what:", $r.WHAT;
$r.ceiling;
};
self!help-one-arg($set, $index, $of, $converter);
}
method !fn-round(ResultType $set, Int $index, Int $of) {
die 'functioncall round() requires no parameter' unless @.args.elems == 1;
my $converter = sub ($r){
$r.round;
};
self!help-one-arg($set, $index, $of, $converter);
}
}