🦋 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:06 reportable6 left 00:08 reportable6 joined 00:29 jjido left 00:40 epony left 00:43 epony joined 00:55 razetime joined 01:08 Kaiepi left 01:20 razetime left, razetime joined 01:27 razetime_ joined, razetime left 01:37 razetime_ left, razetime joined 01:38 razetime joined
MasterDuke [Coke]: pretty sure ugexe gave an example of how to do that in one of the channels in the past month or two 01:38
01:38 razetime left 02:22 sgrs left 02:27 frost joined, frost43 joined 02:28 frost43 left 03:29 unicodable6 left, notable6 left, linkable6 left, coverable6 left, evalable6 left, releasable6 left, tellable6 left, reportable6 left, quotable6 left, squashable6 left, benchable6 left, committable6 left, bloatable6 left, bisectable6 left, greppable6 left, statisfiable6 left, sourceable6 left, shareable6 left, nativecallable6 left, shareable6 joined, tellable6 joined 03:30 coverable6 joined, quotable6 joined, unicodable6 joined, evalable6 joined, reportable6 joined, greppable6 joined 03:31 committable6 joined, nativecallable6 joined, bloatable6 joined, linkable6 joined 03:32 sourceable6 joined, squashable6 joined, benchable6 joined, releasable6 joined, statisfiable6 joined, notable6 joined, bisectable6 joined 03:41 melezhik joined
melezhik .tell tonyo - finally I've made it - full automation of fez upload via pipeline - fosstodon.org/@melezhik/109402367802442237 03:42
tellable6 melezhik, I'll pass your message to tonyo
melezhik happy thanks giving to everyone who observes this holiday ! 03:43
ToddAndMargo Happy Thanksgiving to all too! 03:50
What is the proper syntax for this?
my $k = CArray[uint8].new(0xFF xx $j )
Cannot invoke object of type 'NQPMu'
It does not like $j (which is 6)
Guest32 docs.raku.org/routine/xx 03:52
ToddAndMargo I am not seeing any way to use a variable there.  Am I missing something? 03:54
I want to use the variable to set the length 03:55
03:58 melezhik left
ToddAndMargo say [1, 2] xx $j; 04:00
Cannot invoke object of type 'NQPMu'
any other way to presalt my CArray?
Guest32 [2] > my $l = CArray[uint8].new(255 xx 6); 04:05
NativeCall::Types::CArray[uint8].new
[3] > say $l.kv;
(0 255 1 255 2 255 3 255 4 255 5 255)
ToddAndMargo my $k = CArray[uint8].new(0xFF xx $j )     The reason for the $j is that I do not know the length until it is calculated 04:07
Guest32 [3] > my $j = 7; 04:08
7
[4] > my $l = CArray[uint8].new(255 xx $j);
NativeCall::Types::CArray[uint8].new
[5] > say $l.kv;
(0 255 1 255 2 255 3 255 4 255 5 255 6 255)
ToddAndMargo Where is my typo? 04:12
> $j =6; $k = CArray[uint8].new(0xFF xx $j ); print $j ~ "\n";
Cannot find method 'qast' on object of type NQPMu
Figured it out.  My repl does not like my $j.  When run directly, it works perfectly.  Sorry for the false alarm 04:16
Now what am I doing wrong? 04:19
ppSessionInf       = <NativeCall::Types::Pointer<4817055982656>>
pCount             = <2>
Length             = <48>
   $Result = GetWTSEnumerateSession $hServer, $Reserved, $Version, $ppSessionInf, $pCount;
   my uint16 $Length = $pCount * (12 + (12 * $Win64bit));
   my $ca = CArray[BYTE].new( 0xFF xx $Length );
   $ca = $ppSessionInf.deref;
