🦋 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:00 deoac left, reportable6 left 00:02 reportable6 joined 00:14 Kaiepi left 00:21 sortiz left, sortiz joined 00:36 habere-et-disper joined
Anton Antonov I tried to set up GitHub blog posting, but was too hard (for me.) So, I stuck with WordPress. 00:45
Nemokosch :DDD 01:09
01:22 habere-et-disper left
Geth advent: 5d14dc3e01 | (Alexey Melezhik)++ (committed using GitHub Web editor) | raku-advent-2022/authors.md
Second part of SparrowCI pipelines posts
01:42 MasterDuke left 02:10 rinkydink is now known as kerframil 02:12 kerframil is now known as tirnanog 03:12 linkable6 left, evalable6 left, shareable6 left, squashable6 left, nativecallable6 left, tellable6 left, committable6 left, sourceable6 left, bloatable6 left, statisfiable6 left, coverable6 left, greppable6 left, unicodable6 left, benchable6 left, notable6 left, bisectable6 left, quotable6 left, releasable6 left, reportable6 left, unicodable6 joined, greppable6 joined, shareable6 joined, evalable6 joined 03:13 releasable6 joined, quotable6 joined, sourceable6 joined, linkable6 joined, bloatable6 joined, squashable6 joined, notable6 joined, reportable6 joined 03:14 bisectable6 joined, benchable6 joined, tellable6 joined, statisfiable6 joined, committable6 joined 03:15 nativecallable6 joined, coverable6 joined 03:16 razetime joined 03:46 Kaiepi joined 04:04 derpydoo left 04:47 oodani left 04:50 oodani joined 05:50 benchable6 left, committable6 left, nativecallable6 left, statisfiable6 left, evalable6 left, greppable6 left, shareable6 left, bloatable6 left, sourceable6 left, reportable6 left, bisectable6 left, unicodable6 left, squashable6 left, tellable6 left, linkable6 left, evalable6 joined 05:51 benchable6 joined, greppable6 joined, bisectable6 joined, reportable6 joined, nativecallable6 joined, statisfiable6 joined, sourceable6 joined, bloatable6 joined 05:52 shareable6 joined, tellable6 joined 05:53 squashable6 joined, linkable6 joined, committable6 joined, unicodable6 joined 06:00 reportable6 left 06:02 reportable6 joined 06:10 goblin left, goblin joined
CIAvash I already suggested this but since the talk about blog and markdown has arose again, the website I created for Raku is a static site generator that uses Hugo which supports markdown and uses chroma syntax highlighter which supports Raku. One problem people might have with it, is that it is not written in Raku. You can either use the website and host it directly and/or I can create a blog and use CNAME records to point it to the address you want. 06:41
www.raku-lang.ir/en/ github.com/CIAvash/raku-website
06:56 Jamiu joined
Jamiu Hello all 06:57
06:57 Jamiu left 07:11 abraxxa joined 07:16 abraxxa left, abraxxa joined 07:30 epony left, epony joined
Geth ¦ problem-solving: JJ assigned to codesections Issue Choose some precise (or rough) way to "adopt" modules in the Raku Module Adoption center github.com/Raku/problem-solving/issues/355 07:52
08:09 ProperNoun left 08:14 epony left 08:19 epony joined 08:20 epony joined 08:29 sarna left 08:41 sena_kun joined 08:57 Sgeo left 08:58 sena_kun left 09:01 sena_kun joined 09:02 dakkar joined
Nemokosch RE: raku-lang.ir site - I kept asking about this site for months, nobody seemed to care. Now that I made up my mind that apparently it's not being adopted, and started mangling with the current raku.org site, I don't want it to be taken over. 09:43
09:49 ToddAndMargo joined 09:59 lichtkind_ joined 10:06 ToddAndMargo left, ToddAndMargo joined
ToddAndMargo Anyone on newbie duty?  :-) 10:07
I posted my NativeCall question over on vpaste.net/yVh5l
10:10 sarna joined 10:12 sarna left, sarna joined
Nemokosch Jamiu: what's up 10:14
this name is new to me
CIAvash Yeah, I'm not talking about adoption, but using it for blogs(advent, core, community blogs). But it seems people are not interested in that either 🤷 10:20
10:21 sena_kun left 10:22 sena_kun joined 10:29 sena_kun left
Nemokosch Yes well, communication is sloppy somehow. 10:34
Don't take it as a judgement of your work; this topic inherently has more bikeshedding than actual collaborative work. 10:35
10:37 sarna left 10:38 sarna joined
let me bring up my Raku-related "sketchboard" repo, especially Biggest Wishes and Issues but everything is public; just not necessarily interesting 😄 10:38
10:40 sarna left 10:41 sarna joined
ToddAndMargo I will post my question over on the mailing list too 10:48
10:49 sarna left
Geth ecosystem/main: 0e123bc3c6 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Moved to zef ecosystem
10:49 sarna joined 10:55 linkable6 left 10:57 linkable6 joined 11:16 ToddAndMargo left 11:22 sena_kun joined 11:45 epony left 11:49 sgrs joined 12:00 reportable6 left 12:01 reportable6 joined
tbrowder CVIvash: how much effort would it take to make that website 12:02
Geth advent: massa++ created pull request #103:
Massa's article
Nemokosch what is a Callable[Int]? In general, what is the parameter of the Callable role for?
tbrowder into something roughly approximating the current advent site? i remember seeing it some time ago--looks nice.
CIAvash: can you think of a way to hook up a publish-on-schedule list? 12:07
<Nemokosch> i like the idea of porting Text::Word::Extract, but i would vote for a rename. i've seen it before on searches but the Word part never caught my eye as being MS Word. but good tags would help for sure 12:13
text-extract-word 12:14
Text::Extract::MSWord or MSWord::Extract or MSWord::Tools or Word::Utils ... 12:16
anyhow, great idea, very useful like the Excel modules 12:17
Nemokosch tbrowder: noted 12:19
tbrowder CIAvash: some of tonyo's fez plumbing for user accounts might be useful, also ugexe's zef plumbing as well 12:22
CIAvash <tbrowder> "into something roughly approxima..." <- You mean visually or the blog(functionality) itself? 12:25
12:26 epony joined
tbrowder mostly the functionality. i pesonally liked the visiual format of the original site 12:27
mostly the functionality. i pesonally liked the visiual format of the original site 12:28
CIAvash <tbrowder> "CIAvash: can you think of a..." <- I think the way to go about it would be specifying the date for the blog post for when it's going to be published and then a GitHub action for periodically building the website. I think posts with future dates won't be published by default, so when the time is right they will
tbrowder and you can count on my support and help if you are willing and the RSC approves 12:29
yes, using github actions sounds good! 12:30
sortiz Nemokosch, Is used to set the "returns" property of a "synthetic" Callable as normal ones takes it from its signature. 12:31
tbrowder FYI, the raku-advent.blog domain name belongs to us 12:32
CIAvash functionality-wise I think it's ready to be used, except for the comments section, if that is necessary an external tool needs to be used(since it's a static site)
sortiz m: sub foo(-->Int) { 6 }; say &foo.returns; say foo(); 12:33
camelia (Int)
Nemokosch oh interesting. Let me see if it works with what I'm trying to check. 😛 12:34
sortiz m: class Adder does Callable[Int] { has $.toadd; submethod CALL-ME($a) { $a + self.toadd } }; my &add6 = Adder.new(6); say add6(3); say &add6.returns; 12:35
camelia Default constructor for 'Adder' only takes named arguments
in block <unit> at <tmp> line 1
Nemokosch > my Int &foo = sub bar(-->Int) { 6 }; # this actually works
sortiz m: class Adder does Callable[Int] { has $.toadd; submethod CALL-ME($a) { $a + self.toadd } }; my &add6 = Adder.new(:6toadd); say add6(3); say &add6.returns;
camelia 9
tbrowder the current comment part i think would be better used if were easier to comment. i'm always in a hurry and can't seem to have time to go through another login process 12:36
12:36 Nemokosch joined
Nemokosch \o :P 12:37
tbrowder o/ ;-D
Nemokosch m: my Int &foo = -> --> Int { 6 }; 12:38
camelia Type check failed in assignment to &foo; expected Callable[Int] but got Block (-> --> Int { #`(Blo...)
in block <unit> at <tmp> line 1
Nemokosch sortiz: do you know why this fails?
m: my Int &foo = sub bar(--> Int) { 6 }; 12:40
camelia ( no output )
Nemokosch this works
tbrowder i'll bet tonyo or melezhik could get a commenting system for it 12:41
CIAvash Hugo has support for [Disqus](disqus.com/), but there are other alternatives: gohugo.io/content-management/comments/ 12:45
sortiz m: my &foo = -> --> Int { 6 }; say &foo.returns; # Works too.
camelia (Int)
Nemokosch tbh I kinda hope this advent blog topic can settle and maybe CIAvash++ can collect some social credits finally; I myself couldn't fully appreciate multiple of his otherwise decent and functional solutions
Geth advent: 141b632389 | (Humberto Massa)++ | raku-advent-2022/articles/hyperCro.md
Massa's article
advent: a3588c4458 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | raku-advent-2022/articles/hyperCro.md
Merge pull request #103 from massa/master

Massa's article
tbrowder CIAvash: i really would like to be able to write a blog in any reasonably familiar language that would not get scrambled as soon it's sucked into it's maw
Nemokosch sortiz: the more interesting it is that the type check failed there. Apparently it does know the return type.
Could be that this is simply a bug. 12:48
sortiz Can be.
m: class Adder does Callable[Int] { has $.toadd; submethod CALL-ME($a) { $a + self.toadd } }; my Int &add2 = Adder.new(2); say add2(2): 12:49
camelia Default constructor for 'Adder' only takes named arguments
in block <unit> at <tmp> line 1
sortiz m: class Adder does Callable[Int] { has $.toadd; submethod CALL-ME($a) { $a + self.toadd } }; my Int &add2 = Adder.new(:2toadd); say add2(2):
camelia 4
Nemokosch so the type annotation makes sense for &variables as well, it does have a concept for it 12:50
CIAvash Interesting it seems there is even a comment system based on GitHub issues: utteranc.es/ 12:51
tbrowder *its maw (e.g., wordpress)
CIAvash: is there a cost for it? 12:53
sortiz Nemokosch, fill a rakudo bug for the Block case. 12:56
Nemokosch sortiz: okay, thank you; I'm collecting the conclusions 12:58
CIAvash It's seems to be an open source and free javascript widget that uses the GitHub issues API for submitting and showing comments 12:59
Nemokosch oh by the way, one more thing 13:00
tbrowder CIAvash: it looks free to use from what i just saw! this all sounds pretty good to me
Nemokosch m: my Int @foo; my Int &foo; dd @foo, &foo; 13:01
camelia Array[Int @foo = Array[Int].new()
Callable &foo = Callable
sortiz And the question is? 13:03
Nemokosch the variable seems to preserve the annotated type with the assignment (see next snippet soon), however it sets something that doesn't have a parameter 13:04
Anton Antonov I have a question for tbrowder, lizmat, guifa, XLiff, timitimo, ugexe -- Do you mind if I use your handles in articles / presentations discussing statistics like this one: i.imgur.com/6KSaaSD.png ? (Right now I obfuscate them.)
Nemokosch m: my Int &foo; &foo = sub(-->Str) { 'qux' } 13:05
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> my Int &foo; &foo = sub(⏏-->Str) { 'qux' }
expecting any …
Nemokosch oops
m: my Int &foo; &foo = sub (-->Str) { 'qux' } 13:06
camelia Type check failed in assignment to &foo; expected Callable[Int] but got Sub+{Callable[Str]} (sub ( --> Str) { #`(...)
in block <unit> at <tmp> line 1
CIAvash tbrowder: as for writing blog posts, Hugo supports Markdown, HTML, org-mode, AsciiDoc, RST and Pandoc: gohugo.io/content-management/formats/
sortiz Unexpected?
Nemokosch so yes, the type constraint lives; how can it be that the default value doesn't follow it? 13:07
for an Array, it would
Anton Antonov I have heard about Hugo "notebooks" even ...
Nemokosch <@694526400488669234> goforprediction when? 13:08
Anton Antonov 🙂 no, I decided to stop at mathematic-, raku-, and pythonforprediction . But I should have probably chosen the name "goforpediction" 9 years ago... 13:09
tbrowder <Anton Antonov>: feel free to use my handle @tbrowder
sortiz m: my Int @foo; @foo[3] = 'foo'; # For Array the type constraint is for the containers. 13:10
camelia Type check failed for an element of @foo; expected Int but got Str ("foo")
in block <unit> at <tmp> line 1
Anton Antonov <@755062053282119803> Great!
Nemokosch <@755062053282119803> would be @tbrowder :P 13:11
ortiz: yes, and for Callable, the type constraint is (apparently) for .returns 13:12
m: my Int &foo; say &foo.returns
camelia (Mu)
Nemokosch except when it leaks :P 13:13
sortiz In `my Int &foo`, &foo is constrained but not defined yet. 13:14
m: my Int &foo; say &foo.VAR.of; 13:15
camelia (Callable[Int])
sortiz BTW `&foo` is an Scalar container. 13:16
tbrowder CIAvash: have you used Hugo for any other static sites? 13:17
i'm looking for a 13:18
sortiz An as soon as you (successfully) assign some Callable to it, &foo.returns has it proper value. 13:19
CIAvash tbrowder: yes, my own website and blog: siavash.askari-nasr.com/blog/ github.com/CIAvash/ciavash.github.io
tbrowder fairly painless way to show pages of photos similar to pages in a printed school yearbook
CIAvash tbrowder: there seems to be tools for image galleries: gohugo.io/tools/other/ 13:22
tbrowder my wife and i love the movie site! 13:23
ah, i see a wordpress to hugo tool! 13:26
Nemokosch is taking notes 13:27
sortiz One more note: 13:28
Nemokosch sortiz: I think it should say .returns === Int at any time but this is a minor inconvenience, after all
sortiz m: my Int &foo = -> --> Int { 6 } but Callable[Int] 13:29
camelia ( no output )
sortiz Expecting that in anundefined &foo .returns works is like expecting .succ works in a undefined `my Int $a`. 13:35
Nemokosch no, it's not like that 13:36
13:36 linkable6 left, evalable6 left 13:37 evalable6 joined
Nemokosch it's like expecting that for my Int $a, $a can pass as an Int under any valid circumstances 13:37
13:37 linkable6 joined
Nemokosch m: my Int &foo; my Int &bar; &bar = &foo; 13:40
camelia Type check failed in assignment to &bar; expected Callable[Int] but got Callable (Callable)
in block <unit> at <tmp> line 1
Nemokosch does this help with understanding my problem?
Because I think I couldn't have hoped for a bigger red flag to back up my sentiment.7 13:41
tbrowder CIAvash: allow a private msg? 13:42
sortiz When you declare `my Int &foo;` you aren't creating any Callable, you are only creating a (constrained) container for one. Only after you assign one to it you can expect it to be fully functional. 13:47
Nemokosch Well, I thought I tried as hard as possible to show that this isn't about being "fully functional" but simply "consistently typed" 13:48
if two variables that have the same type cannot be assigned to each other *because of a type constraint*, something is inconsistent 13:49
this is my "demarcation line", I have nowhere to back up from this assumption so I hope you can agree with it as it is. 13:50
CIAvash tbrowder: sure
lizmat clickbaits rakudoweekly.blog/2022/11/29/2022-...assy-core/
13:51 derpydoo joined
Nemokosch And please take it into account that this is an essential reason for type objects being the undefined values of that type, rather than having one universal undefined value above all. 13:53
14:01 Nemokosch left 14:02 Kaipei joined 14:05 Kaiepi left 14:13 simcop2387 left, perlbot left 14:14 simcop2387 joined, perlbot joined 14:27 sena_kun left, Altai-man joined
Nemokosch I've been thinking and there are even more extreme examples. `my Int &foo; &foo = &foo` fails and `my Int &foo; &foo = Nil` fails, the former violates common sense while the latter violates the specification. 14:45
Hell, even `my Int &foo = Nil` fails 14:46
My conclusions are: 1. `my Int &var` is a valid, designed concept backed up by Callable[::T], based on the declared return value of the Callable instance. 2. The sole fact that Callable can be parameterized and what that does, needs to be documented. 3. `my Int &var = -> --> Int { 6 }` fails; this is probably a bug, file a Rakudo issue for this. 4. `my Int &var` defaults to unparameterized Callable which is bogus 14:50
14:58 defaultxr joined 15:00 Sgeo joined
defaultxr hi. i have a script that processes each line of stdin, and calls a function for each line, pasted here: ix.io/4hhE . when i run it as is, it's pretty fast. however, if i comment out line 74 and uncomment line 73 (the ones in the "for $*IN.lines" block near the end), it's much slower (runs in 50 seconds instead of 5 on a long list of files). why is this? shouldn't i expect it to be way slower 15:14
to make a fresh any() junction each iteration by calling a function, rather than just pre-computing the any() once before the loop?
in other words, is-extension-type-old is way faster than is-extension-type, and i expect the opposite 15:16
Nemokosch I'd think that smartmatch could be quite costly 15:18
15:18 ProperNoun joined
oh but it's in the other one as well... 15:18
oh right! The signature! 15:19
Have you checked the content of the $extensions argument? 15:20
15:21 abraxxa left
Because I think it's not the junction but all individual values in the junction, resulting in a lot of calls 15:21
sortiz Nemokosch; I think that what you want at & sigilled declaration time is something like `my Int &b is default(sub (-->Int) { Int } );` right? 15:24
defaultxr Nemokosch: hmm... sorry, noob question but why does it become a list instead of staying a junction?
tellable6 defaultxr, I'll pass your message to Nemokosch
Nemokosch sortiz: not necessarily. Callable[Int] would be just as good, if that punning works 15:25
my problem isn't with the non-DEFINITE-ness but the type of the non-DEFINITE instance 15:26
15:26 Nemokosch joined
Nemokosch \o 15:26
tellable6 2022-11-30T15:24:50Z #raku <defaultxr> Nemokosch: hmm... sorry, noob question but why does it become a list instead of staying a junction?
Nemokosch defaultxr: docs.raku.org/type/Junction junctions are a bit special. Okay, not just a bit. 15:27
They don't descend from the Any type but directly from Mu, the root of the type system 15:28
This is a deliberate design decision so that wherever an individual value makes sense, the junction could be passed and you could get a new junction 15:29
m: my @fibo = 1, 1, * + * ... *; dd @fibo[1|3|5]; 15:30
camelia any(1, 3, 8)
defaultxr ah, that makes sense. then is the best way to just compute the junction within is-extension-type, like i do in is-extension-type-old? or is there a way i can pre-compute it and pass it as if it were a regular value? 15:31
Nemokosch You can capture the junction as one entity by specifying a type constraint. The default type constraint is Any. 15:33
You could set it to Junction or Mu and then it wouldn't break up.
defaultxr perfect, that works. thank you! 15:34
Nemokosch 🍬 15:36
15:36 Nemokosch left 15:38 Kaipei left
sortiz The problem is that simply declaring something not necessarily creates a pun, the positional-sigil by default creates a new Array that is auto-composed with its Positional role, but if you declare `my Positional[Int] $a` no Positional[Int] is punned, so you should not expect that `$a[0] = 1` works nor that $a[0] === Int 15:45
Nemokosch you know... I'm giving up. I don't expect _the content_ to be definite and specified. I expect _the type_ to be valid. 15:47
15:47 Nemokosch joined
Nemokosch m: my Positional[Int] $a; dd $a; $a = $a; $a = Nil; 15:48
camelia Positional[Int $a = Positional[Int]
Nemokosch the dd output is a bit glitchy but please 15:49
This variable is consistently typed, I don't think you couldn't understand that. 15:50
m: my Int &a; dd &a; &a = &a; &a = Nil;
camelia Callable &a = Callable
Type check failed in assignment to &a; expected Callable[Int] but got Callable (Callable)
in block <unit> at <tmp> line 1
Nemokosch this one isn't
you get the difference, don't you?
`my Int &foo` should simply default to the value `my Callable[Int] $foo` does 15:51
sortiz Yep, I got the difference and is fixable. 15:54
But that has nothing to do with the .returns method result. 15:56
Nemokosch m: say Callable[Int].returns 15:57
camelia (Int)
Nemokosch I'd argue that it does have something to do with it, after all.
I wish Positional[Int][0] also did in fact return (Int) but beggars can't be choosers :) 15:58
sortiz Ok, point taken. 16:00
Nemokosch Thank you. <3 16:01
16:01 Nemokosch left
leont Apparently all WhateverCode's are eqv to each other, that can't be right 16:02
Nemokosch yes, it does look like that... 16:05
github.com/rakudo/rakudo/blob/2022....pm6#L1311 Sourcery implies it simply dispatches to this call 16:07
mm, maybe I'm using it wrong 16:09
github.com/rakudo/rakudo/blob/2022....pm6#L1321 okay, that's more like it 16:10
oh right, it's because they are the same type and they have the same .raku output 16:15
tbrowder CIAvash: maybe you could propose a new Raku Advent site as a project to the Raku Foundation.
16:29 sortiz left
leont Yeah, because any difference between them is private 16:35
16:42 jetchisel left 16:43 jetchisel joined
leont I should have known, my list of things that are affected by public/private was too short 16:52
17:11 Kaipei joined 17:37 Matthew|m left, tiziodcaio left, AlexDaniel left, tadzik left, CIAvash left, Demos[m] left, andrea[m]12 left 17:39 dakkar left 17:43 CIAvash joined 17:49 razetime left
ugexe Anton Antonov: I don't mind if you use my handle in your data/post 17:54
17:54 AlexDaniel joined, tiziodcaio joined, Matthew|m joined, tadzik joined, Demos[m] joined, andrea[m] joined
Geth advent: fefa23b23e | (Alexey Melezhik)++ (committed using GitHub Web editor) | raku-advent-2022/articles/melezhik_post2.md
second post
18:00 reportable6 left 18:03 reportable6 joined 18:12 derpydoo left 18:14 Altai-man left
Anton Antonov @ugeexe Thanks! 18:16
Nemokosch melezhik++ about time I actually start experimenting with CI 😛 18:28
18:40 lichtkind__ joined 18:44 lichtkind_ left
Geth advent: c3cb48628d | (Alexey Melezhik)++ (committed using GitHub Web editor) | raku-advent-2022/articles/melezhik_post2.md
link to the gift
19:11 sortiz joined 19:31 clarkema joined 19:39 jgaz joined
El_Che hello 19:44
[Coke] I wonder if it would be helpful to have a list of ongoing potential community projects ranked in order of preference by RSC (yes, I know tuits aren't fungible) 19:49
github does, I think, let us have projects defined at the Raku group level.
19:59 sgrs left 20:00 clarkema_ joined
Geth advent: 5812b30661 | (Alexey Melezhik)++ (committed using GitHub Web editor) | raku-advent-2022/articles/melezhik_post2.md
minor style, gramma corrections
20:01 sgrs joined
El_Che [Coke]: great idea, but a little delicate 20:01
20:17 sgrs left 20:18 sena_kun joined 20:21 epony left, epony joined 20:39 clarkema left, clarkema_ is now known as clarkema 20:53 ToddAndMargo joined
ToddAndMargo Two questions on NativeCall: 20:54
1) how to I tell NativeCall I only want the
C pointer back, not what it points to?
2) how do I tell NativeCall I am sending it
a C pointer?
21:03 jgaz left 21:05 holyghost joined
tonyo CPointer 21:08
sortiz ToddAndMargo, 1) NC never call automatically .deref on a Pointer and a Pointer only can be dereferenced (on demand by the user) when it is parameterized with what its points to (Not *void). How can yo get a Pointer is API specific. 21:10
ToddAndMargo now I am confused! 21:11
      HANDLE WTSOpenServerA(
sortiz 2) In NC, to pass a pointer to some C function, you should declare an argument as Pointer. An example follows:
ToddAndMargo       [in] LPSTR pServerName
LPSTR is long pointer to string.  I give NC a CArray, not a pointer.  And it works 21:14
sortiz m: use NativeCall; sub malloc(size_t $size --> Pointer) is native { * }; sub free(Pointer \p) is native { * }; my $mem = malloc(10); say "Got some memory"; free($mem); say "Memory freed"; 21:15
camelia Got some memory
Memory freed
21:15 kolibrie joined
ToddAndMargo So to get NC to leave a c pointer alone, just declare it a "Pointer".   That makes sense.  What does not make sense is giving NC an actual structure and having it do it on its own.  What triggers what? 21:19
kolibrie I'm trying to get the cube root of a number, and I'm experiencing some unexpected results.  -8 ** (1/3) gives the expected answer of -2.  If I add a parenthesis around the initial number, (-8) ** (1/3) I get an unexpected answer of NaN.  If I save my initial number in a variable: my $number = -2 * -2 * -2; $number ** (1/3) I get a $number of -8 21:20
as expected, but the full expression becomes NaN.  What should I try, so I can get a cube root of a calculation?
ToddAndMargo Do I hvae some booboo's here: 21:21
sortiz Ah, In NC CArray and CStruct are passed by reference, i.e. as parameterized pointers. BTW, in NC LPSTR can use a simple Str, passed by reference also.
ToddAndMargo constant CPOINTER := uint32;
constant HANDLE   = Pointer[void];
constant LPSTR    = CArray[BYTE];
constant LPWCTSTR = CArray[WCHAR];
sortiz In Windows NEVER consider HANDLE a Pointer, it it almost everywhere opaque. 21:24
Use a simple uint of a proper size. And pass it as native int. 21:25
ToddAndMargo That explains some things.  Would handle be a uint32 or uint64?  I have to work in both 32 bit and 64 bit Windows 21:28
sortiz You should not attempt to deref it. Get the HANDLE, use(pass) the HANDLE, and dispose(pass) it to proper sub.
21:31 ToddAndMargo left 21:32 ToddAndMargo joined
ToddAndMargo dang!  I somehow managed to crash Firefox 21:32
I will look at the logs
kolibrie m: -8 ** (1/3)
camelia WARNINGS for <tmp>:
Useless use of "-" in expression "-8 **" in sink context (line 1)
kolibrie m: say "{-8 ** (1/3)}" 21:33
camelia -2
kolibrie m: say "{(-8) ** (1/3)}" 21:34
camelia NaN
kolibrie What should I try so I can get the cube root of an expression in parenthesis? 21:35
sortiz m: use NativeCall; constant ptrsize is export = nativesizeof(Pointer); say "My ptr size", ptrsize; constant intptr is export = ptrsize == 4 ?? uint32 !! uint64;
camelia My ptr size8
sortiz You get the idea.
21:40 thundergnat joined
thundergnat m: say (-8.Complex) ** (1/3) 21:41
camelia 1-1.732050807568877i
thundergnat Raku doesn't automatically promote (coerce?) to Complex. 21:42
ToddAndMargo During my Firefox crash, did someone answer my 32 bit and 64 bit Windows HANDLE question?  Would you mind repeating it?
sortiz m: use NativeCall; constant ptrsize is export = nativesizeof(Pointer); say "My ptr size is ", ptrsize; constant HANDLE = ptrsize == 4 ?? uint32 !! uint64; 21:45
camelia My ptr size is 8
ToddAndMargo You guys are confusing me.  I though HANDLE was not a pointer 21:47
sortiz Read the code above, HANDLE is an uint32 or uint64, not a Pointer. 21:48
ToddAndMargo I also do not understand what ?? and !! are.  And when yo say "size" do you mean bytes? 21:49
sortiz ?? and !! are basic raku stuff 8-) and yes, 'size' means bytes. 21:50
ToddAndMargo I am a total beginner.  Would you please explain ?? and !!.  I will write it down for the future 21:51
kolibrie thundergnat: That is interesting.  I'm not sure if that is giving the answer I am looking for, still, because the cube root of -8 is -2, and I am not sure whether 1-1.732050807568877i is the same as -2. 21:52
tirnanog the same as ? and : in perl5 (and others). tenary.
thundergnat ToddAndMargo: docs.raku.org/routine/%3F%3F%20!!
ToddAndMargo Ha!  I love it!  Thank you! 21:53
lizmat eh, my client didn't include the !! in the url 21:54
defaultxr is there some way to load an arbitrary file of raku code? i don't want to make a module if possible, i'm just writing a script and i want to load its subroutines/variables/etc at the repl so i can test them interactively
Geth Raku-Steering-Council/main: 9637c1b47d | (Daniel Sockwell)++ | papers/coc_incident_response_guide.md
Add response option: ≤ 48hr ban by one CAT member

This commit adds the points discussed at a previous RSC meeting:
   * CAT should share passwords needed to ban someone
   * CAT members should exchange phone #s
   * CAT can treat someone as abstaining if they don't respond in 48hrs
   * Any CAT member can issue a 48 hr ban without needing to discuss
   with the full group.
Raku-Steering-Council/main: 9ccb0d4554 | (Daniel Sockwell)++ (committed using GitHub Web editor) | papers/coc_incident_response_guide.md
Merge pull request #51 from codesections-forks/Incident-Response

Add response option: ≤ 48hr ban by one CAT member
thundergnat kolibrie: You aren't wrong. There are three cube roots of -8. -2 is one but apparently not the one returned by Raku :/ 21:57
kolibrie Hmm. How do I get the one I want?
defaultxr oh, nevermind about my question; i just found EVALFILE (it seems the doc.raku.org search is case-sensitive?) 21:58
wait, it's not... not sure why it didn't work before 21:59
[Coke] if you hit enter too quick, you get the first thing in the list 22:00
thundergnat A kind-of cheaty way would be to not enclose the negative number in parens.
m: say -8 ** (1/3)
camelia -2
thundergnat But that not actually taking the root of negative 8. 22:01
22:01 ToddAndMargo left
kolibrie thundergnat: I noticed that it works if I don't use parenthesis.  However, I don't actually know what my number is, because it is the result of a calculation (thus I'm using parenthesis). 22:04
[Coke] I think you'd need a library or custom function to get the two complex roots.
Nemokosch hi, seems like I'm late to the party. Could you please recite what the original code/context was?
kolibrie m: say (-8).roots(3) 22:05
camelia (1.0000000000000002+1.7320508075688772i -2+2.4492935982947064e-16i 1.0000000000000002-1.7320508075688772i)
[Coke] ... oh, or you could use that builtin thing I forgot about. :)
kolibrie I don't know how to use that.
22:05 sgrs joined
[Coke] I see that it's got rounding issues, unsurprisingly. 22:05
I eagerly await someone implementing ComplexRat. 22:06
Nemokosch 😄
kolibrie If I have a calculator, and I type in -8 and then the cube root button, I get -2. I want to know how to do that in raku, but when the -8 is really something like (-2 * -2 * -2). 22:07
[Coke] m: 8.roots(3) #this one's closer. :)
camelia ( no output )
Nemokosch was ** (1/3) also inaccurate?
[Coke] m: say 8.roots(3) #this one's closer. :)
camelia (2+0i -0.9999999999999996+1.7320508075688774i -1.0000000000000009-1.7320508075688767i)
kolibrie m: -8 ** (1/3) 22:08
camelia WARNINGS for <tmp>:
Useless use of "-" in expression "-8 **" in sink context (line 1)
Nemokosch interestingly, sqrt can return exact values even in the Num type 22:09
kolibrie m: say "{-8 ** (1/3)}"
camelia -2
kolibrie That works fine.
Nemokosch do you have anything against it?
kolibrie But if I add a parenthesis is does not give me a number.
guifa THat's because -8 ** (1/3) is actually
[Coke] docs.raku.org/routine/roots - why does this example subtract the roots from 16. What is this trying to show?
guifa (- ( 8 ** (1/3))) 22:10
but maybe I'm wrong
thundergnat m: say (.abs ** (1/3)) * .sign for -8, -6, 8, 4.5; # a little verbose but only the real cube roots
camelia -2
guifa [Coke] The goal is to show how close the approximattion is, I guess 22:11
[Coke] guifa: no, that's right. the negative is applied to the result in the one that "works". I don't see anything in the docs warning about negatives on the LHS of **
guifa The docs state that roots "produces a list of $n Complex $n-roots, which means numbers that, raised to the $nth power, approximately produce the original number."
thundergnat ** binds tighter than prefix negation 22:12
[Coke] guifa: ... oh. it's showing the root raised to 4th power, my bad.
Nemokosch > (-8) ** (1/3) # NaN 22:13
you mean this?
it seems to me that rational exponents aren't defined for negative numbers at all 22:14
kolibrie With all this discussion, I think I have a workaround. 22:15
thundergnat Like I said earlier, Raku doesn't automatically promote to Complex.
kolibrie m: my $negative = (-8) == (-8).abs ?? 1 !! -1;
camelia ( no output )
kolibrie my $abs = ((-8).abs ** (1/3)) * $negative;
say $abs;
[Coke] m: say (8+0i) ** (1/3)
camelia 1.9999999999999998+0i
[Coke] m: say (-8+0i) ** (1/3)
camelia 1+1.732050807568877i
Nemokosch kolibrie there is the sign method
thundergnat kolibrie: Did you see my snippet above?
[Coke] wonders if we have a wolframalpha shim yet. 22:16
Nemokosch > m: say (.abs ** (1/3)) * .sign for -8, -6, 8, 4.5 # the snippet above
kolibrie thundergnat: Yes, but I did not understand it enough to know how to use it.
thundergnat It's pretty much what you had but using the built-in .sign method. 22:17
Nemokosch (-8).sign * ((-8).abs ** (1/3)) 22:18
does this help to follow?
thundergnat m: say .sign * .abs ** (1/3) given -8
camelia -2
guifa [Coke] anton has been working on it
[Coke] ++anton
22:18 ToddAndMargo joined
ToddAndMargo I still have not got the HANDLE thing down yet.  vpaste.net/9mOIT 22:19
kolibrie m: say (-8).sign * (-8).abs ** (1/3)
camelia -2
kolibrie Okay. That works.  A bit convoluted, perhaps, but if I can get the answer I expect, then it will be sufficient. 22:20
Thank you all for your help!
Nemokosch 🍬 22:21
kolibrie sub cube-root(Numeric $value) { 22:22
    given $value { return .sign * .abs ** (1/3) }
ToddAndMargo This works.  Why?  # my HANDLE $Handle = 0; 22:23
my $Handle = WTSOpenServerA $lpBuffer;
and WHAT fails me: 22:29
my $Handle = WTSOpenServerA $lpBuffer;
print "Handle.WHAT = <" ~ $Handle.WHAT ~ "\n";
my $Handle = WTSOpenServerA $lpBuffer;
print "Handle.WHAT = <" ~ $Handle.WHAT ~ "\n";
forget that last bad paste
my $Handle = WTSOpenServerA $lpBuffer; 22:30
print "Handle.WHAT = <" ~ $Handle.WHAT ~ "\n";
thundergnat Could more concisely be: sub cube-root(Numeric $_) { .sign * .abs ** (1/3) }
ToddAndMargo It did it agai
Use of uninitialized value of type NativeCall::Types::Pointer[NativeCall::Types::void] in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at PopUpTest3.pl6 line 76
I had to paste to a Leaf pad and then recopy to get it here.  ARG! 22:31
kolibrie thundergnat: Oh, I did not know you could set $_ in a signature like that. That is shorter. 22:35
22:36 NemokoschKiwi joined
ToddAndMargo constant HANDLE   = Pointer[NativeCall::Types::void];    removes the error 22:36
thundergnat 👍 Not always a great idea to set the topic variable as a subroutine parameter, but there are times when I think it is worth it. 22:38