»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
Herby_ MasterDuke: Ah, thanks 00:04
Ulti: ++ on the advent calendar article
RabidGravy just prepping the advent aricle to post lest anyone is getting nervous 01:13
there, advent article posted 01:22
Hotkeys \o/
RabidGravy it will be a miracle f there are fewer than ten typos as I went to the supermarket in the middle and had to had a few beers to revover ;-) 01:23
RabidGravy So I avoided the bad paragraph break errors from last year, but there are some egregious typos and brainos, but I think I'll leave them as it entertains the language geeks ;-) 01:33
geekosaur typopotamuses? 01:36
RabidGravy :-O 01:38
(also quite ratted now)
can we move the "advent" to a different time of year, lots of time pressure in december ;-) 01:39
that's perl6advent.wordpress.com/2017/12/...ier-title/ if you want to get in early 01:40
Herby_ .tell RabidGray ++ 02:01
yoleaux Herby_: I'll pass your message to RabidGray.
Herby_ whoops 02:03
.tell RabidGravy ++
yoleaux Herby_: I'll pass your message to RabidGravy.
japhb Where is the source for the advent posts? I think (at least) the posts for the 14th and the 17th have mangled source code snippets, and I'd like to see the original. 02:25
araraloren 哦| 03:21
o|
Herby__ \o 03:28
Herby_ does p6 have something comparable to python's "setdefault"? 04:12
for hashes
araraloren Herby_, I check setdefault of hash in python, I think Perl6 default does that 04:24
m: my %h = name => 'foo'; say %h; %h<name> = 'bar'; say %h; 04:25
camelia {name => foo}
{name => bar}
araraloren m: my %h; say %h; %h<name> = 'bar'; say %h; 04:26
camelia {}
{name => bar}
raschipi M: my %h is default(42); say %h<a>; %h<a> = 55; say %h<a>; %h<a> = Nil; say %h<a> 04:27
m: my %h is default(42); say %h<a>; %h<a> = 55; say %h<a>; %h<a> = Nil; say %h<a>
camelia 42
55
42
araraloren oh, I am wrong 04:29
It should be
m my %h = name => 'foo'; say %h; %h<name> //= 'bar'; say %h;
m: my %h = name => 'foo'; say %h; %h<name> //= 'bar'; say %h;
camelia {name => foo}
{name => foo}
araraloren Herby_, ^^ 04:30
m: my %h = namex => 'foo'; say %h; %h<name> //= 'bar'; say %h;
camelia {namex => foo}
{name => bar, namex => foo}
Herby_ araraloren / raschipi: thanks 04:58
raschipi Herby_: You can put a default on any variable, attribute or array. 05:00
Herby_ raschipi: can you put a default of any empty hash? 05:08
like: current_dict = current_dict.setdefault(letter, {})
I'm reading up on tries: stackoverflow.com/questions/110153...-in-python
raschipi No idea what that means.
Herby_ sorry, i'm reading that python example of creating a trie 05:09
and trying to figure out how i'd do it in p6
raschipi Well, it would be nested hashes from what I'm getting, why do you want it? 05:13
Yeah, "setdefault" would be //= or = // like araraloren said above. 05:14
Herby_ k thanks 05:15
Hotkeys Perhaps this question is more appropriate here than in #perl6-dev: What kinds of uses might the new/upcoming .toggle have? 08:16
tyil today's advent article has a typo in the last sentence, where it says "tutotials" 09:54
should most likely be tutorials
dpk is there any way in the perl6 repl to disable the 'potential difficulties' warnings? or at least make it still do what it would have done 10:06
(i'm aware this may be bad practice but i'm trying to get a sense for edge cases)
lizmat s/tutotials/tutorials/ done # tyil++ 10:09
tyil thanks! 10:11
AlexDaniel lizmat: there was a question ↑ about .toggle :) 10:25
lizmat: if you have a good answer, maybe we can put it into the documentation 10:26
lizmat perhaps an example would work best: 10:28
in its simplest case, .toggle is like grep *but* once the condition has evaluated to False for the first time, it stops checking 10:29
m: dd ^10 .map( { .say; $_ } ).grep( * < 5 )
camelia 0
(0, 1, 2, 3, 4).Seq
1
2
3
4
5
6
7
8
9
lizmat m: dd ^10 .map( { .note; $_ } ).grep( * < 5 ) 10:30
camelia 0
1
2
3
4
5
6
7
8
9
(0, 1, 2, 3, 4).Seq
lizmat note that all values have been sayd
m: dd ^10 .map( { .note; $_ } ).toggle( * < 5 )
camelia 0
1
2
3
4
5
(0, 1, 2, 3, 4).Seq
tyil notes it
araraloren It test all value
lizmat note that with .toggle it only tests until the first False 10:31
lizmat with multiple Callables, you specify condition for inclusion, condition for exclusion, condition for inclusion, etc. 10:34
dd ^10 .map( { .say; $_ } ).toggle( * < 3, * > 5, * < 9 )
lizmat m: dd ^10 .map( { .say; $_ } ).toggle( * < 3, * > 5, * < 9 ) 10:34
evalable6 0
(0, 1, 2, 6, 7, 8).Seq
1
2
3
4
5
6
7
8
9
lizmat m: dd ^10 .map( { .note; $_ } ).toggle( * < 3, * > 5, * < 9 )
evalable6 0
1
2
3
4
5
6
7
8
9
(0, 1, 2, 6, 7, 8).Seq
lizmat if you want to start with an exclusion condition, you need to pass the :off named parameter 10:35
m: dd ^10 .map( { .note; $_ } ).toggle( :off, * > 3, * < 6, * > 8 ) 10:36
evalable6 0
1
2
3
4
5
6
7
8
9
(4, 5, 9).Seq
lizmat I'm not awake yet to write coherent documentation :-) so if someone else could take a stab, that would be fine by me :-) 10:37
AlexDaniel I filed a doc issue here: github.com/perl6/doc/issues/1716 10:38
although… do we have any tests for it in roast?
AlexDaniel heh, evalable6++ :) 10:39
lizmat AlexDaniel: no, no tests for .toggle in roast yet, as I was unsure the implementation would be acceptable by jnthn and TimToady 11:02
since they haven't reacted, I guess it means they're ok with it
still means we need a .toggle for Supplies as well
afk& 11:03
Hotkeys I'm curious what interesting uses people will have for toggle
araraloren I think it's just a candidates we have :) 11:06
TEttinger Hotkeys: toggle seems handy in general. in clojure it's analogous to take-while and map all rolled up into one procedure that does grep stuff too 11:24
since toggle has a stopping condition, it could make dealing with lazy/infinite/very-large sequences easier 11:25
TEttinger the name toggle is just awful though. toggling a switch means turning it off from on, or on from off 11:30
and there's none of that here? 11:31
is that what the multiple Callables do?
araraloren Why not add another grep candidate :) 11:32
or add a :toggle named argument
Hotkeys TEttinger: from what I understand it's essentially toggling between a take-while and a skip-until 11:42
So I don't mind the name
araraloren :) okay 11:43
AlexDaniel
.oO( greggle?
)
laret709 10,08▄10,03▄03,05▄11,04▄03,07▄04,02▄10,04▄12,07▄11,09▄10,03▄02,10▄07,07▄12,13▄05,09▄04 HAPPY NIGGER DAY!! PLEASE SAY HI TO ALL THE DUMB NIGGERS IN #OFTC...quicktalkeh676te.onion/6697dghtweqmkv: camelia colomon tyil darutoko committable6 MasterDuke Herby_ statisfiable6 releasable6 TEttinger rindolf reportable6 bisectable6 |oLa| bloatable6 Voldenet AlexDaniel coverable6 labster r 11:48
02,13▄13,08▄09,02▄07,11▄03,03▄09,02▄13,11▄09,04▄11,02▄05,05▄03,09▄05,13▄05,11▄03,11▄11,09▄07,13▄07,02▄13 HAPPY NIGGER DAY!! PLEASE SAY HI TO ALL THE DUMB NIGGERS IN #OFTC...quicktalkeh676te.onion/6697vfxtunuyw: committable6 |oLa| afresh1 Cabanossi Hotkeys xcm ryn1x spider-mario TimToady quotable6 jeek comborico1611 benchable6 ilbot3 labster coverable6 greppable6 eva
moritz deletes some spam from IR clogs 11:55
AlexDaniel heh, the spam bot went through extra trouble to notify other bots here… 12:05
AlexDaniel hah, in fact all of them… 12:16
tyil bots need love too 12:37
araraloren O_o 12:38
timotimo Herby_: you don't have to set the default of a hash to an empty hash to get a trie, because autovivification does all that work for you. observe: 12:56
m: my %trie; %trie<h><e><l><l><o> = 1; say %trie
camelia {h => {e => {l => {l => {o => 1}}}}}
araraloren Is there a way skip the rest element of a Iterator ?
timotimo the "rest element"? if you want to skip to the end, you can .sink-all 12:58
(which will also sink the values)
araraloren oh, thanks, I found that in document, but not sure 12:59
I thought there will be a method called skip-all :)
andrzejku hi 14:29
:)
Geth doc: 5c0d7807c1 | (Elizabeth Mattijsen)++ | doc/Type/Telemetry.pod6
Update basic Telemetry documentation

