This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This: | |
say ('baz 42 k9 foo' ~~ m:g/ \d+ /).raku | |
prints this: | |
(Match.new(:orig("baz 42 k9 foo"), :from(4), :pos(6)), Match.new(:orig("baz 42 k9 foo"), :from(8), :pos(9))) | |
Is there some tool that exists to reformat strings like that to something like this?: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2025-02-27.Thu [Coke] shows this on IRC: | |
# | |
# If you take twin primes starting with 5, multiply them together, | |
# then add the digits together iteratively until you're left with a | |
# single digit... it's 8. | |
sub aa ($a) { | |
my $s = [+] $a.comb; | |
$s.comb.elems > 1 ?? aa($s) !! $s | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $orig-text = Q:to/EoT/ | |
My number is 4, and another 3.2 | |
and 8 again, and also 7 | |
6 and 0.9 | |
EoT | |
; | |
my @repl-nums = (6.5, 3, 5, 8.1, 2, 0); | |
my $want-text = Q:to/EoT/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm upgrading my Rakudo from moar-2023.02 to | |
moar-2024.04. I'm having problems obtaining the | |
IO::String distribution. raku.land proposes: | |
P6C: IO::String:ver<0.1.1> | |
ZEF: IO::String:ver<0.2.0>:auth<zef:jjmerelo> | |
Now, in a shell having moar-2024.04 active, please | |
observe: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```ansi | |
Resetting to normal color and style is done by inserting ``⟨esc⟩[0m``. | |
Basic colors, foreground and background (meh): | |
[0;30m 30 Black [0;40m 40 Black [0m | |
[0;31m 31 Red [0;41m 41 Red [0m | |
[0;32m 32 Green [0;42m 42 Green [0m | |
[0;33m 33 Yellow [0;43m 43 Yellow [0m | |
[0;34m 34 Blue [0;44m 44 Blue [0m | |
[0;35m 35 Magenta [0;45m 45 Magenta [0m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# 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'/; | |
} | |
# -------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ⦃▸ snipraku b rx14⦄ | |
snipraku.raku \ | |
/home/lucs/prj/t/raku/bin/snips.raku \ | |
/tmp/snips-raku \ | |
$* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
=begin pod | |
=head1 NAME | |
snipraku - Extract and run Raku snippets. | |
=head1 SYNOPSIS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin pod | |
⌊raku --doc=Markdown ⟨this file⟩⌉ produces | |
improper Markdown for the beginning here; | |
Indented | |
Baz | |
Indented | |
Foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want a LEAVE block to run after a sub has completed, | |
but only if some condition is True. | |
# -------------------------------------------------------------------- | |
# Start from this. | |
sub foo1 { | |
⋯ | |
LEAVE {⋯} | |
⋯ |
NewerOlder