On Fri, 18 Mar 2005 00:20:57 -0500, Uri Guttman <[EMAIL PROTECTED]> wrote:
> >>>>> "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
> 
>   LW> oct and hex are arguably misnamed, since most functions are named by
>   LW> what they produce, not by what they take as input.  I don't know what
>   LW> the replacement should be, though.  Maybe it's not worth fixing.
> 
> from_oct, from_hex which state what they do? or a more general
> from_base( 16, $hex )? and that could be curried into from_hex().

Isn't that actually part of the Standard Perl6 Rule Library?

class Perl6::Rules {
our @HexDigits = 0..9, 'a'..'f';
our @OctDigits = 0..7;
our @DecimalDigits = 0..9;
rule ParseNumber(@digits) returns Int
{ :i [0x]? [$digit := <@digits> { $0 *= @digits.elems; $0 +=
@digits.indexof($digit) }]+ }
&ParseHex := &ParseNumber.assuming :digits(@HexDigits);
}

with &*hex being some sort of alias to Perl6::Rules::ParseHex?

Umm... can you call a rule as a function?

rule foo { .* }

$x = foo("I am the very model of a modern irregular expression");

Or do I not want to know the answer to that?

Ashley Winters

Reply via email to