🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:35 jpn joined 00:40 jpn left 01:08 consteval is now known as smol-hors 01:21 Manifest0 left 01:31 jpn joined 01:36 jpn left 01:57 jpn joined 02:03 jpn left 02:20 hulk joined, kylese left 02:28 smol-hors is now known as ponycat 02:58 jpn joined 03:03 jpn left 03:15 hulk left, kylese joined 03:53 jpn joined 03:57 jpn left 04:07 haxxelotto joined 04:09 haxxelotto left 04:10 haxxelotto joined 04:20 teatwo left 04:47 jpn joined 04:52 jpn left 05:43 jpn joined 05:48 jpn left 06:01 jpn joined 06:06 jpn left 06:26 Sevalecan left 06:27 Sevalecan joined 06:57 jpn joined 07:07 jpn left 07:09 jpn joined 07:20 jpn left 07:29 merp left, jpn joined 07:34 merp joined 07:48 haxxelotto left 08:00 Sgeo left 08:12 abraxxa joined 08:28 haxxelotto joined 08:32 Manifest0 joined 08:51 nine left, nine joined 09:01 haxxelotto left 09:02 haxxelotto joined 09:08 dakkar joined 09:13 sena_kun joined 09:36 ponycat left 09:37 ponycat joined 09:56 sena_kun left 10:40 wafflus joined 10:46 ptc joined, ptc left 11:15 Manifest joined 11:17 hulk joined 11:18 kylese left, wafflus left, Manifest0 left 11:32 bdju left 11:34 bdju joined 11:36 jpn left 11:38 jpn joined 12:16 Tigerpaws joined 12:22 Tigerpaws left 12:24 Tigerpaws joined 12:44 tadzik left 12:52 melezhik joined
melezhik . 12:52
12:55 tadzik joined 12:56 melezhik left 12:57 jpn left 13:02 abraxxa left 13:03 xinming left, xinming joined 13:07 bdju left 13:09 bdju joined 13:11 Tigerpaws left 13:13 Tigerpaws joined
tbrowder hi, i'm using $string.split(/some regex/, :k) on a long string. that works. 13:34
m: my @s = "1abc2abc3abc".split(/\d/, :k); say $_.Str for @s; 13:36
camelia
0
abc
0
abc
0
abc
13:39 jpn joined
tbrowder hm, i meant to use :v but i see @s puts out two strings for each match. docs don't really explain that, nor does it have a good example of such. 13:39
my use case is extracting text from pdfs. 13:40
and the best way to iterate over the "pairs" is? 13:41
Voldenet iirc .split(//, :v) returns Seq 13:44
and it looks iterable 13:45
13:45 jpn left 13:48 Manifest is now known as Manifest0 13:50 haxxelotto left, haxxelotto joined 13:51 jpn joined 13:57 jpn left
Voldenet m: for "1abc2def3ghi".split(/\d/, :v).batch(2) -> $pair { $pair.say }; 14:04
camelia ( ï½¢1ï½£)
(abc ï½¢2ï½£)
(def ï½¢3ï½£)
(ghi)
Voldenet consider this
or
14:04 haxxelotto left
Voldenet m: for "1abc2def3ghi".split(/\d/, :v :skip-empty).batch(2) -> $pair { $pair.say }; 14:04
camelia (ï½¢1ï½£ abc)
(ï½¢2ï½£ def)
(ï½¢3ï½£ ghi)
14:05 haxxelotto joined
Voldenet nevermind, that :skip-empty is a bad idea because it makes iterations unpredictable 14:10
14:15 jpn joined 14:41 xinming left 14:42 Sgeo joined 14:43 xinming joined 14:45 haxxelotto left 15:07 haxxelotto joined, tadzik left, tadzik joined
tbrowder you need to add .Str to the match to get a usable string 15:08
and i want to join the match.Str and its result into a new string 15:11
a space-separated string
lizmat m: say "1abc2def3ghi".split(/\d/, :v).join(" ") 15:12
camelia 1 abc 2 def 3 ghi
tbrowder $pair.Str.say maybe
lizmat: i need "1 abc", "2 abc", ... a list 15:13
lizmat and what if the string begins with "foo", like "foo1abc2def" ? 15:14
Voldenet I'm starting to believe that using grammars is a better solution 15:15
antononcube @Voldenet Better than using LLMs? 15:19
lizmat m: .say for "1abc2def3ghi".split(/\d/, :v).skip.map(-> $a, $b { "$a $b" }) 15:20
camelia 1 abc
2 def
3 ghi
Voldenet m: for "1abc2def3ghi".match(/$<k>=(\d)$<v>=(<-:N>+)/, :g) -> $pair { $pair.say };
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
lizmat tbrowder: ^^ in case there's no string before the first numeric
Voldenet uh oh 15:21
m: for "1abc2def3ghi".match(/$<k>=(\d)$<v>=(<-:N>+)/, :g) { .say }; 15:22
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
Voldenet odd, it works for me
m: for "1abc2def3ghi".match(:g, /$<k>=(\d)$<v>=(<-:N>+)/) { .say };
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
Voldenet either way, the above should work, contrary to what bot says 15:24
lizmat doesn't work for me eitherv :-(
Voldenet m: for "1abc2def3ghi" ~~ m:g/$<k>=(\d)$<v>=(<-:N>+)/ { .say }; 15:25
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
lizmat Voldenet: which version of Rakudo are you using ?
Voldenet not a specific version, maybe that's my problem 15:27
lizmat if it's pre 2023.12, then that could be the reason
Voldenet 6.0d, seems ancient
lizmat 5606fb657c
linkable6 (2023-12-15) github.com/rakudo/rakudo/commit/5606fb657c Make Match.print more aware of its surroundings
lizmat afk&
Voldenet m: for "1abc2def3ghi" ~~ m:g/$<k>=(<:Nd>+)$<v>=(<-:Nd>+)/ { say .<k>, .<v> }; 15:28
camelia 「1」「abc」
「2」「def」
「3」「ghi」
Voldenet yeah, that was it
16:10 abraxxa-home joined 16:18 vrurg_ joined 16:21 vrurg left
tbrowder lizmat: "use ^^", thnx for reminder 16:25
16:27 abraxxa-home left 17:36 haxxelotto_ joined, vlad joined, haxxelotto left 17:42 vlad left 17:43 vlad joined 17:47 vlad left 17:48 vlad joined 17:50 dakkar left
lizmat weekly: github.com/Raku/intellij-ide-plugi...ource-dump 17:54
notable6 lizmat, Noted! (weekly)
lizmat aka the Comma Source is available
18:20 sena_kun joined, vrurg_ is now known as vrurg 18:53 vlad left
antononcube weekly:rakuforprediction.wordpress.com/20.../wwwllama/ 20:21
notable6 antononcube, Noted! (weekly)
20:32 jpn left 20:38 jpn joined 20:43 jpn left 21:00 guifa left 21:01 jpn joined 21:37 Tigerpaws left 21:40 Tigerpaws joined 21:46 Tigerpaws left 21:48 Tigerpaws joined 21:52 jpn left 21:53 Tigerpaws left 21:56 jpn joined, jpn left 22:47 ponycat left 23:24 sena_kun left 23:38 xinming left 23:39 xinming joined 23:43 ponycat joined