More on the separate instruments to follow
14:32
synopsebot Link: doc.perl6.org/type/Telemetry
lizmat timotimo: sometimes I think we need a "done" on Iterators, like we have on Supplies 14:34
that would default to sink-all 14:35
Geth doc: 5b3f34bc00 | (Elizabeth Mattijsen)++ | doc/Type/Telemetry/Instrument/Usage.pod6
First stab at documenting Telemetry::Instrument::Usage
15:05
synopsebot Link: doc.perl6.org/type/Telemetry/Instrument/Usage
lizmat afk again&
Herby_ timotimo: that is awesome. Now that I've had a little sleep, I'm going to give tries another look 16:22
timotimo you're gonna give tries another try? :3
Herby_ even after multiple tries, i'll give tries another try 16:23
:)
timotimo triès bien
masak .oO( triès bien -- the data structure of choice when a trèes bien is not enough ) 16:25
timotimo i think i need an explanation for that one, masak 16:25
masak less cerebral than I'd wish 16:26
just that two data structures are named 'trie' and 'tree', respectively
timotimo oh!
that's actually not bad at all
masak bows 16:27
...and the correct French spelling is 'très', but who's counting
timotimo my google chrome does this very annoying thing where code lines in the advent calendar have everything below the baseline cut off :\ 16:28
but not on every line. on most, but a few have their lower parts legible 16:29
mostly it's g looking like a 16:31
"what's an exchanae?"
Herby_ timotimo: speaking of tries. If you have a moment free, could you show me how you'd write this python solution in perl6? 17:06
stackoverflow.com/questions/110153...-in-python
the accepted answer on that, the function make_trie
I can't wrap my head around the current_dict = current_dict.setdefault(letter, {}) 17:07
:(
timotimo ah, sure 17:08
so you're starting off with the base dictionary
timotimo then for each letter of the word you access the entry in that dictionary for that letter. if there's no entry yet, an empty dictionary will be created and put there, and that's what gets assigned into current_dict 17:09
Herby_ ok 17:10
timotimo it's like you're moving a cursor through the nested dictionaries, creating new empty dictionaries if necessary on the way
Herby_ I just don't see where the actual letter gets inserted in to the dictionary, since it appears to always create an empty dict 17:11
timotimo m: my %a; %a{|("foobar".comb)} = 1; say %a
evalable6 {a => (Any), b => (Any), f => 1, o => (Any), r => (Any)}
timotimo oops, wrong one
m: my %a; %a{||("foobar".comb)} = 1; say %a
evalable6 {a => (Any), b => (Any), f => 1, o => (Any), r => (Any)}
timotimo also not the right one
ah, the trick with that is that the letters are keys in the dictionary, not values
the only actual value that ever gets stored is "_end_"
Herby_ hmm 17:15
timotimo so we're starting with an empty dict ("root"), then by going through the word "foo" we do the following:
timotimo current_dict is "root" first. our first letter is f. we ask for what "root" has stored at f, which is currently nothing. setdefault stores a {} at the l key in "root" for us 17:16
so our root looks like {"f": {}} now
and our current_dict is what setdefault returned, which is that inner empty dict
Herby_ ok
timotimo next letter is o, and current_dict is the inner dictionary. we ask it to give (and perhaps install {}) what's in that inner dict at key "o" 17:17
timotimo so it creates that empty dict and we have our root look like {"f": {"o": {}}} and current_dict is the innermost empty dict 17:17
one more o, the same treatment, but for "one layer" deeper in there
gives us {"f": {"o": {"o": {}}}}
we're done with the loop and our current_dict is the innermost dict once again 17:18
Herby_ ok
timotimo we store _end at the _end key there, which makes the innermost dict be {"_end_": "_end_"}
timotimo now going with a new word, like "foor", will be very different, because this time there are already dictionaries stored under the keys for "f", "o", and "o" 17:19
i'll be afk for a bit
Herby_ ok thanks for the explanation 17:20
nige hi - I just added advent day 18 and scheduled it for tomorrow morning 17:33
Herby_ nige: o/
can't wait to read it
timotimo i have the power to read it early >:) 17:35
Herby_ great power, great responsibility etc 17:37
timotimo scheduled in 7 hours, huh? 17:38
yeah, that sounds perfect
moritz nige: I've added a "Day 18:" to the title, and set the schedule to midnight. Hope that's fine with you 17:39
just to keep stuff consistent with the other posts 17:42
timotimo aaw, that's a short post :( 17:45
nige thanks Moritz - that's fine 17:55
moritz btw the grammar chapter in perl 6 fundamentals was very helpful 17:58
moritz nige: thanks for the feedback. There's more detail in smile.amazon.com/dp/1484232275/ :-) 18:44
dpk "A Recursive Descent into Parsing" *groan* 19:31
AlexDaniel sings along 19:33
moritz likes the subtitle 19:38
buggable New CPAN upload: LIVR-2.1.0.tar.gz by KOORCHIK cpan.metacpan.org/authors/id/K/KO/...1.0.tar.gz 19:48
AlexDaniel moritz: nothing wrong with it really 19:58
Herby_ in that buggable msg: "LIVR-2.1.0.tar.gz" looks to be a hyperlink that goes nowhere 19:59
not sure if thats for every new CPAN upload msg or not 20:00
moritz huh, works here
jast works for me, too
maybe there was a bit of a delay before it finished setting itself up?
moritz wget --quiet cpan.metacpan.org/authors/id/K/KO/....0.tar.gz; echo $?
0
Herby_ when I click on the bolded "LIVR-2.1.0.tar.gz", it just opens up a webpage with a url of LIVR-2.1.0.tar.gz 20:01
jast oh, that's not a link at all, your client is probably misunderstanding it
Herby_ the cpan link works
gotcha
jast IRC doesn't have a concept of links
Herby_ i'm using hexchat, not sure if that makes a difference
jast so terminals and clients try to guess, sometimes incorrectly
Herby_ kk 20:02
moritz the IRC logs guess correctly too: irclog.perlgeek.de/perl6/2017-12-17#i_15591493
jast maybe the IRC logs just don't link URIs without protocol prefixes, like example.org 20:03
(just verified :))
moritz that's pretty hard to get right, given the proliferation of TLDs 20:05
timotimo there was this one terminal emulator that would send dns requests out to figure out if something the mouse is hovering over is a valid domain 20:19
moritz "what could possibly go wrong" 20:21
nige surprised to see that perl 6 is not appearing in the timeline: en.wikipedia.org/wiki/Timeline_of_..._languages 21:16
b2gills .tell nige There is no entry for any version of Perl other than 1.0 en.wikipedia.org/wiki/Timeline_of_..._languages 21:50
yoleaux b2gills: I'll pass your message to nige.
Geth doc: 0++ created pull request #1717:
Minor adjustments
21:51
lizmat b2gills nightfrog en.wikipedia.org/wiki/Timeline_of_...ages#2010s # added Perl 6 21:58
Herby_ lizmat: ++
lizmat nightfrog sorry, I meant nige
Herby_ the hyperlink for Perl 6 doesn't go anywhere, not sure if that is intentional or not 21:59
rather, it doesnt go to an article
b2gills Should probably point to en.wikipedia.org/wiki/Perl_6 22:00
lizmat fixed 22:01
Herby_ Huzzah!
MasterDuke lizmat++. another possible suggestion, rakudo in "The Rakudo Team" could link to en.wikipedia.org/wiki/Rakudo_Perl_6. or does that make the entry too busy? 22:03
buggable New CPAN upload: Text-Markov-1.0.1.tar.gz by BBKR cpan.metacpan.org/authors/id/B/BB/...0.1.tar.gz 22:08
lizmat MasterDuke: linked the Rakudo Team to the CREDITS page 22:12
MasterDuke good idea, lizmat++ 22:13
lizmat also: Perl 6 now links to the Rakudo Perl 6 page, as that was the implementation that became officially released then
rindolf Happy birthday, Perl! 22:40
tyil happy birthday! 22:49
lizmat whee! 23:03
well, at least in NL now :-)
tyil lizmat: I can ask sam if she wanna come visit your place when she wakes up, to celebrate the wonders of perl ^^ 23:30