lizmat
Joined 8 years ago
Joined 8 years ago
say 42 ≤ 666; # True
say 42 ≠ 666; # True
say 42 ≥ 666; # False
For a full list, see https://docs.raku.org/language/unicode_ascii#Other_acceptabl...
Perl to Raku guide - operators: https://docs.raku.org/language/perl-op
Perl to Raku guide - functions: https://docs.raku.org/language/perl-func
raku -e 'say "etbjxntqrdke".comb.map(*.succ).join'
Fixed in Raku. You either have a string (Str) or a bytestream (Blob).
* Wherever there's strings in any non-trivially-sized real-word Perl 5 project, there is utter irreversible and irredeemable mojibake.
No mojibake in Raku.
* No canonical way to do object-orientation. (cf. blessed objects, Moo in different versions, and different conventions around how to use them) -- This stuff should be easy in 2026. Perl makes this easy thing really hard.
Raku has single object / type system.
* Regexes suck. Their brevity is a nice circus stunt for a computer science audience, but unless you follow very particular patterns for composing them from ergonomically named constants, etc. etc. (which "in the wild" I rarely see), they are very unergonomic.
Raku regexes allow arbitrary whitespace, can contain comments and are composable.
Grammars are collections of tokens / rules / regexes that can be used to build an AST, and actions that can take that AST and build another data structure of it. A grammar is used to parse Raku itself.
Grammars can be subclassed or have rules / regexes mixed in (slangs).
* The Perl 5/CPAN ecosystem has been left to rot and is no longer safe for consumption.
The Raku ecosystem, albeit much smaller, is growing and actively maintained: https://raku.land
$ raku -e 'say Q|say "Hello World!"|.AST'
RakuAST::StatementList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Call::Name::WithoutParentheses.new(
name => RakuAST::Name.from-identifier("say"),
args => RakuAST::ArgList.new(
RakuAST::QuotedString.new(
segments => (
RakuAST::StrLiteral.new("Hello World!"),
)
)
)
)
)
)$ raku -e 'say (0, 1, 2, * × * ... )[^10]' # for readability (0 1 2 2 4 8 32 256 8192 2097152)
$ raku -e 'say (0, 1, 2, * * ... *)[^10]' # for typeability (0 1 2 2 4 8 32 256 8192 2097152)