🦋 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.
hythm AlexDaniel: "and Pakku simply depends on a bunch of modules :), yeah, no idea 02:24
how that's going to work, but hey it's in larva stage :)"
Pakku and its dependencies are installed to a custom repository and operates
from outside the Raku env. the only downside to this approach is using a few
extra MBs in the hard disk, but the benefit is great, can use all the goodies
in the ecosystem including all the awesome modules that will be added in the
future, so it should be easy to expand Pakku's features without re-inventing
the wheel..
but may be you seeing downsides that I'm not seeing, can you explain what will not work with this approach? in this case it also should be fairly easy to write helper subroutines for git, curl tar,, (the main dependencies)
Grinnz hythm: this is solved in cpanm for perl by fatpacking, which means all its dependencies are copied into the script for distribution - sounds similar 02:33
mspo mm fatpack 02:34
hythm Grinnz, going to check cpanm, but yeah sounds very similar... but anyway a a custom repository is basically the same thing, having everything installed in one inst# repository, then include this repository or fatpack it to the script 02:36
jmerelo releasable6: status 06:06
releasable6 jmerelo, Next release will happen when it's ready. 1 blocker. 7 out of 441 commits logged (⚠ 9 warnings)
jmerelo, Details: gist.github.com/db637d5ae333fb8ed2...ecd7196813
xkr47 hi guys.. I just wanted to say that I think the wikipedia article on Raku is the best introduction to the language out there.. I several times (years apart) tried to get started with perl6 using the homepage but got turned off by it, but the wikipedia article really hits the sweet spot for me: en.wikipedia.org/wiki/Raku_(progra..._language) and from there moving on with en.wikipedia.org/wiki/Perl_6_rules and then reading synopsis etc 06:21
jmerelo xkr47: thanks! 06:27
xinming_ m: 'my %x; my %y^C= %x.append((x => 4)); %y.perl.say; 11:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3 %y^C= %x.append((x => 4)); %y.perl.say;7⏏5<EOL>
expecting …
xinming_ m: my %x; my %y^C= %x.append((x => 4)); %y.perl.say;
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
C used at line 1
xinming_ m: my %x; my %y = %x.append((x => 4)); %y.perl.say;
camelia {:x(4)}
xinming_ m: my %x; my %y = %x.append(x => 4); %y.perl.say;
camelia {}
xinming_ here, when we use %x.append(x => 4) The example doesn't work, Anyone here expains why? 11:10
m: my %x; my %y = %x.append("x" => 4); %y.perl.say;
camelia {:x(4)}
xinming_ This worked. so, a bit curious, how this can be distinguished. Also, When we try to inflate a %hash, How can we specify it's a "pair", or a named arg? 11:11
xinming_ SmokeMachine: When I create a json column, which is correct? has Hash $.json-column is column{ :deflate{ ... }, :inflate{ ... } }; Is it possible that we use has %.json-column is column{ ... } ??? 11:51
AlexDaniel weekly: (we skipped it in the last weekly) On 2019-10-19 there was a squashathon dedicated to closing tickets that need tests. The winner is Altai-man, who submitted 7 pull requests! Congratulations! 12:40
notable6 AlexDaniel, Noted! (weekly)
AlexDaniel weekly: Next squashathon is currently scheduled on 2019-11-02 (side note: we do them every month, it's just that the one in October drifted a bit closer to the end of the month) 12:41
notable6 AlexDaniel, Noted! (weekly)
AlexDaniel weekly: We accept *your* ideas for squashathons! Do you have a cool Raku project that needs help, and you can provide enough open tickets for potential contributors to work on? Let us know on #raku! 12:43
notable6 AlexDaniel, Noted! (weekly)
xinming_ m: "test-a" ~~ /"test-" ("a")/ && my $x = $0.Str; ("test-a" ~~ $0).Bool.say; ("test-a" ~~ $0.Str).Bool.say; 13:38
camelia True
False
xinming_ Anyone here tells me, when we smart match against a match result. What behaivor it'll be?
moritz m: say ('a' ~~ Match.new).perl 13:43
camelia Match.new(list => (), orig => "", made => Any, from => 0, hash => Map.new(()), pos => 0)
moritz it's the match itself
which is necessary to make things like $var ~~ m/.../ DWIM 13:44
xinming_ m: "test-a" ~~ /"test-" ("a")/ && my $x = $0.Str; ("test-a" ~~ $0).perl.say; ("test-a" ~~ $0.Str).perl.say; 13:53
camelia Match.new(pos => 6, made => Any, from => 5, list => (), hash => Map.new(()), orig => "test-a")
Bool::False
xinming_ m: "test-a" ~~ /"test-" ("a")/ && my $x = $0.Str; $0.perl.say; ("test-a" ~~ $0).perl.say; ("test-a" ~~ $0.Str).perl.say;
camelia Match.new(made => Any, pos => 6, hash => Map.new(()), list => (), orig => "test-a", from => 5)
Match.new(made => Any, from => 5, hash => Map.new(()), list => (), pos => 6, orig => "test-a")
Bool::False
xinming_ m: "test-a" ~~ /"test-" ("a")/; ("test-a" ~~ $0).perl.say; ("test-b" ~~ $0).perl.say; 13:55
camelia Match.new(hash => Map.new(()), orig => "test-a", pos => 6, made => Any, list => (), from => 5)
Match.new(orig => "test-a", hash => Map.new(()), pos => 6, from => 5, list => (), made => Any)
xinming_ m: "test-a" ~~ /"test-" ("a")/; ("test-a" ~~ $0).perl.Bool.say; ("test-b" ~~ $0).perl.Bool.say;
camelia True
True
xinming_ So, ~~ $0, will return the $0 directly.
tbrowder can anyone give an example of a class that does both Associative and Positional role plus allow access to contents like: "$obj<a>" as well as "$obj[3]"? 14:15
such a class is required to fully implement the pod $=data variable according to S26. 14:18
the class will have both an array and a hash attribute, it's just how the provide the [] and <> that stump me. do i add an operator overload in the class? i think i may have done that in an experiment a long time ago but haven't yet found it. 14:21
sena_kun tbrowder, you need to implement methods from Positional and Associative roles 14:25
docs.perl6.org/type/Positional#Met...e_provided and docs.perl6.org/type/Associative#Me...e_provided
so something like:
m: class A does Positional does Associative { method elems { 3 }; method AT-POS(\pos) { 3 }; method EXISTS-POS(\pos) { True }; method AT-KEY(\key) { 3 }; method EXISTS-KEY(\key) { True }; method of { Str } }; say A.new<42>; say A.new[42]; 14:28
camelia 3
3
tbrowder sena_kun: thanks! i forgot about our wonderful docs. i was searching in raw nwp src code and couldn't find anything solid yet.
sena_kun of course, instead of True and `3` you need to actually query your inner data structure
tbrowder great example!! THANKS
sena_kun you are welcome!
tbrowder later.., 14:29
Geth doc: cfa072a239 | (Stoned Elipot)++ | doc/Type/Signature.pod6
Add comma
15:19
Doc_Holliwood m: [1, [2, [3, 4]]]>>.List.flat.say 15:26
camelia (1 2 3 4)
Doc_Holliwood m: [1, [2, [3, [4, 5]]]]>>.List.flat.say
camelia (1 2 3 [4 5])
Doc_Holliwood ???
why doesn't the second example work? is this a bug? 15:28
jnthn m: dd [1, [2, [3, 4]]]>>.List 15:44
camelia ((1,), (2, [3, 4]))
jnthn >> isn't descending as deep as you'd wish 15:45
Doc_Holliwood I noticed that :P 15:47
Q is why?
m: [1, [2, [3, [4, 5,[6,7,8]]]]]>>.List.flat.say 15:48
camelia (1 2 3 [4 5 [6 7 8]])
Doc_Holliwood so its not elems - 1 deep
[Coke] m: dd [1, [2, [3, 4]]][*;*] 15:51
camelia (1, 2, $[3, 4])
[Coke] m: dd [1, [2, [3, 4]]][*;*;*]
camelia (1, 2, 3, 4)
[Coke] I am not sure if there's a "flatten everything" sugar.
Doc_Holliwood methinks there is, it's just buggy. the 2nd one above should work. 15:54
The doc ( docs.perl6.org/type/Any#method_flat ) 15:55
jnthn I think the docs are misleading there
Since docs.perl6.org/type/Any#method_List is defined as `is nodal` 15:56
And that means we treat such a call as a node and don't descending into it
brass What does dd do? 16:04
[Coke] data dump
Doc_Holliwood it Dumps Data
[Coke] it's rakudo specific.
brass Oh ok thanks
[Coke] we needed something that showed data structures more clearly than .gist 16:05
Doc_Holliwood jnthn: not a problem of hyper? sure?
m: say [1,11, [2,22, [3, 33, [4,44, 5,55]]]]>>.elems 16:06
camelia (1 1 3)
Doc_Holliwood dafuq?
i expected 3 3 3 3 16:07
jnthn Because .elems is nodal too 16:08
Doc_Holliwood what does that mean=
jnthn >>.foo behavior depends on the nature of the method being called, and if it has the nodal trait set on it
Doc_Holliwood reads up
jnthn Explained better at doc.perl6.org/routine/is%20nodal than I'm likely to here :)
Doc_Holliwood i just read that 16:09
how can i tell wether a routine is nodal or not?
m: say [1,11, [2,22, [3, 33, [4,44, 5,55]]]]>>{ .elems } 16:10
camelia Type Int does not support associative indexing.
in block <unit> at <tmp> line 1
Doc_Holliwood m: say [1,11, [2,22, [3, 33, [4,44, 5,55]]]]>>.&{ .elems }
camelia [1 1 [1 1 [1 1 [1 1 1 1]]]]
jnthn m: say 1.^lookup('elems').nodal 16:14
camelia True
jnthn m: say 1.^lookup('Int').nodal
camelia No such method 'nodal' for invocant of type 'Method'
in block <unit> at <tmp> line 1
jnthn hah :)
m: say so 1.^lookup('Int').?nodal # probably more like how it actually works :)
camelia False
Doc_Holliwood m: say [1,11, [2,22, [3, 33, [4,44, 5,55]]]]>>.Str 16:16
camelia [1 11 [2 22 [3 33 [4 44 5 55]]]]
Doc_Holliwood m: say ['a', 'aa', ['b','bb', ['c', 'c', ['d','dd', 'e', 'ee']]]]>>.uc 16:18
camelia [A AA [B BB [C C [D DD E EE]]]]
Doc_Holliwood m: say ['a', 'aa', ['b','bb', ['c', 'c', ['d','dd', 'e', 'ee']]]]>>.&{ .uc } 16:19
camelia [A AA [B BB [C C [D DD E EE]]]]
Doc_Holliwood Ok now the docs suggest there is a difference between these two forms 16:20
timotimo[m] say ['a', 'aa', ['b','bb', ['c', 'c', ['d','dd', 'e', 'ee']]]]>>.reverse 16:21
evalable6 ((a) (aa) ([c c [d dd e ee]] bb b))
Doc_Holliwood scratch that, misread
timotimo[m] m: say ['a', 'aa', ['b','bb', ['c', 'c', ['d','dd', 'e', 'ee']]]]>>.reverse
camelia ((a) (aa) ([c c [d dd e ee]] bb b))
timotimo[m] that's a little odd 16:22
nah, i guess it isn't; it just doesn't call .reverse on the outermost one
which is fine for nodal methods like .elems for example
jnthn m: dd gather [1,11, [2,22, [3, 33, [4,44, 5,55]]]].deepmap(*.take)
camelia (1, 11, 2, 22, 3, 33, 4, 44, 5, 55).Seq
El_Che will #perl6 be forwarded? Still more people there than here
jnthn That's a fairly neat way to write a deep flattener
stoned75 fwiw, mentioned in rosettacode.org/wiki/Flatten_a_list#Perl_6 16:25
AlexDaniel El_Che: we'll see 16:27
El_Che: I guess we're now trying to get people to move naturally, and it's actually working
Doc_Holliwood m: sub f { |$^a, [[&f]] |$^b>>.List.flat }; say [[&f]] [1,11, [2,22, [3, 33, [4,44, 5,55,[6]]]]] 16:28
camelia (1 11 (2 22 3 33 4 44 5 55 6))
Doc_Holliwood so close :P
gather
of course
i agree. really neat 16:33
so neat i totally stole it (with credit)
www.youtube.com/watch?v=iDas3lZamz4
see the comments
Geth whateverable: e002ae89f9 | (Aleks-Daniel Jakimenko-Aleksejev)++ | lib/Whateverable.pm6
Leave #perl6-dev (it's #raku-dev now)

I'm still keeping it on #perl6 for Tellable and some occasional Evalable action, but not for long.
16:45
SmokeMachine xinming_: it was with a bug... but it's fixed 17:41
xinming_: www.irccloud.com/pastebin/ZIdSlm9S/ 17:42
xinming_ SmokeMachine: How to specify the default value for column BTW? 17:59
something like has DateTime $.now is column{:default<now>}; 18:00
[Coke] m: class A { has Int $.what is default(3) }; A.new.what.say 18:04
camelia 3
[Coke] ah, sorry, was thinking straight attribute, I see you're asking something more complex. 18:05
xinming_ [Coke]: about the column default in Red ORM 18:46
m: class A { has Int $.what = 3 }; A.new.what.say;
camelia 3
xinming_ SmokeMachine: BTW, We also need .pick for (Model.^all).pick ;-) 18:52
brass What do you call the methods that start with ^? 18:55
SmokeMachine github.com/FCO/Red/blob/4604f8723f...Seq.md#L55 18:56
xinming_: ^^
xinming_: just: Model.^all.pick
brass: it’s a meta-method... 18:57
[Coke] docs.perl6.org/language/operators#methodop_.^
brass Thanks 18:58
SmokeMachine xinming_: that’s only with whateverable?! All fix that. 18:59
xinming_ SmokeMachine: why Model.^all.pick work, But not (Model.^all).pick? 19:07
That makes me curious
AlexDaniel SmokeMachine: speaking of whateverable, let me know if my changes are ok to you :) I can also submit some basic tests 19:08
tests are very easy in whateverable, but I have not tried doing that by using whateverable as a module… 19:09
redbot is the first project like this, actually :) 19:10
SmokeMachine :) 19:10
AlexDaniel: Yes, I liked it a lot! I just need to change it to get configuration from the database (but I haven't tested yet...) 19:11
xinming_ SmokeMachine: The Model.^all.pick doesn't seem work 19:12
SmokeMachine xinming_: I meant `Model.^all.pick(*)` is implemented but `Model.^all.pick` is not yet...
xinming_ Ok, got it. 19:13
SmokeMachine xinming_: until I fix it, you can probably run `Model.^all.pick(*).head`
AlexDaniel SmokeMachine: have you look at the latest commits? It's no longer reading the config file 19:25
SmokeMachine: it doesn read from the database, but now it's much easier: github.com/FCO/RedBot/blob/c9f8f78...ot#L45-L52
SmokeMachine AlexDaniel: Yes I did! :) it will be easy to make it use Red to get the configuration... 19:26
Doc_Holliwood a my variable in a class will be shared by all instances, yes? 19:28
pmurias [Coke]: hi 20:05
tellable6 2019-10-23T15:22:04Z #raku-dev <MasterDuke> pmurias: got it working with github.com/perl6/nqp/commit/8a9e57c00a
2019-10-23T15:31:41Z #raku-dev <MasterDuke> pmurias: btw, why does it say `runtime NYI: unimplemented QAST::Op for` when for does work?
[Coke] pmurias: ho 20:07
I think I still owe you an email
xinming_ SmokeMachine: head is the same as first, right? 20:08
Doc_Holliwood give first, give head. yeah, about the same 20:10
xinming_ when we do sort, How can we do reverse sort? 20:11
Doc_Holliwood you give sort a callable that accepts 2 arguments 20:12
pmurias [Coke]: if you have any question/or anything needs fixing, I'll gladly answer/fix ;)
Doc_Holliwood basically
m: [1,2,3].sort({ $^b <=> %^a }).say 20:13
camelia Type check failed in binding to parameter '%a'; expected Associative but got Int (1)
in block <unit> at <tmp> line 1
Doc_Holliwood m: [1,2,3].sort({ $^b <=> $^a }).say
camelia (3 2 1)
Doc_Holliwood m: [1,2,3].sort({ * <=> * }).say 20:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *
at <tmp>:1
------> 3[1,2,3].sort({ * <=> * }7…
Doc_Holliwood m: [1,2,3].sort( * <=> * ).say
camelia (1 2 3)
Doc_Holliwood m: [1,2,3].sort( * !<=> * ).say 20:16
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot negate <=> because structural infix operators are not iffy enough
at <tmp>:1
------> 3[1,2,3].sort( * !7⏏5<=> * ).say
expecting any of:
infix
infix stopper
Doc_Holliwood lol, not iffy enough
m: [1,2,3].sort( * after * ).say 20:18
camelia (1 2 3)
Doc_Holliwood m: [1,2,3].sort( * before * ).say
camelia (3 2 1)
Doc_Holliwood optimum reached
xinming_ Doc_Holliwood: I mean in Red. 20:21
the ORM 20:22
Doc_Holliwood uh. no idea then.
xinming_ SmokeMachine: Also, I try to use Red in Cro, It seems, I need to add my $*RED-DB = database ....; to every request action. 20:35
SmokeMachine xinming_: github.com/FCO/Cro-HTTP-Session-Red 20:36
xinming_: no, `.head` is different from `.first`... `.first(...)`means `.grep(...).head` 20:37
xinming_: `Model.^all.sort: -*.col` 20:38
xinming_ SmokeMachine: Is there pager sollution in Red? 20:45
SmokeMachine xinming_: `.batch($page-size)`
xinming_: `.batch($page-size)[$page]`
AlexDaniel xinming_: .sort.reverse is fine 20:46
xinming_ AlexDaniel: Are you talking about the Red ORM? 20:47
SmokeMachine: Thanks.
AlexDaniel xinming_: no, it's about “How can we do reverse sort?” :) 20:48
SmokeMachine xinming_: have you seen the other responses?
xinming_ SmokeMachine: Which one?
AlexDaniel xinming_: oh, sorry, just read the rest of the messages :)
xinming_ I know I got disconnected
SmokeMachine www.irccloud.com/pastebin/YMDplWec/
xinming_ AlexDaniel: Ok, Red ORM is doing kind great
I read them now. 20:49
SmokeMachine: Do you plan to add something like Data::Page from perl 5?
AlexDaniel yep, Red looks prett cool, SmokeMachine++ :) 20:50
prett*
xinming_ Or, there is something better sollution for the Pager object
SmokeMachine Thanks! :)
xinming_: I haven't thought about that yet... 20:52
xinming_ SmokeMachine: Though, I'm still not get the idea why you choose to use function style rather than OO style.
I asked the same question in #cro, and understand why they choose to do it this way.
SmokeMachine xinming_: what do you mean? 20:53
xinming_ I mean, you make it with Model.^load: xxx; instead of $dbschema.RSSeq('Model').load: xxx; 20:55
I mean, you make it with Model.^load: xxx; instead of $dbschema.RSSeq('Model').^load: xxx; 20:56
SmokeMachine xinming_: but it's kinda the same thing if you think the $dbschema is your Metaclass... so, `$dbschema.RSSeq('Model')` is equivalent to `Model.HOW.all(Model)`... so, if you do `my $dbschema = Model.HOW; $dbschema.all(Model)` if you want it... 21:00
or `$dbschema.rs(Model)` (`.^all` is an alias for `.^rs`) 21:01
xinming_ SmokeMachine: What I mean is, actually, We can have the $schema object.. 21:29
BTW, is there a shortcut for my %h = %( |($xx ?? :$xx !! ()), |($yy ?? :$yy !! ()) ); 21:30
SmokeMachine m: my $yy = 42; my %h = |(:$xx with $xx), |(:$yy with $yy); say %h 21:32
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$xx' is not declared
at <tmp>:1
------> 3my $yy = 42; my %h = |(:7⏏5$xx with $xx), |(:$yy with $yy); say %h
SmokeMachine m: my $xx; my $yy = 42; my %h = |(:$xx with $xx), |(:$yy with $yy); say %h
camelia {yy => 42}
xinming_ SmokeMachine: What I mean is, |(...) seems to be too tedious 21:36
SmokeMachine xinming_: it creates a Slip... 21:37
discord6 <noelsken> :$xx creates a pair which is one object, which means it can only be one of key or value for a hash, and the | is necessary to lower the pair object into the hash as a key/value pair 21:40
<noelsken> so that it slips into key and value
<noelsken> if this is about having to type |( ) for every variable I'd suggest stuffing them into something Positional and iterating over it 21:41
xinming_ discord6: I know what it means, The reason I ask for this is trying to finder a shorter way to do things in perl6 21:53
noelsken: ^^
discord6 <noelsken> I don't think there's anything shorter than prefix:<|> 21:55
xinming_ m: my $xx; my $yy = 42; my %h = (:$xx with $xx), (:$yy with $yy); say %h
camelia {yy => 42}
xinming_ This is the shortest way I can do this. 21:56
discord6 <noelsken> m: my $x = "foo"; my %h = (:$x with $x); say %h.perl 21:59
evalable6 {:x("foo")}
discord6 <noelsken> huh, I'd have expected "expected 2 but got 1" there
SmokeMachine AlexDaniel: that's hanging for me... :( 22:16
AlexDaniel SmokeMachine: what is? 22:18
SmokeMachine: did you update whateverable?
SmokeMachine yes...
AlexDaniel hmmmm
SmokeMachine oh no! it's running!
SmokeMachine AlexDaniel www.irccloud.com/pastebin/wy8bhLAa/ 22:30
AlexDaniel SmokeMachine: that's in the version I committed or you tweaked it? 22:33
SmokeMachine the version you committed... 22:34
AlexDaniel I see 22:36
yup, I see
SmokeMachine: run it with DEBUGGABLE env var for now while I'm fixing it
SmokeMachine AlexDaniel: with DEBUGGABLE it's working... 22:40
AlexDaniel SmokeMachine: I'm an idiot. Put a semicolon on this line: github.com/FCO/RedBot/blob/f1c6ca3...ed-bot#L51 22:46
SmokeMachine AlexDaniel: Sorry, I didn't find it... 22:47
but why is it working with DEBUGGABLE? 22:49
AlexDaniel SmokeMachine: because then it doesn't use the cave var 22:52
ideally the list of channels should be configurable too :) 22:53
SmokeMachine yes, it will be on database... 22:54
Geth whateverable: ab7c6b2283 | (Aleks-Daniel Jakimenko-Aleksejev)++ | 2 files
Make the channel list configurable
23:37
AlexDaniel SmokeMachine: done ↑ 23:38