🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:00 guifa2 joined
guifa2 hmmm 00:00
[Coke] Asking here's a good start, but many of our contributors are closer to EET than EST. 00:01
00:02 squashable6 left
[Coke] RSC is here: github.com/Raku/Raku-Steering-Council, overall project issues here: github.com/Raku/problem-solving (latter may have some marketing style items under issues) 00:02
guifa2 very interesting how say works 00:03
m: &say.wrap(method (|c) { put c.list }); say 'testing';
guifa2 err, duh, I used it as a method. nm
00:04 squashable6 joined 00:12 mowotter left
raku-bridge <Murilo> Thanks Coke, I'll look into it 00:24
00:31 marcusr left 00:38 sivoais left
tony-o moon-child: you can do that with feed 00:38
00:39 wamba left
tony-o m: <1 0 1>==>{.sum,+$_}()==>say() 00:39
camelia (2 3)
moon-child tony-o: ohhh, I need the () at the end of the pointy block
tony-o m: print() <=={.sum,+$_}() <==<1 0 1> 00:40
camelia 2 3
00:42 marcusr joined
tony-o seems a bit like haskells `.`, if you're familiar with that. if not then maybe with function composition in math 00:43
00:43 sivoais joined 00:44 pecastro left
tony-o if you're not familiar with haskell don't bother, it'll just confuse that more 00:44
00:46 nebuchadnezzar left 00:47 tejr left 00:49 tejr joined 01:12 jmchael left
elcaro technically, `infix:<∘>` is - literally - like haskell's `.` :D 01:13
01:24 Garbanzo_ left 01:28 Garbanzo_ joined
tony-o m: &say ∘ &{$_+1} ∘ 1..5; 01:45
camelia WARNINGS for <tmp>:
Useless use of ".." in expression "∘ 1..5" in sink context (line 1)
Type check failed in binding to parameter '<anon>'; expected Callable but got Int (1)
in block <unit> at <tmp> line 1
tony-o oops
hmm 01:46
need to go read about that one
perry Wow, that's a rude warning 01:48
01:48 gnufr33dom joined
perry m: (&say ∘ &{$_+1})(1..5) 01:51
camelia 23456
perry :D
01:58 rindolf joined
elcaro if I recall correctly... `callsame` (and friends) have some overhead, and often for recurive calls, simply calling the sub by name would be slightly faster 02:01
ie. sub foo($bar) { foo($bar) if baz($bar) } <- calling `foo` here is preferable to `callsame` 02:03
i wonder if it's as fast as calling `&?ROUTINE($bar)` inside foo.
my guess is that `&?ROUTINE is defined at compile time, so there should be no name lookup penalty, and hence, the faster option 02:04
obviously, we're probably down to the point of micro-benchmarks, but anyone know if my intuition is correct here? 02:05
guifa2 elcaro: I *think* that is the case. IIRC lizmat is planning a fairly substantial reworking of that stuff 02:26
RaycatWhoDat Hmm
guifa2 fwiw, I use those fairly extensively etc with DateTime::Timezones, and in practice, I don't think it's substantial enough to worry about unless it used in a very hot loop 02:27
02:30 kvw_5_ joined 02:34 kvw_5 left 02:41 marcusr left 02:43 marcusr joined 03:06 Garbanzo_ left 03:07 Garbanzo joined 03:16 guifa2 left 03:18 sortiz left 03:23 kini left 03:24 kini joined 03:30 kini left, kini joined
moon-child that's odd, I would expect callsame to be faster 04:40
(or at least, not slower) 04:41
in clojure 'recur' is used to do TCO, since the jvm doesn't do it natively
04:52 b2gills left 04:53 b2gills joined, Manifest0 left, Manifest0 joined 05:05 Garbanzo left 05:06 brtastic joined 05:08 kaiwulf left
elcaro moon-child: There's no TCO in Raku. also, `callsame` still might call a different multi 05:51
i'm no export, but from memory there's some different dispatch logic in different places. There are plans to unify (and optimise) dispatch in future 05:52
point is, both `multi foo { foo() }` and `multi foo { callsame() }` have to resolve the multi 05:55
&?ROUTINE is the _current_ routine you are in, so calling it should not require an multi resolution, so presumably should be faster 05:56
but as guifa2 said... unless it's a hot loop, the different is likely to be pretty negligible 05:57
06:08 linkable6 left, evalable6 left 06:09 evalable6 joined 06:11 linkable6 joined, jmerelo joined
xinming_ m: "abc".split(""); 06:17
camelia ( no output )
xinming_ m: "abc".split("").raku.say; 06:18
camelia ("", "a", "b", "c", "").Seq
xinming_ In this case, what is the right way to split a string in between without the surrounding ""?
I know I can remove head and tail "", But quite strange to me
moon-child m: print "abc".comb 06:20
camelia a b c
06:31 sono__ left, sono__ joined 06:35 Sgeo left 06:58 ufobat_ joined
elcaro xinming_: also read docs for comb... super-useful 06:58
m: say 'together'.comb
camelia (t o g e t h e r)
elcaro m: say 'together'.comb('t')
camelia (t t)
elcaro m: say 'together'.comb(/<[aeiou]>/)
camelia (o e e)
elcaro m: say 'together'.comb(2)
camelia (to ge th er)
07:13 wamba joined 07:14 domidumont joined 07:17 parabolize left 07:24 nebuchadnezzar joined
elcaro bisectable6: say 'together'.comb('t'|'e') 07:29
bisectable6 elcaro, Will bisect the whole range automagically because no endpoints were provided, hang tight
elcaro, Output on all releases: gist.github.com/2cb49a40b910a85458...c60aa284d9 07:30
elcaro, bisect log: gist.github.com/ea3f589a81c68697c9...c9810198b1
elcaro, Output on all releases and bisected commits: gist.github.com/c04bb92698a91df137...8442e43584
07:31 sjm_uk joined
xinming_ elcaro: thanks 07:34
08:14 MasterDuke joined 08:22 notandinus left 08:23 mattsim joined 08:25 andinus joined, andinus is now known as Guest52717 08:27 Guest52717 left 08:32 dakkar joined 08:39 gnufr33dom left 08:41 gnufr33dom joined 08:42 mattsim left 08:45 Scimon joined 09:00 andinus joined 09:10 eseyman left 09:14 eseyman joined 09:17 pecastro joined 09:32 MasterDuke left 09:35 Black_Ribbon joined 09:37 sono__ left 09:41 b2gills left 09:44 gnufr33dom left 09:46 JRaspass joined 09:59 dakkar left, dakkar joined 10:13 MasterDuke joined 10:18 Kaiepi joined 10:24 Kaiepi left
lizmat elcaro: that is actually jnthn working on that, as part of the newdisp branch 10:27
&ROUTINE appears to codegen as nqp::getcodeobj(nqp::curcode))
10:33 Kaiepi joined 10:41 Xliff joined 10:44 thundergnat left 11:10 mowotter joined 11:18 Black_Ribbon left 11:28 PimDaniel joined
PimDaniel Hi , i'm reading the reference about objects and classes, which i should have done before probably. 11:29
I'm wondering what happens if i write : has Int $mynumber; into a class? with no $. nor $!. 11:31
11:35 patrickb joined
PimDaniel It seams that in this case $!name == $name but since has $name is a possibility, how does it behave? Each possibility being potentially a bug, i wonder... , thank's! 11:35
patrickb o/
elcaro lizmat: I thought it was... tho it was guifa who namedropped you :)
patrickb tony-o: Nice article! Two more points you could mention:
tony-o: 1. CPAN is cumbersome to use. Especially the registration via PAUSE has shown to hinder and in some cases even block people from using it. 11:36
tony-o: 2. The old p6c indexer keeps versions volatile if the source URL is non static. This caused many many problems with people being unable to update a module ("already up to date"), because the version number wasn't bumped. Other people mostly can't reproduce, because they didn't have the module installed before.
elcaro PimDaniel: It might be the same as just declaring `my Int $mynumber`, ie. a lexical variable available to each instance of the class
PimDaniel: I'm not 100% sure, tho... will need to try it out
actually, yes and no. I was right... and wrong. I'll explain 11:38
PimDaniel elcaro: thank's, but logically, my should not refer to class attribute : juste scope ..., no?
elcaro so `has` is lexical to each instance. `my` seems to be shared 11:41
m: class A { has $x; method set ($a) { $x = $a }; method get { $x } }; my $n = A.new; my $m = A.new; $n.set(1); say $m.get;
camelia (Any)
elcaro that's with `has`. now with `my`
class A { my $x; method set ($a) { $x = $a }; method get { $x } }; my $n = A.new; my $m = A.new; $n.set(1); say $m.get;
evalable6 1
PimDaniel I tried what you try before asking. 11:42
elcaro docs.raku.org/language/classtut#Static_fields? 11:43
PimDaniel A has variable without . nor ! has indeed no getter/setter, but is a class attribute.
11:43 ufobat__ joined
PimDaniel elcaro: thank's for the link :) 11:44
But i've read it yet for most. 11:46
11:47 ufobat_ left
PimDaniel Well the question is still opened. 11:49
In fact what's the difference between : has $name; and has $!name; ? 11:50
may be none: may be $!name means "not $." , means no accessors/getters. 11:51
elcaro yeah, it may be nothing. remember there isn't really a variable `$.x`. when you declare `has $.x`, you still generally refer to it as `$!x` when accessing it inside the class 11:53
again, i'm not an authority on this, maybe i'm talking out of my proverbial behind
but potentially `$!x` doesn't really "exist" either... maybe it's just `$x` with a twigil to remind you it's a class attribute and not a lexical var 11:54
PimDaniel Yes but:
All class attributes are $!name. when you say $.name : you say $!name + setters/getters. 11:56
elcaro ahh but 11:57
m: class M { has $!x; has $x }
camelia ===SORRY!===
Package 'M' already has an attribute named '$!x'
elcaro it's the same variable
PimDaniel Tooo yes!
elcaro the `!` is just a signifier
a "label", if you will... to remind you "hey, I'm a class attribute... not a plain ol' lexical var" 11:58
MasterDuke m: class A { has $b; }; say A.^attributes
camelia (Mu $!b)
PimDaniel Is the same! thank's MasterDuke! 12:00
elcaro and also allows using a lexical var in methods with name collisions
eg: class A { has $!x; method set($x) { $!x = $x } }
PimDaniel But i think this is dangerous confusion when you have my local vars in inner scope: 12:01
elcaro dangerous, how?
andinus can i randomize an array? i'm trying to write a grid walker that walks in random directions and marks the path 12:02
tellable6 2020-12-04T10:23:58Z #raku <notandinus> andinus hi
12:02 aborazmeh joined, aborazmeh left, aborazmeh joined
PimDaniel you can refer to $!name as $name when there is no my local var in inner scope! 12:02
andinus .tell notandinus hi
tellable6 andinus, I'll pass your message to notandinus
elcaro andinus: like shuffle an array? @a .= pick(*)
andinus yeah shuffle it, thanks elcaro 12:03
PimDaniel s/dangerous/confused/
elcaro PimDaniel: you can do a lot of things in Raku I think you shouldn't do :D
TIMTOWTDI is a double-edge sword
PimDaniel Of course!
elcaro just like Perl, there are a couple different ways to phrase something... I strive toward the most readable / least confusing. 12:06
or at least, I try to
andinus also, is it good practice to use := everywhere but = when required? 12:07
lizmat andinus: I think it is, as it signals immutability
andinus i see, ralph had suggested it in perl6-users@ 12:08
PimDaniel is perl6-users a newsgroup? 12:10
lizmat no, it's a (very old) mailing list 12:12
PimDaniel haaa ok!
Is it still active? for who? 12:13
andinus yeah it's active
i mean i joined last week, there were 2 threads since then 12:14
12:14 aborazmeh left
andinus lists.perl.org/list/perl6-users.html 12:15
PimDaniel I use only ascii mail, news apps on my pc. slrn, irssi, mutt.
lizmat It's not as active as it used to be... in the Rakudo Weekly News there are weeks without interesting threads, and sometimes there 2 or 3 threads of interest / week
PimDaniel lizmat: okay!
i did not find a raku newsgroup on nntp :( is there one? 12:16
All experts are here anyway, let's say expert enought for me! 12:18
see you later! 12:19
12:19 PimDaniel left, aborazmeh joined, aborazmeh left, aborazmeh joined
elcaro hrm... Dateish `.later` and `.earlier` should support multiple pairs, ie. DateTime.now.later(:1hour, :30minutes) 12:20
Pythons datetime.timedelta allows this, eg. timedelta(hours=1, minutes=30) 12:21
maybe i'll have a look and - if it's not too complex - look into writing a PR 12:22
lizmat elcaro: good point! Please make at least an issue for this
and a PR would be nice!
elcaro will do 12:23
12:26 Xliff left 12:31 aborazmeh left 12:32 patrickb left 12:33 tib joined 12:34 aborazmeh joined, aborazmeh left, aborazmeh joined 12:35 MasterDuke left 12:36 MasterDuke joined 12:37 JRaspass left 12:38 Voldenet left 12:44 Voldenet joined, Voldenet left, Voldenet joined 12:48 mowotter left 12:51 PimDaniel joined, aborazmeh left
PimDaniel sub one(Int); or sub one_arg(@); how do i access these sub arguments? 12:52
moritz what do you mean by "access"?
PimDaniel inside the sub.
i can't 12:53
moritz well, then you should give them a name
sub one(Int $x) { say $x + 5 }
that's what names are for :D
PimDaniel so why can we do that without names ,call them and it does not complains? 12:54
moritz because there are valid use cases for when you only want to rely on dispatch to make decisions for you
multi sub classify(Int) { 'number'}; multi sub classify(%) { 'compound' } 12:55
Scimon :D
PimDaniel wait : i translate your 1st sentence...
moritz with only subs (not multi) it doesn't make that much sense, usually
12:56 sena_kun joined
PimDaniel ok i see! 12:56
very usefull to make checks! 12:57
moritz github.com/moritz/json/blob/master...iny.pm#L50 this is a real-world use case
json serializing through multi subs
PimDaniel moritz: thank's! 12:58
13:12 jmerelo left
elcaro PimDaniel: it's also useful when you want to ignore args 13:17
sub first-two($one, $two, *@) 13:18
or, sub one-and-three(*@ [$one, $, $three]) { ... }
13:18 cono left 13:19 wamba left 13:21 MasterDuke left 13:23 MasterDuke joined
tbrowder howdy, folks: o/ 13:28
13:29 Sgeo joined
tbrowder i want to build an %opt hash in order to assemble only defined arg/value pairs to another function being wrapped. 13:30
say i have two named args ":$x, :$y" 13:31
13:32 Xliff joined, maggotbrain left
tbrowder i want to put them and their value in %opt only if they are defined, so how to do it? 13:32
PimDaniel elcaro: thank's! 13:33
tbrowder %opt<:$x> = $x if $x.defined
elcaro how about just something like: %opt ,= :$x if $x.defined; 13:34
tbrowder ok
13:34 maggotbrain joined
tbrowder m: my %opt; %opt ,= $x if $x.defined 13:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3my %opt; %opt ,= 7⏏5$x if $x.defined
PimDaniel back later... 13:36
13:36 PimDaniel left
tbrowder m: my $x; my %opt; %opt ,= $x if $x.defined 13:36
camelia ( no output )
moritz you likely want :$x 13:37
tbrowder elcaro: thanks!
yes, moritz, so that was why i was using <> but not real sure 13:38
elcaro m: sub p(:$x, :$y) { my %opt; %opt ,= :$x if $x; %opt ,= :$y if $y; %opt }; say p(:1x); say p(:2y); say p(:2x, :3y)
camelia {x => 1}
{y => 2}
{x => 2, y => 3}
elcaro obviously that example checks for truthiness, not definedness... but you get the point 13:39
you could also construct the hash anonymously 13:41
m: sub p(:$x, :$y) { %((:$x if $x),(:$y if $y)) }; say p(:1x); say p(:2y); say p(:2x, :3y)
camelia {x => 1}
{y => 2}
{x => 2, y => 3}
tbrowder ok, thanks, i'll go try it. bye 13:42
13:43 jmchael joined 13:45 sena_kun left, sena_kun joined
andinus is specifying `unit module App::CLI' not required? 13:52
i have a module lib/App/CLI.rakumod and importing it works without that unit module line 13:53
MasterDuke `unit` just means the whole file is the scope, you don't need to use `{...}`. saves a level of indenting 13:55
andinus i mean it works without even 'unit' 13:56
tbrowder i'm back with success. the required wrapped func call has to look like this: "foo $text, |%opt". 14:04
where %opt has named args with defined values. for each :$arg i did this: "%opt 14:06
%opt<:$arg> = $arg if $arg.defined
14:07 gnufr33dom joined
tbrowder and that worked. thanks moritz and elcaro 14:07
14:11 aborazmeh joined, aborazmeh left, aborazmeh joined 14:28 wamba joined 14:35 tib left 14:42 v_m_v joined
dakkar m: sub x($thing,*%a) { my %b = %a.pairs.grep(*.value.defined); return ($thing,%b) }; say x('foo',:a,:b(2),:c(Nil)); # tbrowder ? 14:47
camelia (foo {a => True, b => 2})
14:49 TheAthlete joined, aborazmeh left 14:53 MasterDuke left 14:54 MasterDuke joined
tbrowder dakkar: thnx, but the sub i'm wrapping isn't mine, so i have to use it as is. 14:56
later, bye
15:00 Kaiepi left 15:05 kaiwulf joined 15:19 ThaEwat left, JJAtria[m] left, CIAvash left, MitarashiDango[m left, unclechu left, AlexDaniel` left, MitarashiDango[4 left 15:20 kiti_nomad[m] left, matiaslina left, parabolize joined
xinming_ SmokeMachine: ping 15:22
SmokeMachine xinming_: pong 15:23
xinming_ SmokeMachine: For a red column, is there a way to the get raw data from the column? I mean without converting to Str
SmokeMachine: I met a problem where the column is large(around 2~3M), which is processed html fragment. And today I learnt that when we load the data as Str, raku will do decode to utf-8, and when we send it over the network, We'll need to encode the utf-8 Str to binary. 15:26
15:27 [Sno] left, kiti_nomad[m] joined
xinming_ now, I have a temp sollution, which is saving the fragment into a file, and do .slurp(:bin), and send the slurped-file directly. Which is much faster. 15:28
But still, I wish I can remove the convertion on the Red side too.
15:30 b2gills joined 15:34 AlexDaniel` joined, unclechu joined, ThaEwat joined, MitarashiDango[m joined, matiaslina joined, CIAvash joined, JJAtria[m] joined, MitarashiDango[4 joined
SmokeMachine xinming_: maybe you could load that as Blob fro db? I’ve never done anything like that with Red... but I think it would be possible... 15:37
xinming_ SmokeMachine: Yea, that's what I meant. But I think Red should probably provide a option to allow user to access the blob directly?
15:39 Kaiepi joined
SmokeMachine xinming_: if you do `has Blob $.col is column{ :inflate{ Blob.transform-db-data: $_ }, :deflate(&from-blob-to-db) }` or something like that, I think it should work 15:41
xinming_: you can use inflator to access the data 15:42
xinming_: please, let me know if that did the trick 15:48
xinming_ SmokeMachine: I'm trying, How do we get the $object? 15:49
use `self`?
tbrowder dakkar: or i don't understand how that helps me. :-) 15:55
15:56 aluaces left
SmokeMachine xinming_: I think so 15:56
tbrowder i also like to keep my code understandable after a long layoff--my memory isn't as good as it shoud be and raku is yuge!
16:00 MitarashiDango[4 left
xinming_ SmokeMachine: Use Blob without inflate & deflate worked. 16:00
I think I'll add another attribute to mean "decoded" value. 16:01
SmokeMachine :)
xinming_: is it faster now?
16:01 JRaspass joined
SmokeMachine xinming_: someday I’d love to read your code using Red... 16:02
16:03 abraxxa left
xinming_ SmokeMachine: yea, much faster on larger columns 16:08
I never release a whole project yet, as what I've done most time is half finished project.
SmokeMachine xinming_: even though... you have so many interesting questions about how to do stuff on Red... 16:11
xinming_ I don't know the right way to do something, But I do have a feeling about what sollution is "natural" to me 16:14
dakkar tbrowder: if you have a `sub something($thing, $:named, $:other)` and you want to wrap it so it ignores named arguments with undefined values, you could do: 16:16
tbrowder: `sub something_wrapped($thing, *%named) { my %args = %named.pairs.grep(*.value.defined); return something($thing, |%args) }` 16:17
16:18 natrys joined 16:25 _jrjsmrtn joined, __jrjsmrtn__ left 16:27 JRaspass left 16:30 Sgeo_ joined 16:33 Sgeo left
tbrowder dakkar: ah, now i think i see, thanks, i'll give that a try! 16:34
[Coke] m: say round(1000, .01); say round(1000, 23.01) 16:36
camelia 1000
[Coke] it is intentional that the scale there is used as is, and not (as I originally expected) just the sigfigs?
tbrowder dakkar: the only thing complicating the situation is only a subset of the wrapping sub args are used in the wrapped sub. also, those args unknown to the wrapped sub are transformed into args that are known. 16:40
[Coke] assumes so 16:41
dakkar tbrowder: ok, then your use-case is more complicated and treating each argument separately may well be the best approach
16:41 sno joined
tbrowder my solution i ithink is to have a private method or local sub to do that trans and return the proper %opt. 16:41
and use yr idiom in the process. thnx so much! 16:42
dakkar [Coke]: wow, I wasn't expecting that! "round to the closest multiple of $x"
16:42 jmerelo joined
dakkar tbrowder: you're welcome 16:42
16:45 [Sno] joined 16:46 sno left 16:51 gnufr33dom left 16:54 Tirifto[m] joined 17:07 JRaspass joined 17:08 MasterDuke left 17:09 TheAthlete left, kaiwulf left 17:20 aluaces joined 17:23 v_m_v left 17:29 Scimon left 17:31 dakkar left 17:47 Altai-man_ joined, sena_kun left
[Coke] ENOGETH? 17:48
17:53 jmerelo left 17:54 jmerelo joined 18:09 lucasb joined 18:13 domidumont left
Tirifto[m] Well, this is interesting! 18:27
Modifying the ‘RAKULIB’ environment variable at runtime will have Raku look for modules in the inserted paths, but only if no modules are being ‘use’d anywhere in the program. 18:31
I suppose that’s an example of Raku being lazy? :)
18:46 ufobat__ left 18:53 jmerelo left 18:56 TheAthlete joined 19:01 TheAthlete left 19:02 PimDaniel joined
PimDaniel sub cinq($a where ($a.elems == 2),$b where ($b.elems == 2)){ 19:03
but i need to check each element of each list is an Int.
and where all(@$b.WHAT ~~ Int) ? 19:05
19:18 sjm_uk left 19:20 patrickb joined 19:28 timeless left, rjeli left, rjeli joined, timeless joined
[Coke] m: my @a = 1,2,3; my @b=1, 2, 'a'; sub a(@b where all(@b) ~~ Int) { dd @b; }; a(@a); a(@b); 19:34
camelia Array @a = [1, 2, 3]
Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, "a"])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] You can also make a subset to avoid repetition.
You can also type the Array: my Int @a = 3,4,5;sub a(Int @b) { dd @b }; a(@a); a(<a b c>); 19:37
I imagine typing the Array is the most efficient check, but then you *have* to type the Array on creation. docs.raku.org/language/list#Typing
We need to make this a FAQ because we answer it once a week. :) 19:38
19:38 mowotter joined
PimDaniel Coke: thank's! Yess that's what i search now! 19:40
19:41 RaycatWh` joined 19:42 RaycatWh` is now known as Raycat|Work
Raycat|Work imgur.com/a/Y5LkFQh 19:42
^ I encounter this error whenever I try accessing docs.raku.org
And this happens on all of my devices
[Coke] Can you get it to show the actual security issue it's complaining about? 19:43
PimDaniel Raycat: no problem here!
Raycat|Work [Coke]: How can I access that?
[Coke] my chrome says the cert is OK.
PimDaniel ho sorry 19:44
[Coke] does clicking on the (i) in the url bar show anything?
PimDaniel no i confirm it works!
Raycat|Work imgur.com/y0Gew0p 19:45
PimDaniel My browser is google-chrome : i do not see i on the url bar.
[Coke] Raycat|Work: ok that looks like it's just saying the connection isn't secure but in different words.
yes, if you make a secure connection, you get the lock icon 19:46
Raycat|Work I sometimes get the lock
Lemme try reproducing that
PimDaniel but url starts with https and i see a cadenas.
[Coke] Raycat|Work: is your system clock up to date? 19:47
s/up to date/correct/
www.thesslstore.com/blog/fix-err-s...col-error/ has that and some other suggestions.
Raycat|Work Yeah, more or less
Dunno how accurate it has to be
If I go to docs.raku.org, I eventually get through 19:48
Then that redirects to https
I got it 19:53
PimDaniel Coke: when invoquing caller this way cinq (2,3), (4,5) : sub cinq(Int @a where @a.elems == 2,Int @b where @b.elems == 2){ ==> Type check failed in binding to parameter '@a'; expected Positional[Int] but got List ((2, 3)) 19:54
Raycat|Work I just cleared all of my browsing history/data
PimDaniel (2,3) is a List not an Array.
or is it another problem? 19:55
[Coke] if you are passing in the args yourself and not creating a typed array first, then you'll need the where / subset syntax.
PimDaniel how? 19:56
[Coke] m: my @a = 1,2,3; my @b=1, 2, 'a'; sub a(@b where all(@b) ~~ Int) { dd @b; }; a(@a); a(@b);
camelia Array @a = [1, 2, 3]
Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, "a"])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] ^^
19:57 marcusr_ joined
[Coke] then you don't need a particular container type. 19:57
(but it will also check each element when invoking the sub)
PimDaniel it's a constraint for me : when i call my sub with ... heu not sure in fact. 19:58
yes yes yes
SmokeMachine xinming_: and that helps Red a lot! 19:59
PimDaniel I cannot this have a caller with literal lists.
I cannot this way have a caller of litteral list: I must declare an array 1st which is a small constraints for test. 20:00
[Coke] m: my @a = 1,2,3; sub a(*@b where all(@b) ~~ Int) { dd @b; }; a(1,2,3); a(1,2,'3'); 20:02
camelia Array element = [1, 2, 3]
Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, "3"])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] ^^ use a slurpy arg if you want to have an arbitrary number of positionals pulled into a single array arg.
That work? 20:03
PimDaniel Coke: where do you use the @a Array that you declare first? 20:04
why sub a and array a : what do you try to demonstrate? 20:05
[Coke] PimDaniel: nowhere, it was a holdover from the previous version.
I am lazy and picked short names, that's all
m: sub a(*@b where all(@b) ~~ Int) { dd @b; }; a(1,2,3); a(1,2,'3');
camelia Array element = [1, 2, 3]
Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, "3"])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] there, less cruft.
PimDaniel ok don't mind! 20:06
does not work this way : sorry! :(
will work with a list : i tried to put the same constraints on a list but without success :(. 20:07
I have 2 constraints : 1st : Each List has == 2 elements , 2 Each element of Each List is an Int. 20:09
[Coke] can you show a sample of code not working?
PimDaniel Not at the moment because i changed all the code.
[Coke] m: sub a(*@b where all(@b) ~~ Int and @b.elems == 2) { dd @b; }; a(1,2); a(1,2,3); 20:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> 3sub a(*@b where all(@b) ~~ Int7⏏5 and @b.elems == 2) { dd @b; }; a(1,2);
expecting any of:
infix s…
[Coke] one moment
PimDaniel I'm ok with that but i do not want an array.
I could not do it with a List. 20:11
20:12 Sgeo__ joined
PimDaniel The problem is that we need kindof double typing because List is allready a type. 20:13
20:13 MasterDuke joined 20:14 marcusr_ left
[Coke] can I ask: if you always have two args, why not do ($a, $b) as args? 20:14
esp. if you're doing literals. 20:15
then you have a(Int $a, Int $b)...
20:15 Sgeo_ left
PimDaniel Coke: That's it , you are True. 20:16
It seams to work! 20:19
[Coke] if you didn't need the literals, it'd probably be best to make a class that had the attributes you wanted and use that to enforce invocation. 20:21
PimDaniel I'v just a problem with the and
but each condition separated works pretty well : just a syntaxic typo. 20:22
[Coke] yah, my last example isn't quite right. probably complex enough to warrant using 'subset' instead.
PimDaniel Yes : you did it : just everything must be in the where i think. 20:24
Oui c'est ça! 20:25
I'll paste the code... thank's very mutch!
We must also deploy $b List this way @$b like in Perl5 to check the type. 20:27
here it is : pastebin.com/NPFzDNxQ 20:31
i'm tired, i'll leave, thanks again! 20:32
20:36 marcusr_ joined 20:37 marcusr_ left, PimDaniel left 20:43 Garbanzo joined 20:44 marcusr_ joined 20:45 MasterDuke left 20:51 MasterDuke joined 20:53 melezhik joined 20:56 melezhik left 21:11 jmchael left 21:13 rindolf left 21:21 Quirk joined 21:24 brtastic left 21:33 Quirk left 21:39 Raycat|Work left, wamba left 21:45 sortiz joined 21:49 patrickb left
[Coke] .tell pimdaniel gist.github.com/coke/53cf70ad3bc41...7b8e2b336f - there's a subset variant. 21:57
tellable6 [Coke], I'll pass your message to PimDaniel
21:58 sortiz left 22:08 Altai-man_ left 22:23 sortiz joined 22:25 natrys left 22:59 Black_Ribbon joined 23:04 guifa2 joined
guifa2 I asked a few days ago but don't remember a response. Raku itself is a combination of several different languages, of which we have Q and Regex 23:05
But what do we call Raku's non-Q, non-Regex, 'default' language? 23:06
23:06 finsternis joined
sortiz 'main' language, if I remember well)ç. 23:09
23:16 kaiwulf joined 23:33 aluaces left
sortiz m: BEGIN { for <Regex Quote MAIN> { say "$_ -> " ~ %*LANG{$_}.^name } } 23:41
camelia Regex -> Perl6::RegexGrammar
Quote -> Perl6::QGrammar
MAIN -> Perl6::Grammar