Internal error: unhandled target type
What should I have as a target type? 04:20
the target type is throwing on `$ca = $ppSessionInf.deref;`
Guest32 Give it a read: docs.raku.org/language/numerics 04:24
ToddAndMargo what section? 04:27
Is there a way to ask raki what type is being returned? 04:28
not declaring the variable type does not work either `my $x = $ppSessionInf.deref;`  neither does `say $ppSessionInf.deref;` 04:29
Guest32 [8] > my $v = 1; 04:31
1
[9] > my $l = CArray[uint8].new($v++ xx $j);
NativeCall::Types::CArray[uint8].new
[10] > say $l[0].WHAT;
(Int)
[10] > say $l.WHAT;
(CArray[uint8])
[10] > say $l.kv;
(0 1 1 2 2 3 3 4 4 5 5 6 6 7)
ToddAndMargo appartenly 1repr1 does not exist either 04:32
say $ppSessionInf; return `NativeCall::Types::Pointer<0x1e2f9c04020>` 04:33
How do I tell NativeCall I want 24 bytes that that pointer points to? 04:34
.deref is giving me a bad time! 04:35
Guest32 As far I can tell there is no valid hexadecimal representarion (0xFF) in Raku lang. 04:36
ToddAndMargo 0xFF is uint8 04:37
Guest32 I can't find the strings "0x" or "hexa" in the search box of docs.raku.org
ToddAndMargo say 0xFF.base(16) 04:38
FF
evalable6 FF
ToddAndMargo > my $i=0xFF; say $i.base(16) ~ "  " ~ $i.base(2) 04:40
FF  11111111
my uint8 $i=0xFF; say $i.base(16) ~ "  " ~ $i.base(2)
FF  11111111
evalable6 FF  11111111
ToddAndMargo How do I tell NativeCall I want 24 bytes that that pointer points to? 04:41
04:43 tirnanog left
ToddAndMargo `say "$ppSessionInf.WHAT = <" ~ $ppSessionInf.WHAT ~ ">";` gives me 04:44
Use of uninitialized value of type NativeCall::Types::Pointer in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in sub GetSessionNo at PopUpTest2.pl6 line 98
NativeCall::Types::Pointer<3452477188480>.WHAT = <>
say "$ppSessionInf.deref.WHAT = <" ~ $ppSessionInf.deref.WHAT ~ ">"; 04:46
Internal error: unhandled target type
Perhaps, did I just trip across a bug in NativeCall? 04:49
Guest32 no ideia 04:53
04:58 frost left 05:27 Kaiepi joined, Guest32 left 06:07 reportable6 left 06:08 reportable6 joined 07:08 bisectable6 left, notable6 left, statisfiable6 left, benchable6 left, linkable6 left, committable6 left, unicodable6 left, quotable6 left, sourceable6 left, bloatable6 left, nativecallable6 left, greppable6 left, releasable6 left, evalable6 left, tellable6 left, reportable6 left, coverable6 left, squashable6 left, shareable6 left 07:09 committable6 joined, squashable6 joined, evalable6 joined, notable6 joined 07:10 releasable6 joined, coverable6 joined, sourceable6 joined, linkable6 joined, nativecallable6 joined, quotable6 joined, shareable6 joined 07:11 greppable6 joined, tellable6 joined, benchable6 joined, statisfiable6 joined, bloatable6 joined, unicodable6 joined, reportable6 joined, bisectable6 joined 07:20 abraxxa joined 07:29 abraxxa left 07:30 abraxxa joined 07:44 eseyman joined 07:58 discord-raku-bot left 07:59 discord-raku-bot joined 08:30 xinming left 08:31 xinming joined 08:41 MoC joined 09:03 razetime joined 10:03 committable6 left, bisectable6 left, squashable6 left, reportable6 left, nativecallable6 left, linkable6 left, sourceable6 left, statisfiable6 left, bloatable6 left, greppable6 left, unicodable6 left, benchable6 left, tellable6 left, quotable6 left, notable6 left, coverable6 left, shareable6 left, releasable6 left, evalable6 left 10:04 committable6 joined, unicodable6 joined, nativecallable6 joined, statisfiable6 joined, tellable6 joined, squashable6 joined 10:05 releasable6 joined, shareable6 joined, linkable6 joined, evalable6 joined, bloatable6 joined, quotable6 joined, greppable6 joined 10:06 sourceable6 joined, bisectable6 joined, reportable6 joined, benchable6 joined, coverable6 joined, notable6 joined 10:38 Sgeo left 11:30 sgrs joined 11:37 habere-et-disper joined 11:54 MoC left 12:07 reportable6 left 12:08 reportable6 joined 12:10 jjido joined 12:12 jjido left 12:26 Guest7276 joined, Guest7276 left 12:54 jjido joined 12:57 habere-et-disper left 13:03 Nemokosch joined
Nemokosch Hi, is there anyone who would feel strongly about the removal of "Defined as:" phrases from the top of signatures in the documentation? 13:05
tellable6 2022-11-23T09:54:02Z #raku-dev <lizmat> Nemokosch: I think it's time to do a PR to add yourself to github.com/rakudo/rakudo/blob/master/CREDITS :-)
2022-11-24T18:30:43Z #raku-dev <lizmat> Nemokosch: would you like a commit bit ?
Nemokosch Example: docs.raku.org/routine/sum "Defined as:" at two out of three places 13:06
13:07 Nemokosch left 13:11 abraxxa left 13:25 Kaiepi left 13:26 Kaiepi joined 13:34 jjido left 14:21 habere-et-disper joined 14:27 gugod left 14:31 gugod joined 14:44 razetime left 15:03 probiedooo joined 15:11 rbt joined
rbt Is there a way to see when a Num or Rat will fit into num64 without reducing precision? 15:13
This write-num64(0, $_.Num) just tosses extra lower bytes. 15:16
15:20 rbt left, rbt joined
Nemokosch probably .Num itself does 15:21
rbt Indeed. Is there a better way of detecting tossed bytes than this: $value != $value.Num.Rat 15:29
16:00 deoac left
Geth advent: tbrowder++ created pull request #102:
Moving tbrowder's Raku Advent article source to another location
16:02
advent/master: 9 commits pushed by (Tom Browder)++
16:05 deoac joined
avuserow rbt: maybe narrow would help? docs.raku.org/routine/narrow 16:06
not sure if that helps with native types though. your solution may be the best 16:07
rbt Unfortunately, narrow provides datatypes which may still overflow num64. 16:11
avuserow is there a way to get regexes to return Str instead of Matches? here's my usecase: 16:15
m: "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; dd [:$<relation>] # this is what I get
camelia [:relation(Match.new(:orig("foo.bar::baz"), :from(0), :pos(3)))]
avuserow m: "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; dd [:relation($<relation>.Str)] # this is what I want but simpler :)
camelia [:relation("foo")]
16:20 rbt left, rbt joined 16:42 MasterDuke left 16:49 probiedooo left 16:52 nine_ joined, nine left, camelia left, m_athias left 16:53 m_athias joined 16:55 rbt left 16:56 rbt joined 16:58 jjido joined 16:59 camelia joined 17:19 Guest79 joined 17:21 jjido left 17:26 tirnanog joined
gfldex m: my Str() @a = ('foo=10' ~~ /$<a>=[\w+] '=' $<b>=[\d+]/)<a b>; .say for @a; 17:36
camelia foo
10
gfldex avuserow: ^^^
17:46 sortiz joined
gfldex m: say ('foo=bar=10' ~~ /$<a>=('foo' '=' $<b>=('bar' '=' $<c> = [\d+]))/){||<a b c>}; 17:46
camelia (「foo=bar=10」
b => 「bar=10」
c => 「10」 Nil Nil)
gfldex m: use v6.*; say ('foo=bar=10' ~~ /$<a>=('foo' '=' $<b>=('bar' '=' $<c> = [\d+]))/){||<a b c>}; 17:47
camelia 「10」
17:50 habere-et-disper left 17:51 holyghost joined
sortiz rba, As far as I remember any Num can be stored as num64 without losing precision: 17:51
m: my $b = Buf.allocate(8).write-num64(0,pi); say $b.read-num64(0) === pi;
camelia True
17:53 Nemokosch joined
Nemokosch avuserow: I think I found a hacky way for your syntax 17:54
m: "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; $/ := $/.Hash>>.Str; dd [:$<relation>]
camelia [:relation("foo")]
Nemokosch the problem is that this binding seems to kill the mechanism that backs up $/ 17:56
so now I'm stuck with the value I got into it, no matter how many times I match :\
17:58 squashable6 left 18:00 squashable6 joined
Nemokosch m: my $match = "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; { my $/ := $match.Hash>>.Str; dd [:$<relation>]; }; "alma" ~~ / ma /; dd $/; 18:07
camelia [:relation("foo")]
Match $/ = Match.new(:orig("alma"), :from(2), :pos(4))
18:07 reportable6 left
Nemokosch now, the hack doesn't leak at least 18:07
but it's getting too verbose to be useful
18:08 reportable6 joined
sortiz rbt: Ups, the above was for you. 18:11
18:14 squashable6 left 18:15 squashable6 joined 18:32 Nemokosch left 18:38 kylese joined
rbt soritz: Thank-you. I'd come to that conclusion as well. I've got a different solution for Rat. Trying to cleanup some of the DBIish MySQL driver issues. 18:42
sortiz: Thank-you ^ 18:44
sortiz Some loss of precision when converting between Num and Rat (or FatRat) is inevitable. 18:45
19:03 deoac left 19:23 sgrs left 20:09 kylese left
avuserow Nemokosch, thanks for the ideas. Luckily I found that I can solve this a layer up 20:18
m: class Foo {has Str() $.bar}; "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; say Foo.new(:$<bar>)
camelia Foo.new(bar => Str)
avuserow m: class Foo {has Str() $.relation}; "foo.bar::baz" ~~ /^ $<relation>=(\S+) "." $<column>=(<-[:]>+) "::" $<cast>=(\S+) $/; say Foo.new(:$<relation>) 20:19
camelia Foo.new(relation => "foo")
20:23 japhb left 20:30 japhb joined
rbt sortiz: I managed to find loss in precision while creating a FatRat directly. 20:52
say '-0.1234567890123456774144'.FatRat; # output: -0.123456789012345677
evalable6 -0.123456789012345677
20:55 n1to joined
sortiz rbt: Creating a FatRat from Num? 20:57
rbt From a string. 20:58
Adding digits gets the correct output.
sortiz A FatRat from Str attempts to use as many digits as available. But from from Num it use a default epsilon. (1e-6) 21:00
gfldex This is calling Cool.FatRat what is in turn calling self.Numeric.
21:00 Sgeo joined
sortiz &brb 21:00
gfldex and in role Numeric we can find: method FatRat(Numeric:D:) { self.Rat.FatRat } 21:01
rbt: please file a Rakudobug
rbt Yeah, I filed #5108
gfldex This is rather convoluted. Str.val -> Cool.Numeric -> *.Rat.FatRat 21:06
m: say '-0.1234567890123456774144'.val
camelia No such method 'val' for invocant of type 'Str'. Did you mean 'EVAL'?
in block <unit> at <tmp> line 1
gfldex m: say val('-0.1234567890123456774144')
camelia -0.1234567890123456774144
gfldex m: say val('-0.1234567890123456774144').WHAT
camelia (RatStr)
rbt It works if you add a digit. Appended a 9 to the end: 21:07
say '-0.12345678901234567741449'.FatRat
evalable6 -0.12345678901234567741449
21:44 habere-et-disper joined 22:03 sgrs joined 22:38 holyghost left 22:45 jjido joined, n1to left 23:39 Sgeo left 23:50 euandreh left 23:53 snibsnab joined 23:55 Sgeo joined