Skip to content

Instantly share code, notes, and snippets.

@lucs
Created September 9, 2023 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucs/1df6ca5baae45230ee38d476168dc933 to your computer and use it in GitHub Desktop.
Save lucs/1df6ca5baae45230ee38d476168dc933 to your computer and use it in GitHub Desktop.
Example snippets to use with snipraku.raku
# --------------------------------------------------------------------
# ID: misc79 unicode
for ^2**20 -> $u {
my $c = chr $u;
my $n = uniname $c;
printf "$c U-%X %s\n", $u, $n if $n ~~ /'SNOW'/;
}
# --------------------------------------------------------------------
# ID: rx36
sub eg ($str) {
say $str;
for $str.comb: / <-[",]>+ | \" ~ \" <-["]>+ / -> $f {
say " $f";
}
}
eg 「a,"1,725.34",b」;
=finish
Prints:
a,"1,725.34",b
a
"1,725.34"
b
# --------------------------------------------------------------------
# ID: x1 Omit parentheses to call a function.
sub foo { say "FOO" }
# s() same as foo();
my &s = &foo;
s;
# Anonymous sub stored in variable, and used as a sub.
my &s2 = sub { say "s2" }
s2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment