🦋 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.
jdv why is raku at tye top of hn? 00:47
*the
antononcube 🙂 thanks for pointing it out! 01:06
guifa I kinda wish there were an equivalent for <!> that failed the outer regex instead of just the current alternation 01:09
maybe <!!> ?
sort of like a "I'm intentionally taking you down a bad path so die plz" 01:10
antononcube @guifa Shouldn't this happen with fail and || ? 01:12
I.e. emulated... 01:13
guifa actually maybe it doesn't and I'm forgetting about backtracking
guifa m: my regex foo (&x) { <.&x> }; say 'abcxyz' ~~ /<foo x>/ ; 01:27
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
x used at line 1
guifa X is clearly defined though
Xliff Good morning (or late night) 06:15
Anyone around?
m: my $a = Promise.in(10).then: { say "BOO!" }; sleep 5; $a.break; sleep 5
camelia Access denied to keep/break this Promise; already vowed
in block <unit> at <tmp> line 1
06:16
Xliff Can some one tell me what I am doing wrong, here?
m: my $a = Promise.in(10).then: { say "BOO!" }; sleep 5; $a.status.say;
camelia Planned
Xliff m: my $a = Promise.in(10).then: { say "BOO!" }; $a.vow.say; sleep 5; 06:17
camelia Access denied to keep/break this Promise; already vowed
in block <unit> at <tmp> line 1
Xliff m: my $a = Promise.in(10); $a.vow.say; 06:21
camelia Access denied to keep/break this Promise; already vowed
in block <unit> at <tmp> line 1
xinming Is there a shortcut to do 2 array compare? 08:05
m: @a = (1,2,3); @b = (1,2,3); (@a == @b).raku.say;
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@a' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏@a = (1,2,3); @b = (1,2,3); (@a == @b)
xinming m: my @a = (1,2,3); @b = (1,2,3); (@a == @b).raku.say;
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@b' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> my @a = (1,2,3); ⏏@b = (1,2,3); (@a == @b).raku.say;
xinming my @a = (1,2,3); my @b = (1,2,4); (@a == @b).raku.say; # <--- This will only compare the elems of the 2 array. 08:06
evalable6 Bool::True
xinming hmm, I think I need to write the function myself, as they're not Set compare 08:08
nahita3882 are you looking for eqv 08:31
set equality comparator is (==) (or ≡) 08:32
SmokeMachine m: @a = (1,2,3);  @b = (1,2,3); (@a eqv @b).raku.say; 08:55
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@a' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏@a = (1,2,3);  @b = (1,2,3); (@a eqv @b
SmokeMachine m: my @a = (1,2,3); my @b = (1,2,3); (@a eqv @b).raku.say; 08:56
camelia Bool::True
SmokeMachine m: my @a = (1,2,3); my @b = (1,4,3); (@a eqv @b).raku.say; 08:57
camelia Bool::False
xinming SmokeMachine: thanks. 10:04
xinming I used sub array-eq (@a, @b) { for @a Z @b -> ($a, $b) { $a == $b }; True } 10:05
nahita3882 that always returns True 10:06
SmokeMachine Why not using eqv? 10:11
m: sub array-eq(@a, @b) { [&&] @a Z[==] @b }; say array-eq [1,2,3], [1,2,3]; say array-eq [1,2,2], [1,4,3] 10:13
camelia True
False
xinming SmokeMachine: I'll use eqv, I just know eqv when I read doc, But don't know how to use that yet. 10:38
the [&&] @a Z[==] @b version is better 10:39
lizmat Raku on HN: news.ycombinator.com/item?id=42120090 13:00
at #6 now
Todd2 How do I do a binary write to the STDOUT? 13:19
lizmat $*OUT.encoding(:bin); $*OUT.write: Buf.new(1,2,3,4) 13:23
evalable6 ␁␂␄
Todd2 testing 13:35
Windows 11-24H2 >echo ^[ HI ^[ 13:40
 HI
>raku -v
Welcome to RakudoΓäó v2024.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2024.07.
>$*OUT.encoding(:bin); $*OUT.write: chr(27) ~ ' Hi ' ~ chr(27) ~ ''
'$*OUT.encoding' is not recognized as an internal or external command,
operable program or batch file.
ab5tract Todd2: I think you aren’t in a repl 13:55
Todd2 I actually am 13:56
ab5tract Ah, ok. That’s not clear from the sequence you shared as raku -v doesn’t start one
Todd2 I was giving my revision number 13:57
ab5tract And the error message is a Windows (or maybe even DOS) one
nahita3882 that's exactly the error to get when executing $*OUT.encoding(:bin); $*OUT.write: chr(27) ~ ' Hi ' ~ chr(27) ~ '' on cmd.exe directly 13:58
Todd2 I am getting the hang of it: [0] >  $*OUT.write: Buf.new(27, 91, 51, 50, 109, 32, 72, 73, 32, 27, 91, 48, 109, 13) 14:03
[0] >  $*OUT.write: Buf.new(27, 91, 51, 50, 109, 32, 72, 73, 32, 27, 91, 48, 109, 13, 10) 14:04
← HI ←
evalable6 WARNINGS for /tmp/tdjXYlF0hg:
3 HI ␍
Useless use of ">" in expression "[0] >  $*OUT.write: Buf.new(27, 91, 51, 50, 109, 32, 72, 73, 32, 27, 91, 48, 109, 13, 10)" in sink context (line 1)
Todd2 Now this is annoying, in Fedora Bash I get a green `HI`.   In Windows 11-24H2, I get `← HI ←`.   I can send the same command with "echo" and I get teh green HI. 14:08
raku -e "$*OUT.write: Buf.new(27, 91, 51, 50, 109, 32, 72, 73, 32, 27, 91, 48, 109, 13, 10)" 14:09
← HI ←
antononcube news.ycombinator.com/item?id=42125980 14:37
[Coke] Todd2: I was the one responding via email; all the ANSI codes just work for me on the same version of raku - tried to sync up the module version and then went into a rabbit hole of not being able to compile on windows 11. 14:40
If you're having trouble with just emitting the direct codes, then it's not an issue with the module; guessing you have some OS issue that is not setup to enable the ANSI codes. 14:41
[Coke] finds superuser.com/questions/413073/win...s-handling 14:42
Todd2 Hi Coke, That did the trick! 14:50
REGEDIT4 14:51
; Allow progams to wite ANSI color to terminals
[HKEY_CURRENT_USER\Console]
"VirtualTerminalLevel"=dword:00000001
Thank you!!!! 14:52
antononcube 🎉 14:53
Xliff \o. Is there a way to tell if a Routine is marked "is rw"? 16:11
lizmat m: dd (sub a() { }).rw 16:23
camelia Bool::False
lizmat m: dd (sub a() is rw { }).rw
camelia Bool::True
lizmat Xliff: ^^
Xliff lizmat: Ah, thanks! I actually went trough the whole source tree and found it 5 minutes ago. LOL!
lizmat I guess that made 2 of us :-)
Xliff Buried in nqp of all things. Is this available in the docs? All of the $!flags should be documented there. 16:24
lizmat not sure 16:26
whether documented I mean
the reason it's buried in nqp, is because it's needed to build the proper QAST I guess
Xliff I would look myself, but I'm on the clock and have a meeting in 2 hours. 16:27
lizmat there's no hurry :-)
for looking that up, I mean :-)
Xliff kk 16:31
cokebot30 [Coke] here - my main IRC client is borked, if you need me short term, email is best. 17:28
antononcube weekly:youtu.be/E7qhutQcWCY 19:09
notable6 antononcube, Noted! (weekly)