4 ms·
It's worth noting that this grammar is a bit more restrictive than the Perl 6 equivalent. In particular, "\d" in Perl includes not only 0 through 9, but any Un
by yellowapple 10y ago
It's worth noting that this grammar is a bit more restrictive than the Perl 6 equivalent. In particular, "\d" in Perl includes not only 0 through 9, but any Unicode character that's classified as a "digit". The Perl 6 grammar documentation features this in an example of using arbitrary methods in grammars: https://docs.perl6.org/language/grammars.html#Methods_in_Grammar https://docs.perl6.org/language/grammars.html#Methods_in_Gra...
- draegtun 10y agoI think the Perl 6 example should really use [0-9] instead of \d because it's unlikely that unicode numerals are allowed (in the Common Lisp spec). Anyway neither example fully covers the Common Lisp spec for a number atom (for eg. scientific notation or rationals).
- yellowapple 10y agoI don't think covering all of the Common Lisp spec is required to be Greenspun-compliant ;)
- draegtun 10y agoIn that case Rebol is already Greenspun-compliant ;-) (print (multiply (add 1 2) 3)) ... will print an answer of 9