Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-03-26

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:08 labster joined #perl6
00:11 labster joined #perl6
00:13 ZoffixLappy m: say ^10 .hyper.WHAT
00:13 camelia rakudo-moar 81558b: OUTPUT«===SORRY!===␤Method call must either supply a name or have a child node that evaluates to the name␤»
00:13 ZoffixLappy wat
00:14 ZoffixLappy m: my $x = ^10; say $x.hyper.WHAT
00:14 camelia rakudo-moar 81558b: OUTPUT«(HyperSeq)␤»
00:14 ZoffixLappy m: say ^10 .WHAT
00:14 camelia rakudo-moar 81558b: OUTPUT«===SORRY!===␤Method call must either supply a name or have a child node that evaluates to the name␤»
00:15 ZoffixLappy Oh. Seems like a change occurred since I last used Perl 6. Used to be that adding a space between a method call would change precendence.
00:16 ZoffixLappy Does anyone know if this change intentional or an unintended "bug"? Christmas release doesn't act this way.
00:16 Azry joined #perl6
00:19 timotimo ZoffixLappy: don't forget that >> doesn't guarantee execution order
00:19 timotimo i *think* it's just .WHAT being b0rken, because it's not a true method call, btw
00:19 timotimo m: say ^10 .perl
00:19 camelia rakudo-moar 81558b: OUTPUT«^10␤»
00:19 timotimo m: say ^10.perl
00:19 camelia rakudo-moar 81558b: OUTPUT«Potential difficulties:␤    Precedence of ^ is looser than method call; please parenthesize␤    at /tmp/1xE4ZJ6_Xx:1␤    ------> 3say ^107⏏5.perl␤^10␤»
00:19 rudi_s timotimo: But it guarantees result order, right?
00:20 timotimo yes
00:20 rudi_s Good, thanks.
00:21 timotimo "race" is the one that doesn't
00:21 ZoffixLappy Thanks!
00:21 timotimo see also the tweet i shot your way about @a.uc
00:23 ZoffixLappy timotimo, ahh. thanks. Now I see what it's doing. It's not DWIMing, it's just .Str.uc on an array
00:25 timotimo that's right
00:25 timotimo though the other interpretation is just a >> away
00:26 timotimo that's the power of Cool, though it has already caused people to mock us, saying things like "why would i want the square root or sine of an array?"
00:26 ZoffixLappy That's what I originally wanted to do, but I got confused into thinking @foo.uc was doing @foo».uc! timotimo++ You just gave me the perfect example of ». use for my talk :D
00:32 timotimo want me to blow your mind with a little snippet i wrote yesterday?
00:33 timotimo hm, though this version of that snippet i have here isn't so great
00:33 johndau joined #perl6
00:34 timotimo perl6 -e 'for [\~] ({ prompt("") } ... *.not) { .say }'
00:34 timotimo ^- check it! :)
00:35 TreyHarr1 p6: sub MAIN ($x where { $^x > 1 }) { say 1 }
00:35 camelia rakudo-moar 81558b: OUTPUT«Usage:␤  /tmp/tmpfile <x> ␤»
00:35 timotimo well, you really want ...^ there
00:35 TreyHarr1 p6: unit sub MAIN ($x where { $^x > 1 });
00:35 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5===␤Expression needs parens to avoid gobbling block␤at /tmp/tmpfile:1␤------> 3unit sub MAIN ($x where { $^x > 1 }7⏏5);␤Missing block (apparently claimed by expression)␤at /tmp/tmpfile:1␤------> 3unit sub MAIN ($x where { …»
00:35 timotimo and if you want a list of elements instead of them concatenated together, you can use [\,] instead
00:35 TreyHarr1 what's the difference there?
00:36 timotimo huh, that's something interesting you've found there
00:36 TreyHarris unit shouldn't change the signature processing, should it?
00:36 timotimo m: unit sub MAIN ($x where { $^x > 1 });␤say "hi"
00:36 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5===␤Expression needs parens to avoid gobbling block␤at /tmp/hdgoxZnOAg:1␤------> 3unit sub MAIN ($x where { $^x > 1 }7⏏5);␤Missing block (apparently claimed by expression)␤at /tmp/hdgoxZnOAg:1␤------> 3unit sub MAIN ($x wh…»
00:37 timotimo i'd call that a bug
00:37 TreyHarris ok, I haven't found a workaround
00:37 ZoffixLappy It may already be reported. I recall complaining about this awhile back and I'm almost sure I filed a bug on RT
00:37 ZoffixLappy m: sub foo ($x where { $^x > 1 });
00:37 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5===␤Expression needs parens to avoid gobbling block␤at /tmp/QrzpyBAwyQ:1␤------> 3sub foo ($x where { $^x > 1 }7⏏5);␤Missing block (apparently claimed by expression)␤at /tmp/QrzpyBAwyQ:1␤------> 3sub foo ($x where { $^x > …»
00:38 TreyHarris ZoffixLappy: I thought so but had trouble finding the bug
00:38 TreyHarris it sounded familiar to me
00:38 ZoffixLappy lemme try to look for it
00:40 TreyHarris https://rt.perl.org/Public​/Bug/Display.html?id=66776 is the closest i found
00:40 TreyHarris but that isn't it
00:41 gtodd hey perl6 is fun :-D
00:41 TreyHarris but it being declarations, not "unit" per se, is interesting
00:41 ZoffixLappy I may be thinking of this: https://rt.perl.org/Ticket/Display.html?id=127205  sorry, too drunk to give any useful info
00:42 ZoffixLappy gtodd, it indeed is!
00:42 timotimo ZoffixLappy: how did you like my code?
00:43 gtodd there were various perl5 solutions to this problem   http://stackoverflow.com/q/36201884/2019415 "Process string character by character"
00:43 gtodd (I tired the list::Gen)
00:44 gtodd so I winded it totally in perl6 and came up with
00:44 gtodd perl6 -e 'my %hash; for lines().comb.rotor(5 => -4) -> $k { my $a = $k.subst(/\s/, "",:g) ; %hash{$a}++ ; }; for %hash.pairs.sort: { $^b.value <=> $^a.value } -> $pair {state $i = 0 ; $i++ ; last if $i == 6; say $pair; }' sequence.data
00:44 gtodd and it worked!!
00:44 ZoffixLappy timotimo, I don't think I understand what it's doin'
00:46 timotimo the sequence grabs lines from the user until one evaluates to false (so either ctrl-d or empty line)
00:46 Ben_Goldberg joined #perl6
00:46 timotimo and gives a concatenated version of all lines so far to the for block
00:46 timotimo i just thought that was the coolest thing ever. i use it to generate a dot from a bunch of dot-compatible lines
00:46 gtodd unfortunately on a million character string it was the wrong approach and took about 25 minutes to complete .... but it worked! :-P
00:47 timotimo i.e. every time a new line is added i slap a "digraph G {" in front and a "}" at the end and spurt it to a file, so that "dot -Tx11" will refresh
00:47 timotimo gtodd: can you try slurp.lines.comb instead?
00:47 timotimo gtodd: just yesterday i noticed $file.lines was almost 60x slower than $file.slurp-rest.lines
00:48 gtodd the poster asked for a solution involving Tb sized files (as a string I guess) what would be the best "paradigm" to attack a Tb sized "string"  ?  reactive
00:48 gtodd timotimo: will do
00:49 timotimo yeah, ideally you'd have an iterator in there that doesn't keep the whole file in memory, or even parts of it
00:49 timotimo why do you sort with a two-argument block?
00:49 timotimo i'd write it as -*.value
00:51 gtodd just goofing around trying perl5-ish things ... and it worked! :-)
00:52 ZoffixLappy timotimo, ah, now I get your code. I forget what the \ does in the [\~] though. What difference between [~]?
00:52 timotimo it's the triangle-reduce form
00:52 timotimo instead of giving a single result when everything's there
00:52 timotimo you get a lazy list of partial results
00:53 timotimo m: .say for [+] (1, 1, 1, 1, 2, 2, 2, 2)
00:53 camelia rakudo-moar 81558b: OUTPUT«12␤»
00:53 timotimo m: .say for [\+] (1, 1, 1, 1, 2, 2, 2, 2)
00:53 camelia rakudo-moar 81558b: OUTPUT«1␤2␤3␤4␤6␤8␤10␤12␤»
00:53 ZoffixLappy Ah, cool
00:55 timotimo "cool"?
00:55 timotimo is that all you can say?
00:55 timotimo this is the second coming of jesus H. christ!
00:55 gtodd haha
00:55 ZoffixLappy ZOMFG! THAT'S AWEOMEAMAZINGICAN"TBELIEVEITISHAPPENING!!!!!
00:55 ZoffixLappy :P)
00:55 timotimo yes! that's better!
00:56 ZoffixLappy :)
00:56 timotimo i mean, other languages have that, too. i think haskell calls it "scan" (as opposed to "fold")
00:56 gtodd timotimo: ok got it running ... if it is 60 times faster and the other script took 25 minutes ... I still have time to grab a sandwich, right?
00:58 timotimo well, that'd only make the first step of the program much faster
00:58 timotimo sorting the stuff, and probably also the removal of whitespace from each line, may take a moment longer
00:58 timotimo so yeah
00:58 timotimo go grab yourself a sandwich :)
01:03 timotimo to be honest, it's probably only a tiny part of the run time that'd be saved by this change, now that i think more about it :\
01:08 timotimo well, i'll know in like 10 minutes :\
01:09 TreyHarris m: sub foo ($x);
01:09 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/hSWtZ880cY␤A unit-scoped sub definition is not allowed except on a MAIN sub;␤Please use the block form.␤at /tmp/hSWtZ880cY:1␤------> 3sub foo ($x);7⏏5<EOL>␤»
01:10 TreyHarris I entered https://rt.perl.org/Ticket/Display.html?id=127785
01:13 timotimo Enter the MaRTix
01:15 johndau joined #perl6
01:15 AlexDaniel ZoffixLappy: another interesting point is that those who rely on debian packages (all useful cpan modules are in debian) wont even notice if something bad happened to cpan… :)
01:18 chris2 joined #perl6
01:21 ZoffixLappy :D
01:22 ZoffixLappy I'm in the camp of "never use 'packages' for modules" though :) Too outdated
01:23 ZoffixLappy it says I only got 12 minutes on my battery, so if I don't respond to someone, it's just 'cause I died, not 'cause I didn't care to respond :)
01:26 gtodd timotimo: you were correct ... :-) but ... instead of 1550 seconds it took 1300 seconds so ...
01:27 timotimo :|
01:27 timotimo sorry about that, friend
01:27 timotimo do you have the source file? maybe i'll play around with it for a bit
01:28 gtodd timotimo: anyway char by char processing of masive strings maybe is jut hard to do
01:28 timotimo (but likely shrink the source down to a third or so)
01:28 geraud joined #perl6
01:28 gtodd timotimo:  I just used perl to make it :-)
01:29 timotimo how much faster is perl5 here? :(
01:29 timotimo it might be faster actually to substr shifted ranges instead of comb + rotor + join
01:30 gtodd perl -MString::Random=random_regex -e "print random_regex('[GCNTA]{1048576}');"  did that a few hundred times in a loop appending to a file and making sure it was all one line string with tr -d "\n" or something
01:30 gtodd perl5 does it in about 27 seconds
01:31 gtodd but differently
01:31 gtodd other perl5 scripts took 3 minutes and one minute
01:32 gtodd http://stackoverflow.com/a/36208336/2019415  but see the whole post and comments for more info
01:32 timotimo why do you even .lines if it's one big line ...
01:32 gtodd heheh
01:32 gtodd I figure it was only one line so ... :-D
01:32 gtodd probably not a bottle neck :)
01:33 gtodd it's the whole making a string into a list problem
01:33 timotimo only for the first ~250 seconds ;)
01:33 gtodd it is more of a read seek index sort of problem I guess
01:34 gtodd but I figured a long anything (Str or whatever) would be good for a lazy approach ...
01:35 timotimo i wonder how good calling read and seek would do here
01:35 gtodd the classic perl approach was to sysread chunks at a time ... or set $/ = \somenumber
01:35 timotimo hm, but seek doesn't know about graphemes
01:35 gtodd and while away the string .... how long is a piece of string
01:35 timotimo then it comes down to whether or not you want to be able to handle unicode data incoming
01:36 gtodd timotimo: yeah I think the fact that it is nucleotides (just letters in ASCII) make it easier in that particular problem
01:36 timotimo oh
01:36 timotimo then i'd even go so far as to read binary out of that
01:37 gtodd but A ITb long string?!? sheesh
01:37 gtodd yeah binary
01:37 gtodd ++
01:37 teatime Does panda install to cwd by default?
01:37 timotimo no
01:37 timotimo m: say $*REPO.repo-chain
01:37 camelia rakudo-moar 81558b: OUTPUT«(inst#/home/camelia/.perl6 inst#/home/camelia/rakudo-​m-inst-1/share/perl6/site inst#/home/camelia/rakudo-m​-inst-1/share/perl6/vendor inst#/home/camelia/rakudo-m-inst-1/share/perl6 CompUnit::Repository::AbsolutePath.new(next-repo => CompUnit::Repository::NQ…»
01:37 teatime Does it make workdir in cwd then?
01:37 timotimo it might
01:38 colomon joined #perl6
01:39 teatime so, I understand why I can't do this:
01:40 teatime token TOP { ^ <LINE>* $ }
01:40 teatime token LINE { ^^ <.ws> [ <EVENT>+ ':' <.ws> <RESULT> <.ws> ]? <COMMENT>? $$ }
01:40 gtodd timotimo: what is a fast language for string manipulation etc.   I mean are there languages that love "strings"
01:40 timotimo i have no clue
01:40 teatime but is this the cleanest thing I can come up with, or is there something a little more straightforward:
01:40 teatime token TOP { ^ <LINE>* $ }
01:40 teatime token LINE { \n | <COMMENT> [\n|$] | <ENTRY> [\n|$] }
01:40 MadcapJake gtodd have you tried --profile?
01:40 teatime also: token ENTRY { <.ws> <EVENT>+ ':' <.ws> <RESULT> <.ws> <COMMENT>? }
01:41 teatime gtodd: perl5?
01:41 gtodd MadcapJake: yes with the short dataset
01:41 gtodd errm small
01:42 gtodd but short as in a shortstring
01:42 timotimo teatime: in my opinion it's no shame to match a long string against a regex line-by-line
01:43 teatime timotimo: I'm just wantint to be lazy and use parsefile().  but yeah that would probably be better.
01:43 gtodd teatime: perl5 is faster yes ... there's a regex approach and a sysread approach  http://stackoverflow.com/questions/362018​84/process-string-character-by-character/
01:46 sue joined #perl6
01:46 timotimo hmm. of course that reads the file in big-ish chunks
01:47 teatime reading big chunks + regexes might work really well for speed
01:47 * Ben_Goldberg wonders if one couldn't simply memory-map the whole file.
01:47 teatime but premature optimization is evil; be able to justify any departure from straightforward code w/ substantial profiling gains.
01:48 Hotkeys I should learn finnish I like how it sounds
01:48 Hotkeys oops wrong place
01:49 gtodd the incredible ease of writing perl6 means it gets to go slower as a courtesy :-)  but maybe not 48 times slower :-)
01:50 gtodd when I say ease I don't know if that is true since I'm already familiar with perl ...
01:50 timotimo yes, you can of course mmap the file contents
01:50 Hotkeys I think the TIMTOWTDI philosophy allows it to be pretty easy to write
01:51 teatime I'm not sure mmap necessarily helps you a lot
01:51 Hotkeys plus I like some of the syntactic stuff vs perl 5
01:51 timotimo that'll at least make managing what parts have to be in memory easy as pie
01:51 Hotkeys like how you don't have to inflect sigils in p6 :p
01:52 gtodd timotimo: is sorting a hash with  *.value likely to be faster ?  I did it the perl5 way just because ...
01:52 timotimo gtodd: what do you mean?
01:52 gtodd the tow argument sort bit
01:52 timotimo i haven't measured, but i suspect providing a one-arg closure ought to be faster than a two-arg one would
01:53 gtodd for %hash.pairs.sort: { $^b.value <=> $^a.value } -> $pair ...
01:56 gtodd for %hash.pairs.sort(*).value -> $pair
01:56 gtodd oops
01:56 timotimo no, you want ... yeah, you already know
01:58 timotimo 1.17845626
01:58 timotimo 0.979253
01:58 timotimo ^- -*.value is a very small bit faster than $^b.value <=> $^a.value is
01:58 gtodd yeah
02:00 timotimo 11.56888847
02:00 timotimo 9.538449
02:00 timotimo ^- even with much bigger value sets it's still roughly the same ratio
02:01 timotimo but creating that hash takes a while :D
02:01 timotimo 140k entries, this one hash has
02:01 gtodd yes
02:02 timotimo mine is just my %hash = ('aaaa'..'hzzz') Z=> (rand xx *)
02:02 gtodd but builtin schwartzian transform :-D
02:03 araujo_ joined #perl6
02:04 Hotkeys for a second I was parsing <=> as <-> but for =>
02:04 Hotkeys and got confused
02:04 gtodd when I'm looping does it look childish to write:  state $i = 0 ; $i++ ; last if $i == 6;
02:05 gtodd does perl6 have the concept of "baby perl"?
02:05 Hotkeys at that point why not just use a c-style loop
02:05 gtodd I am teenybopper perl in perl5 so ...
02:05 Hotkeys you could do 'for ^6 -> $i { ... }'
02:06 Hotkeys or ^7
02:06 Hotkeys if you want to do things with 6
02:06 gtodd that's the ticket!
02:06 Hotkeys but ^6 is the range 0..5
02:06 Hotkeys well technically 0..^6
02:06 gtodd at the start if for loop before the assignment arrow
02:07 timotimo me personally i'd loop over the thing's [^6] or [^7] depending on what you want, or i'd write last if $++ == 6
02:08 Hotkeys yeah
02:08 Hotkeys if you're doing it with an array or something I'd do for @a[^6]
02:09 Hotkeys but /o\
02:09 timotimo well, you have a sequence there
02:09 timotimo doesn't slicing work properly there?
02:09 Hotkeys hm?
02:10 gtodd $++ wtH?
02:10 gtodd heheh
02:10 Hotkeys $ is the magical anonymous state var
02:10 gtodd $++ is a thing!
02:11 timotimo it is!
02:11 timotimo you can also ++$ if you want
02:11 gtodd it comes from Mu ?
02:11 timotimo no, it's a language syntax
02:11 gtodd ok it comes from nowhere  :-) and when I ++ it the first time it becomes 0 :-D
02:11 gtodd perl6 -e 'say $++'
02:11 teatime how do I read docs for modules, e.g. YAMLish or JSON::Tiny... is there a perl6doc?  perl --doc Module::Name doesn't seem to ever find anything
02:11 Hotkeys m: say ++$
02:11 camelia rakudo-moar 81558b: OUTPUT«1␤»
02:12 gtodd wheee
02:12 Hotkeys m: for ^3 { say $++ }
02:12 camelia rakudo-moar 81558b: OUTPUT«0␤1␤2␤»
02:12 Hotkeys m: for ^3 { say ++$ }
02:12 camelia rakudo-moar 81558b: OUTPUT«1␤2␤3␤»
02:12 timotimo teatime: yeah, perl6 --doc will work the same way as perl6 would for finding what code to consider, so you'd have to give the file name. there's p6doc, though
02:13 gtodd ++$ incrementing happens before the state of magic is invoked with  $++ happens after
02:14 gtodd hmm so $ can replace state in a lot of places then
02:15 kid51 joined #perl6
02:16 teatime does panda know how to install executables
02:18 timotimo yeah, i think it does
02:18 timotimo some modules have something in bin/
02:18 timotimo mi6 is probably an example
02:18 teatime Tried 'panda install p6doc', which, p6doc is already installed.  but I don't know where it's bin is supposed to be.
02:19 avenj joined #perl6
02:19 teatime I assume panda is installing modules to ~/.perl6 ?
02:19 teatime the dir structure is kindof inscrutable.
02:21 colomon joined #perl6
02:22 timotimo if you have rakudobrew, it'll put the binaries in the same folder than it has for perl6, doesn't it? i'm not sure
02:22 teatime that's where it put the panda bin
02:22 teatime but panda hasn't put anything there?
02:25 arc__ joined #perl6
02:25 arcetera joined #perl6
02:28 timotimo hm.
02:28 timotimo /home/timo/perl6/install/share/perl6/site/bin
02:28 cdg_ joined #perl6
02:28 timotimo that's what i have
02:29 Hotkeys I really wish flat worked on lists of arrays
02:29 Hotkeys m: say flat [[-36, -18, 0], [8, 99, 112], [14, 6, -12]]
02:29 camelia rakudo-moar 81558b: OUTPUT«([-36 -18 0] [8 99 112] [14 6 -12])␤»
02:29 Hotkeys or arrays of arrays, but the same happens with a list
02:32 teatime timotimo: heh, I have nothing like that, just ~/.perl6 and ~/.rakudobrew
02:33 gtodd m; say "be good"; my %hash; my $string="abcdefabcgbacbdebdbbcaebfebfebfeb"; for $string.comb.rotor(5 => -4) -> $k { %hash{$k}++ ; }; for ( %hash.pairs.sort(-*.value) )[^5] -> $pair { say  $pair ; }
02:33 timotimo teatime: the install/ is inside rakudobrew's target folder
02:33 gtodd hehe
02:33 gtodd m: say "be good"; my %hash; my $string="abcdefabcgbacbdebdbbcaebfebfebfeb"; for $string.comb.rotor(5 => -4) -> $k { %hash{$k}++ ; }; for ( %hash.pairs.sort(-*.value) )[^5] -> $pair { say  $pair ; }
02:33 camelia rakudo-moar 81558b: OUTPUT«be good␤e b f e b => 3␤b f e b f => 2␤f e b f e => 2␤e b d b b => 1␤f a b c g => 1␤»
02:34 sortiz teatime, in .rakudobrew you should have a dir for every installed version, search in ./moar-nom/install/...
02:34 gtodd now to make it work when $string is a billion characters long ....
02:34 gtodd muwahahah
02:35 kurahaupo joined #perl6
02:35 molaf__ joined #perl6
02:36 timotimo gtodd: you may want to use a buf of int8 for this, as our string will use 32bit for every single character :)
02:37 * timotimo ought to go to bed
02:37 teatime aha, find reveals p6doc is at .rakudobrew/moar-nom/install​/share/perl6/site/bin/p6doc
02:37 sortiz rakudobrew keeps symlinks to the current installed binaries in its own bin dir, you can 'rakudobrew rehash" to refresh them.
02:38 gtodd :-D
02:38 teatime sortiz: exactly what I was looking for, thxmuch
02:38 teatime yay all fixed
02:38 sortiz yw
02:41 gtodd timotimo: but then I can't haz comb :)
02:41 gtodd and rotor
02:42 gtodd hehe
02:46 gtodd well I get rotor but then it prints out 99 instead of "a" and 98 instead of "f" :)
02:46 johndau joined #perl6
02:46 geekosaur joined #perl6
02:52 kalkin- joined #perl6
03:03 Herby_ joined #perl6
03:03 Herby_ Evening, everyone!
03:08 gtodd timotimo: didn't do :bin but
03:09 gtodd perl6 -e 'my %hash; my $string=slurp "nucleotide.data2", enc => "utf8"; for $string.comb.rotor(5 => -4) -> $k { %hash{$k}++ ; }; for ( %hash.pairs.sort(-*.value) )[^5] -> $pair { say  $pair ; } '  brought the time down to 523s from 1300s
03:10 timotimo i'm not sure what exactly you changed there, tbh
03:10 timotimo but as i said: bedtime nao
03:16 BenGoldberg m: say "be good"; my %hash; my $string="abcdefabcgbacbdebdbbcaebfebfebfeb"; for $string.comb.rotor(5 => -4) -> $k { %hash{$k}++ ; }; for ( %hash.sort(-*.value) )[^5] -> $pair { say  $pair ; }
03:16 camelia rakudo-moar 81558b: OUTPUT«be good␤e b f e b => 3␤b f e b f => 2␤f e b f e => 2␤e b d b b => 1␤f a b c g => 1␤»
03:17 BenGoldberg What does .pairs do to a hash?  I used to know, but it's almost my bedtime ;)
03:22 gtodd BenGoldberg: it put the keys and values together
03:23 gtodd it puts the keys and values together in a two item list
03:25 gtodd like List::Util 'pairs' in perl5
03:26 kurahaupo joined #perl6
03:27 BenGoldberg How does %hash.pairs.sort(...) differ from %hash.sort(...)
03:29 noganex joined #perl6
03:40 kaare_ joined #perl6
03:44 gtodd good question :-D
03:45 gtodd I though .pairs.sort(-*.value)  was needed to get at the values
03:46 gtodd I thought
03:46 gtodd buit it seems not to be needed
03:48 gtodd for %hash.pairs -> $kvpair  { }.... returns the pairs as lists in $kvpairs  and you do what you want
03:48 gtodd %hash.sort(*.value) knows what to do ....
03:50 gtodd is a bit more readable in comparison with pumpkin perl's List::Util=pairs ... where you have to dig into the array ref that is returned if you want to sort by values
03:51 gtodd my %hash = qw/q 1 w 2 e 3 r 4 t 5 y 6 / ;  use List::Util 'pairs' ; say  join ( " => ",   @$_ ) for sort { $a->[1] cmp $b->[1]  } pairs %hash
03:57 cdg joined #perl6
04:26 BenGoldberg joined #perl6
04:26 vendethiel joined #perl6
04:30 cpage_ joined #perl6
04:32 MadcapJake how would I represent a bitfield in NativeCall?
04:42 Hotkeys gtodd: I got confused by your last message there because I thought it was p6
04:42 Hotkeys and was like "this isn't valid at all"
04:43 gtodd there comes a day when perl6 will just recognize and run p5 code without having to be told :)
04:44 gtodd then it won't matter
04:44 BenGoldberg Even in C, a bitfield can only exist within a struct.
04:45 gtodd heheh
04:46 sortiz MadcapJake, NYI, you can try with a proper sized int (depends on struct alignment details) and do masking yourself.
04:46 sortiz s/do/do the/
04:50 BenGoldberg MadcapJake, What library are you dealing with that is giving you / wants from you, a bitfield.
05:02 Hotkeys <gtodd> there comes a day when perl6 will just recognize and run p5 code without having to be told :)
05:02 Hotkeys I think that would just be perl 5 then
05:02 Hotkeys which gets a no thanks from me
05:05 BenGoldberg m: use v5; say 'ok';
05:05 camelia rakudo-moar 81558b: OUTPUT«===SORRY!===␤Could not find Perl5 in:␤    /home/camelia/.perl6␤    /home/camelia/rakudo-m-inst-1/share/perl6/site␤    /home/camelia/rakudo-m-inst-1/share/perl6/vendor␤    /home/camelia/rakudo-m-inst-1/share/perl6␤    CompUnit::Repository::Absol…»
05:07 sevvie joined #perl6
05:13 MadcapJake .tell BenGoldberg GLFW/OpenGL
05:13 yoleaux MadcapJake: I'll pass your message to BenGoldberg.
05:13 MadcapJake anyone wanna try it out 8)
05:15 MadcapJake https://gist.github.com/Madc​apJake/b7aa09af1937797dc851
05:16 MadcapJake it's super duper slow but still really cool that it works!
05:22 MadcapJake I always finish things when no one is online anymore xD
05:28 MadcapJake frames change about every 15 seconds or so :P
05:30 * sortiz online, fighting with my own NC bindings.
05:41 kmwallio does anyone know what "Missing or wrong version of dependency 'p6scalarfromdesc'" means?
05:47 Cabanossi joined #perl6
05:49 kmwallio MadcapJake: all I see is a triangle...
05:49 kmwallio jk
05:49 kmwallio that's pretty cool
05:58 MadcapJake kmwallio: that's mostly all I see too! give it a minute and it might move O_O
05:59 tmch joined #perl6
06:01 jack_rabbit joined #perl6
06:01 CIAvash joined #perl6
06:01 teatime help me understand how “my @L = (1, 2, 3);” and “my @L = [1, 2, 3];” differ.
06:02 teatime or how “(1, 2, 3)” and “[1, 2, 3]” differ, in general.
06:05 kmwallio p6: (1, 2, 3) eq [1, 2, 3]
06:05 camelia rakudo-moar 81558b: OUTPUT«WARNINGS for /tmp/tmpfile:␤Useless use of "eq" in expression "(1, 2, 3) eq [1, 2, 3]" in sink context (line 1)␤»
06:06 kmwallio p6: say (1, 2, 3) eq [1, 2, 3]
06:06 camelia rakudo-moar 81558b: OUTPUT«True␤»
06:07 bjz joined #perl6
06:11 teatime if you mean to say they're completely equivalent, I'm pretty sure that's not the case.
06:11 sortiz m: .WHAT.say for (1,2,3), [1,2,3];
06:11 camelia rakudo-moar 81558b: OUTPUT«(List)␤(Array)␤»
06:12 sortiz teatime, The first is an inmutable List, the second an Array container.
06:12 wamba joined #perl6
06:13 kmwallio ah...
06:13 sortiz You normally use a List to initialize an Array
06:13 kmwallio I learned something new today...
06:14 teatime does => always create a Pair() in all contexts ?
06:14 sortiz teatime, Yes.
06:14 teatime ty
06:15 teatime actually one more thing; help me understand list inter-leaving (that's the wrong word) like the | operator
06:15 Timbus junctions
06:15 teatime where [ a(), b() ] might give [ 1, 2, 3, 4 ] but [ c(), d() ] might give [ [1,2], [3,4] ]
06:15 Timbus or
06:16 Timbus .. oh the slip
06:16 teatime yes, that's the word :)
06:16 teatime trying to figure out how to control it when my routine returns a list
06:17 sortiz m: my @a = (1,2,3,4),(2,3,4,5); dd @a; # First case
06:17 camelia rakudo-moar 81558b: OUTPUT«Array @a = [(1, 2, 3, 4), (2, 3, 4, 5)]␤»
06:17 sortiz m: my @a = |(1,2,3,4),|(2,3,4,5); dd @a; # Second case
06:17 camelia rakudo-moar 81558b: OUTPUT«Array @a = [1, 2, 3, 4, 2, 3, 4, 5]␤»
06:18 teatime yeah, I have figured out that that specific syntax works.
06:19 Timbus uh, iirc a | prefix will convert a List/Array to a Slip
06:19 Timbus a Slip will flatten for you
06:19 rindolf joined #perl6
06:20 Timbus sooo, i guess.
06:20 Timbus m: sub slippy { return (|(4,5)) }; say (1,2,3,slippy,6)
06:20 camelia rakudo-moar 81558b: OUTPUT«(1 2 3 4 5 6)␤»
06:20 sortiz A Slip is a List that want to be flattened when used.
06:20 Timbus m: sub slippy { return |(4,5) }; say (1,2,3,slippy,6)
06:20 camelia rakudo-moar 81558b: OUTPUT«(1 2 3 (4 5) 6)␤»
06:20 Timbus didn't think so..
06:22 sortiz m: (|(1,2)).WHAT.say
06:22 camelia rakudo-moar 81558b: OUTPUT«(Slip)␤»
06:22 sortiz m: |(1,2).WHAT.say
06:22 camelia rakudo-moar 81558b: OUTPUT«(List)␤»
06:24 sortiz "when used" ;-)
06:26 Timbus or is it..?
06:26 Timbus m: my $a = |(1,2); say $a.WHAT
06:26 camelia rakudo-moar 81558b: OUTPUT«(Slip)␤»
06:27 sortiz Yep, an scalar can hold any object.
06:29 teatime nice, this actually works:
06:29 teatime @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
06:29 teatime *argh*
06:29 teatime m: @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
06:29 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/3kRrkS6JT6␤Variable '@L' is not declared␤at /tmp/3kRrkS6JT6:1␤------> 3<BOL>7⏏5@L=(1,2,3); sub fun($n){~$n xx $n}; say ␤»
06:29 * teatime is failing so hard right now.
06:29 teatime m: my @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
06:29 camelia rakudo-moar 81558b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/9pEJwo6CMV␤Unable to parse expression in argument list; couldn't find final ')' ␤at /tmp/9pEJwo6CMV:1␤------> 3@L.map({fun($_)}); say @L.map({|fun($_)}7⏏5<EOL>␤    expecting any of:␤        post…»
06:29 Timbus it happens
06:30 teatime well, works locally anyway.
06:30 Timbus you only forgot the )
06:30 Timbus m: my @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)})
06:30 camelia rakudo-moar 81558b: OUTPUT«((1) (2 2) (3 3 3))␤(1 2 2 3 3 3)␤»
06:31 teatime is there a simpler map syntax? .map(fun(*)) doesn't seem to work like I expect, .map{fun($_)} seems flat invalid.
06:32 Timbus ?
06:32 Timbus m: my @L=(1,2,3); sub fun($n){$n xx $n}; say @L.map(*.&fun); say @L.map(|*.&fun)
06:32 camelia rakudo-moar 81558b: OUTPUT«((1) (2 2) (3 3 3))␤(1 2 2 3 3 3)␤»
06:32 Timbus :>
06:33 teatime so why doesn't .map(fun(*)) work?
06:33 teatime m: my @L=(1,2,3); sub fun($n){$n xx $n}; say @L.map(fun(*));
06:33 camelia rakudo-moar 81558b: OUTPUT«Cannot call map(Array: Seq); none of these signatures match:␤    ($: Hash \h, *%_)␤    (\SELF: &block;; :$label, :$item, *%_)␤    (HyperIterable:D $: &block;; :$label, *%_)␤  in block <unit> at /tmp/fOQr2fHJF_ line 1␤␤»
06:34 Timbus guess it can't turn that into a block for you
06:34 teatime while we're at it why doesn't this work:  use Data::Dump; @L=<a b c>; say Dump: @L
06:35 Timbus don't have that module, im afraid
06:37 Timbus uhh but yeah, map(fun(*)) indeed converts to: map(fun({$_}))
06:37 Timbus so that's one question answered
06:38 teatime so is that passing a block to fun() and expecting fun() to return a callable?
06:38 teatime rather than passing a block to map like I was expecting it to.
06:39 Timbus yes
06:40 Timbus oh and, '.map{fun($_)} seems flat invalid.'. Correct, but you can use .map: {fun($_)}
06:41 CIAvash teatime: `Dump: @L` is incorrect. That syntax is only for methods, I think. Use `Dump(@L)` or `Dump @L`
06:41 xinming_ joined #perl6
06:42 teatime heh, I was overlooking the simplicity of just doing Dump @L
07:03 Hotkeys if it were a method that took @L as the invocant you could do `Dump @L:` probably
07:03 Hotkeys :p
07:04 Cabanoss- joined #perl6
07:05 Hotkeys m: my @a = 'a'..'z'; say join @a:; say join @a: ' ';
07:05 camelia rakudo-moar 81558b: OUTPUT«abcdefghijklmnopqrstuvwxyz␤a b c d e f g h i j k l m n o p q r s t u v w x y z␤»
07:38 cpage_ joined #perl6
07:46 domidumont joined #perl6
07:46 gflohr joined #perl6
07:46 gflohr1 joined #perl6
07:48 gflohr joined #perl6
07:56 gflohr joined #perl6
08:02 firstdayonthejob joined #perl6
08:09 teatime so, 0 is false still but now "0" is true?  (no more "0 but true"? :)
08:13 darutoko joined #perl6
08:16 sortiz m: my $a =  0 but role { method Bool { True } }; say so $a;  # Unless you need otherwise ;-)
08:16 camelia rakudo-moar 81558b: OUTPUT«True␤»
08:19 teatime "0" being false always feels very wrong to me.
08:20 nadim joined #perl6
08:21 gflohr joined #perl6
08:23 sortiz major paradigm shift :)
08:27 [particle]1 joined #perl6
08:27 _nadim joined #perl6
08:35 solarbunny joined #perl6
08:35 kurahaupo joined #perl6
08:48 solarbunny joined #perl6
08:56 pnu joined #perl6
09:00 isBEKaml joined #perl6
09:01 gflohr joined #perl6
09:02 vendethiel joined #perl6
09:05 gflohr1 joined #perl6
09:07 moritz the main point where that breaks is people setting environment variables to 0, and 'if %ENV<MYVAR> { ... }' being true
09:11 teatime heh, I would probably prefer %ENV<MYVAR> being true if someone did `export MYVAR=""`, but I guess that's what exists is for.
09:15 RabidGravy joined #perl6
09:18 sortiz \o good * moritz
09:36 RabidGravy what is an SCRef? I've done something stupid in some code and aam getting "Missing serialize REPR function for REPR SCRef" but haven't the faintest what
09:45 moritz it can't serialize a reference to a serialization context? how... recursively meta
09:45 Timbus teatime, soritz kinda showed you already, but you can indeed use `0 but True`.. except not as a string
09:46 Timbus m: my $a = 0 but True; say ?$a; say $a;
09:46 camelia rakudo-moar 81558b: OUTPUT«True␤0␤»
09:46 moritz m: my $a = "0" but False; say so $a
09:46 camelia rakudo-moar 81558b: OUTPUT«False␤»
09:46 RabidGravy moritz, but how would I have managed to get one in this code uninitentionally?
09:46 Timbus that too
09:47 moritz RabidGravy: dunno. Do you do funny things at compile time?
09:47 solarbunny joined #perl6
09:50 RabidGravy moritz, well mixing in a role to a classes HOW, but that works fine in elsewhere
09:50 teatime neat stuff.
09:51 RabidGravy ah wait, maybe that is it, I'm not actually testing with the class that happens to in a separate file
09:51 pnu joined #perl6
09:56 masak good antenoon, #perl6
09:59 moritz \o masak, *
10:03 pnu joined #perl6
10:04 sortiz \o masak
10:05 pdcawley_ joined #perl6
10:09 masak that feeling when your (newly written) code is 25% implementation and 75% tests
10:10 masak the rest of the world still seems to have a problem adopting TDD. that's not the problem I have :P
10:11 solarbunny joined #perl6
10:12 pnu joined #perl6
10:16 RabidGravy masak, I've got quite a lot of stuff like that
10:16 pnu joined #perl6
10:17 Vlavv_ joined #perl6
10:17 masak RabidGravy: nice!
10:18 masak RabidGravy: I teach a lot of courses. when I ask participants whether they write tests, most of them put on faces as if I asked them whether they exercise regularly and eat their spinach.
10:20 RabidGravy I've actually worked with people who were otherwise quite clever who declared that unit tests were pointless
10:20 solarbunny joined #perl6
10:21 teatime “<dead_diaeresis> <acute> : "̈́"   U0344 # COMBINING GREEK DIALYTIKA TONOS”  ← omg, X11/X.org, why did you have to put lines like this in the files I need to parse.
10:21 teatime this just threw a wrench in my plans.
10:21 RabidGravy so anyway I've narrowed this SCRef thing to calling $method.wrap() in an over-ridden compose on a class
10:21 RabidGravy which is odd
10:23 masak m: class C { has Int $!x; method set-x(Str $!x) {} }; say "alive"
10:23 camelia rakudo-moar 81558b: OUTPUT«alive␤»
10:24 masak this is a situation where we could catch at compile time and say "would never work"
10:27 bjz joined #perl6
10:30 * masak has one of those rare uses of infix:<^^>
10:31 mst sometimes I have trouble distinguishing perl6 code and anime emoticons
10:32 kjs_ joined #perl6
10:37 cpage_ joined #perl6
10:41 masak mst: if you think this is an accident... ^..^
10:48 pnu joined #perl6
10:48 pnu joined #perl6
11:05 _nadim African greetings!
11:05 pnu joined #perl6
11:05 pnu joined #perl6
11:06 _nadim I have a class and an infix<eqv> but it seems thatthe infix definition is only known in the compiling unit, if there is such a thing, so my dumpers find object to not be equivalent when they are. what am I doing wrong?
11:07 _nadim or more precisely, can I make the infix definition part of the class?
11:10 kjs_ joined #perl6
11:14 lizmat exporting the infix definition ?
11:14 pnu joined #perl6
11:17 masak submitting a cute little board game for your consideration: https://github.com/masak/nex
11:17 masak if someone wants to do a code review, I'd be happy and humble to receive comments on the code: https://github.com/masak/nex/​blob/master/lib/Games/Nex.pm
11:18 rudi_s Hi. Is it expected that this program causes an endless loop which consumes all memory on my system?
11:18 rudi_s class Foo { has Bool $.bar; method bar() { say $.bar; } }
11:18 rudi_s my $x = Foo.new; $x.bar();
11:18 masak rudi_s: yes
11:18 rudi_s Why?
11:18 masak rudi_s: $.bar is a method call
11:18 masak the method you're defining
11:19 masak you probably want $!bar, the attribute access
11:19 masak rudi_s: kudos for golfing the problem down to just the necessities
11:19 rudi_s Ah, thanks. I'm still a little confused when to use $.bar and $!bar. Should I always use $!bar inside my class?
11:20 rudi_s (Luckily that was easy this time, i only added the $.bar member a short while ago ;-))
11:20 rudi_s Or are there reasons to use $.bar inside my methods?
11:21 mst rudi_s: if you want your methods to go through the accessor, basically
11:21 lizmat rudi_s: if you want your class to be subclassable and "bar" would be one of the subclassable methods
11:21 mst rudi_s: i.e. I could see reasons for having 'method bar() { $!bar }' and using $.bar everywhere else
11:21 mst lizmat: that's a sane thing, right?
11:21 lizmat yes
11:22 lizmat but $!bar would be much more efficient
11:22 lizmat so it's a trade-off
11:22 mst right. on whether you want logic in there or not, basically
11:22 lizmat and $!bar would be "yours", in the case the subclass would define it's own $!bar
11:22 mst (or the possibility of logic)
11:23 rudi_s mst: lizmat: Thanks, good point. I'll think about that.
11:24 lizmat so $!bar directly reference the local attribute, $.bar is just short for self.bar
11:25 masak the question comes down to how overridable you want the access to be by subclasses, yes
11:25 masak I find that a difficult question to answer in most cases
11:26 masak but I've come to default to using $!foo for writes
11:27 sortiz rudi_s, In fact, when you declare 'has $.bar' you're creating both $!bar *and* 'method bar() { $!bar }'
11:30 rudi_s sortiz: Yeah, now it's obvious. I just assumed it's in a different "namespace", didn't think that it's really just a normal method.
11:32 solarbunny joined #perl6
11:33 perlawhirl joined #perl6
11:35 mst oh, which reminds me, is thre a current idiom for lazy build?
11:35 mst I remember there was a feature, but it was an experiment, and then it was a failed experiment, and then I lost track
11:36 lizmat I think it actually lives in module space nowadays ?
11:36 lizmat https://github.com/jonathanstowe/Attribute-Lazy
11:36 lizmat RabidGravy++  :-)
11:40 RabidGravy I think someone else made a different implementation
11:41 RabidGravy 'ang on
11:42 RabidGravy https://github.com/pierre-vigier/Perl6-AttrX-Lazy
11:44 mst do you have an opinion between them or do I get to look at both?
11:45 RabidGravy I actually thought of a "third way" which involves declaring a method to be the builder for an attribute as a trait on the method
11:45 lizmat mst: TIMTOWTDI  :-)
11:45 pmurias joined #perl6
11:46 mst RabidGravy: does yours install the block as !build_thing ?
11:46 * mst writes a lot of
11:46 spider-mario joined #perl6
11:46 mst has foo => (is => 'lazy', builder => sub { ... }); these days
11:47 RabidGravy mst, yeah you can supply a block there
11:47 mst yeah, but it doesn't get installed
11:48 RabidGravy no
11:48 mst what you've implemented is basically lazy+default
11:48 mst which, AWESOME
11:48 timotimo gtodd: a hash's .pairs (and .pairs in general) actually gives you pair objects, not a two-element-per-element list. .kv on the other hand gives you sublists containing the key and value in each sublist
11:48 mst but I've got quite addicted to having it installed as a method I can override
11:48 mst without needing to duplicate the name
11:49 mst I'll live. Moose can't do that either
11:49 RabidGravy that was part of the reason I was thinking of the third way
11:50 RabidGravy it would make it easier for roles etc to provide the builder without the main class being any the wiser
11:50 timotimo i wonder why nobody pointed out to kwallio that "eq" is string-equivalence, and lists as well as arrays will Str-ify to the stringification of their elements separated with spaces ...
11:50 rudi_s I have a list and want to skip/remove elements from the beginning until a condition becomes true (which depends on the current value) and then get the rest of the list. Is there a short solution for this?
11:50 mst has $!foo is lazy(method () { ... }); would be ok. maybe.
11:51 mst masak: where are my macros already? don't make me discover how to do Devel::Declare again :D
11:51 rudi_s Basically dropWhile from Haskell.
11:51 RabidGravy i.e. you have summat like "class F { has $.foo is lazy; ..... method burble() is builder-for('foo') { } }"
11:51 mst RabidGravy: I'd just like the block converted to a method and shoved in
11:52 mst has $.foo is lazy { <body here> };
11:52 mst compared to
11:52 mst has $.foo is lazy; method !build-foo() { <body here> }
11:52 mst (yes, I'm being precious about this, and yes, I'd also like a pony)
11:52 dalek perl6-most-wanted: 2651052 | Emeric54++ | most-wanted/modules.md:
11:52 dalek perl6-most-wanted: Update modules.md
11:52 dalek perl6-most-wanted: review: https://github.com/perl6/perl6​-most-wanted/commit/265105236b
11:52 dalek perl6-most-wanted: 6afca4e | lizmat++ | most-wanted/modules.md:
11:52 dalek perl6-most-wanted: Merge pull request #23 from Emeric54/patch-2
11:52 dalek perl6-most-wanted:
11:52 dalek perl6-most-wanted: Update modules.md
11:52 dalek perl6-most-wanted: review: https://github.com/perl6/perl6​-most-wanted/commit/6afca4e5b8
11:53 RabidGravy mst, I won't be implementing the latter. *I* am somewhat precious about avoiding the use of the names of things to mean something special to something else ;-p
11:54 mst RabidGravy: hm?
11:55 mst RabidGravy: I was saying I wanted has $.foo is lazy { <body here> }; to install a build-foo and set it as the thing to call
11:55 timotimo rudi_s: you can use .first with :k to find the index of the first thing that matches the predicate
11:55 timotimo that'd be the first piece of the puzzle for me
11:55 RabidGravy what does installing the method give you>
11:57 RabidGravy genuinely curious
11:57 masak mst: adding 'lazy build' to my list of macro use cases. thank you.
11:57 kid51 joined #perl6
11:57 mst RabidGravy: if the attribute's in a role, the class can supply it. plus subclasses can wrap or override it.
11:58 mst this is, for me, occasionally a HUGELY useful feature and has so far never caused me a problem
11:59 rudi_s timotimo: Hm. How does smart matching work with objects? Do I have to be fear stringification?
11:59 RabidGravy but then that breaks, for me, my original rule (no special names), which is why I considered my third way
12:00 timotimo the answer is "everything is an object"
12:00 timotimo smart matching has behaviour dependent on the types of objects involved
12:01 timotimo when you smart match against a string, the value in question will be stringified. the same is true for smart matching against regexes at the moment
12:01 timotimo but when you smart match against an integer range, for example, your value in question will be intified instead
12:01 timotimo well, Real-ified actually
12:01 rudi_s timotimo: But if both are my custom type can I expect === comparsion?
12:01 timotimo m: say "1.5" ~~ 0..3
12:01 camelia rakudo-moar 1d1256: OUTPUT«True␤»
12:02 timotimo then you ought to implement an ACCEPTS method to make things go the way you want them to :)
12:02 mst RabidGravy: so, in Moo(se), there were originally no special names, then we started defaulting to _build_foo and you implemented the method, then we added that syntax, and basically the convention was so strong it didn't really feel like a special name exactly, just a convention that everybody already followed so eventually the tools let us follow it with less typing
12:02 rudi_s timotimo: What is the default if I do nothgin?
12:02 masak m: my @values = 1..10; .say for @values.grep({ 5 ff * })
12:02 camelia rakudo-moar 1d1256: OUTPUT«5␤6␤7␤8␤9␤10␤»
12:02 masak rudi_s: how's that?
12:02 masak does it do what you want?
12:03 masak m: my @values = 1..10; .say for @values.grep({ 5 ^ff * })
12:03 camelia rakudo-moar 1d1256: OUTPUT«6␤7␤8␤9␤10␤»
12:03 masak ...if you don't care about the element that triggers the keeping
12:03 rudi_s masak: I haven't tested it yet, just want to know what I should expect when using $foo ~~ $bar when both are objects of a custom class I created.
12:03 timotimo rudi_s: i don't know the answer to that by heart
12:03 rudi_s masak: Ah, that looks good. Let me try.
12:04 masak rudi_s: no, I meant your use case of "start keeping elements in a list after a certain condition/element"
12:05 masak nobody took my bait to review 200 lines of game code? :) https://github.com/masak/nex/​blob/master/lib/Games/Nex.pm
12:06 timotimo i didn't even see you link to that before :|
12:07 masak rules are explained briefly in the README: https://github.com/masak/nex/blob/master/README.md
12:08 masak I recently had a good friend visit. we played our first round of this game, ever.
12:08 masak it made me eager enough to play it again with him, that I'm trying to get a game enging working on Heroku so we can play it online.
12:09 rudi_s masak: Sadly that doesn't help as ~~ per default doesn't use eqv but === and in my case I need eqv.
12:09 rudi_s Can I somehow force ff or ~~ to choose a different comparison operator?
12:10 masak rudi_s: well, you can implement your own .ACCEPTS
12:10 rudi_s *for types that I don't control.
12:10 rudi_s (Sorry for not correctly stating that before.)
12:10 masak rudi_s: but to be honest I don't feel I have a good enough overview of your problem domain to recommend that solution
12:10 masak it does sound a little bit like an XY problem or something
12:11 timotimo you can always give a block to a smart-match-expecting thing and do your own logic in there
12:11 rudi_s I have two Backtraces and want to get the common frames.
12:11 masak yeah, I'd write custom code for that
12:11 masak throw one set of frames into a hash, where the hash key is something you choose
12:12 masak then loop through the second set of frames, checking against the hash
12:12 rudi_s masak: I need the correct order.
12:12 masak you're getting it that way
12:12 masak since you're looping through the second set of frames
12:13 rudi_s timotimo: How is the block called? With just one argument (which is the left side)?
12:13 rudi_s masak: Ah, true.
12:14 rudi_s Hm. Can I get the common part of two lists (from the beginning and using eqv)? Then I could just reverse the frame list and take the matching part.
12:16 timotimo that's right
12:16 timotimo the part with the argument, i mean
12:17 rudi_s Can I iterate over two lists at the same time?
12:20 masak yes
12:20 masak m: for <a b c> Z (1, 2, 3) -> ($s, $n) { say "$s: $n" }
12:20 camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
12:20 masak but be away that the loop will stop when one of the lists stops
12:20 masak m: for <a b c d e f g> Z (1, 2, 3) -> ($s, $n) { say "$s: $n" }
12:20 camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
12:20 masak m: for <a b c> Z (1, 2, 3, 4, 5, 6) -> ($s, $n) { say "$s: $n" }
12:20 camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
12:21 masak aware*
12:23 teatime token STRCHAR { :codes <["\n]> }  ←  Is there anything like this in rakudo currently?  (want to match any codepoint except those for " and LF, in particular should match a lone combining character.)
12:24 rudi_s masak: Thanks, perfect in this case.
12:24 bpmedley joined #perl6
12:24 masak :)
12:26 timotimo teatime: no, regexes only operate on Str at the moment, support for :codes isn't implemented yet
12:26 timotimo and inside a Str, a combining codepoint cannot stand alone
12:29 teatime argh.  my whole effort is for naught, then.
12:30 lizmat teatime :-(
12:31 timotimo sorry about that :|
12:33 teatime heh, no worries.  it will work someday.
12:35 * teatime notes that p6 repl is kinda broken about unicode entry, too; I think it's because it's using Linenoise; I should try to figure out how to force Readline instead.
12:36 * RabidGravy does some dicking around with the logging thing he put aside in August
12:38 RabidGravy I think this is why I've got quite a high tempo of module releasing, if I start getting blocked on something I put it aside and make another one
12:38 RabidGravy one day all the things will be clear and I'll finish them all
12:39 RabidGravy I'm at around 10 unfinished ones right now
12:39 sortiz teatime, Readline is tried first, just install it.
12:41 cpage__ joined #perl6
12:43 teatime hrm, I have it installed... but I would have expected Readline to recognize <Home> key in addition to ctrl+a, and to not be confused by multi-byte chars
12:44 konobi linenoise?
12:46 sortiz teatime, humm, works well for me, and I have both installed. :(
12:47 sortiz And yes, Linenoise is confused by unicode
12:48 sortiz (seems to be counting bytes, not chars)
12:49 teatime right, same thing I was talking about
12:49 teatime backspacing over breaks them up by bytes too :)
12:49 teatime I'll see if I can figure out why readline isn't being used
12:49 teatime lol, 'use Readline;' fails, so I'll start thre.
12:51 teatime fixed :)
12:51 sortiz :)
12:55 teatime “Replace a semicolon (;) with a greek question mark (;) in your friend's C# code” ... that is evil.
12:56 timotimo try it in perl6 :)
12:57 timotimo m: say "what's wrong?"; say "not feeling well?"
12:57 camelia rakudo-moar 1d1256: OUTPUT«what's wrong?␤not feeling well?␤»
12:57 timotimo .u ;
12:57 yoleaux U+037E GREEK QUESTION MARK [Po] (;)
13:00 konobi https://github.com/antirez/linenoise/issues/25
13:01 RabidGravy m: class F { has $!f is Supplier.new } ; # yes typo, but mark the error message
13:01 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/njJkW5yCNq␤is trait on $-sigil variable not yet implemented. Sorry. ␤at /tmp/njJkW5yCNq:1␤------> 3class F { has $!f is Supplier7⏏5.new } ; # yes typo, but mark the error ␤    expecting any of:␤…»
13:08 teatime How would you find out what all unicode chars perl6/rakudo currently understands
13:14 isBEKaml joined #perl6
13:14 teatime you're doing 'my $dbh' in sub init_db
13:14 teatime I fail at IRC today.
13:20 timotimo we should introduce a var somewhere that tells you which unicode version your moarvm was built with
13:20 timotimo we're on the latest released unicode specification at the moment
13:20 colomon joined #perl6
13:21 kurahaupo joined #perl6
13:21 teatime I meant as Perl syntax
13:21 teatime I'm trying to find it in the rakudo source
13:22 timotimo oh, well, that's different :)
13:22 timotimo m: MY::.keys.say
13:22 camelia rakudo-moar 1d1256: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)␤»
13:22 timotimo m: CORE::.keys.say
13:22 camelia rakudo-moar 1d1256: OUTPUT«(SIGSEGV WhateverCode Slip &callframe Pair SIGHUP &flat &RETURN-LIST utf8 &infix:<∖> CurrentThreadScheduler PromiseStatus StringyEnumeration Distribution &splice &postcircumfix:<{ }> &callsame &GATHER Backtrace PF_INET6 &sinh &infix:<lt> &print &asech NF…»
13:22 teatime I did run across a directive for specifying which version of unicode to use, in my earlier reading.
13:22 timotimo m: CORE::.keys.grep(/fix/).say
13:22 camelia rakudo-moar 1d1256: OUTPUT«(&infix:<∖> &postcircumfix:<{ }> &infix:<lt> &infix:<eq> &infix:<notandthen> &infix:<o> &infix:<~|> &infix:<eqv> &infix:<⊎> &infix:<∩> &prefix:<~> &infix:«~<» &postfix:<i> &infix:<∈> &infix:<..^> &infix:«<=>» &infix:<%%> &infix:<⊉> &infix:<bu…»
13:22 teatime I assume it's unimplemented.
13:22 timotimo yeah, that's unimplemented
13:23 timotimo i've suggested that in the past, but i couldn't find an argument to why anybody would ever need to do that
13:23 timotimo except for making sure a script continues behaving exactly the way it did at some earlier point
13:24 Skarsnik joined #perl6
13:26 teatime m: CORE::.keys.grep(/<[\x7f..\x10ffff]>/)
13:26 camelia rakudo-moar 1d1256: ( no output )
13:26 teatime m: say CORE::.keys.grep(/<[\x7f..\x10ffff]>/)
13:26 camelia rakudo-moar 1d1256: OUTPUT«(&infix:<∖> &infix:<⊎> &infix:<∩> &infix:«~<» &infix:<∈> &infix:«<=>» &infix:<⊉> &infix:«(<=)» &infix:<…^> π &infix:«(>+)» &infix:<∉> &infix:<…> &infix:«=>» &infix:«(>)» &infix:«(<+)» &infix:<⊅> &infix:«+>» &infix:<≼> &…»
13:27 timotimo ah, yes :)
13:27 timotimo that's a good first approximation
13:27 Begi joined #perl6
13:30 MadcapJake Anyone tried this yet :P https://gist.github.com/Madc​apJake/b7aa09af1937797dc851
13:30 timotimo why glfw when we already have sdl2? :P
13:30 timotimo oh, wow, glbegin and glend
13:30 MadcapJake timotimo: why not? :) just was goofing around last night
13:30 timotimo didn't think i'd see them again
13:31 timotimo BBIAB
13:32 timotimo have you seen the other repo with some initial GL work? it also used glfw
13:32 MadcapJake I'm curious if there are any optimizations I can make to speed this up.  Currently the frames swap about once every 20-30 seconds xD
13:32 timotimo https://github.com/bartschuller/perl6-OpenGL
13:33 timotimo what? one frame every 20 seconds?
13:33 MadcapJake yeah
13:33 timotimo that seems ridiculously bad
13:34 MadcapJake yeah try it out for yourself! Last night I actually noticed I had a runaway QEMU that could've been slowing it down xD
13:34 masak ,
13:35 masak Noa says hi to channel :)
13:35 MadcapJake Noa?
13:35 timotimo it uses like almost no cpu time
13:36 timotimo 2.75user 0.22system 0:28.73elapsed 10%CPU (0avgtext+0avgdata 160116maxresident)k
13:36 masak MadcapJake: 1yo
13:37 MadcapJake aww
13:37 MadcapJake timotimo: how do you get that stat line?
13:37 timotimo that's just "time"
13:38 teatime hehe, Noa is a cool name.  sounds like a bond villain.
13:38 MadcapJake timotimo: how did you specify when to exit?
13:39 MadcapJake I'm getting 20-50% on CPU with time
13:39 Skarsnik Hello, is there a way in main to say this option can optionnaly have a value?
13:40 MadcapJake Skarsnik: Str :$option
13:40 timotimo i just close the window
13:40 MadcapJake Skarsnik: maybe have two multis one with option as Str and another with Bool
13:41 timotimo wanna know how to fix the script?
13:41 MadcapJake My machine is not new by any means
13:41 MadcapJake timotimo: yes!
13:41 arnsholt Or just a positional "$arg = 1"
13:41 masak m: enum Stone «:None<.> :Vertical<V> :Horizontal<H> :Neutral<n>»; my %h = Stone.enums.invert; say %h.perl
13:41 camelia rakudo-moar 1d1256: OUTPUT«{"." => "None", :H("Horizontal"), :V("Vertical"), :n("Neutral")}␤»
13:41 timotimo use the % operator on the argument to glrotatef
13:42 MadcapJake timotimo: the first one where I multiply?
13:42 timotimo yeah
13:42 masak I haven't thought hard about this, but it would be more useful in this case to get the enum *values* in the hash values
13:42 masak not their string names
13:42 timotimo apparently the higher the number, the wonkier it gets
13:42 * masak submits rakudobug, just in case he's right
13:43 timotimo and "now" and "time" already give you very high numbers. and you're multiplying them with 50 :)
13:44 MadcapJake so how should i % it?
13:44 timotimo % 360
13:45 MadcapJake timotimo: that was a huge jump in framerate! haha!
13:45 MadcapJake one per second now!
13:45 timotimo no
13:45 timotimo you're getting many more frames
13:45 timotimo but you're using the function that returns the time in seconds
13:45 timotimo use "now" instead of "time"
13:45 manchicken joined #perl6
13:46 timotimo that'll get you fractional seconds
13:46 timotimo the framerate was already excellent before
13:46 timotimo it's just that glRotatef(1000000000000, 0, 0, 1) causes the same transformation as glRotatef(1000000000001, 0, 0, 1)
13:46 Begi Is there an easy way to get the path of the current directory with Perl6 ? Something like getcwd() with Perl 5
13:46 timotimo well, with a "1" you wouldn't be able to see a difference anyway
13:46 timotimo m: say $*CWD
13:46 camelia rakudo-moar 1d1256: OUTPUT«"/home/camelia".IO␤»
13:47 Begi thanks !
13:47 timotimo yw!
13:47 timotimo i'll be AFK for a little bit
13:47 MadcapJake timotimo: thanks for the help here too!
13:47 skids joined #perl6
13:48 perlawhirl m: class Foo { method bar {%_<baz>??2!!1}; method qux {self.bar} };my $foo=Foo.new; say [$foo.bar(:baz),$foo.qux(:baz)];
13:48 camelia rakudo-moar 1d1256: OUTPUT«[2 1]␤»
13:49 perlawhirl is there a way to make bar see the lexical %_ when coming via qux ?
13:51 MadcapJake self.bar($_)
13:51 perlawhirl no, because bar expects no arguments
13:52 perlawhirl and if you tell it to expect $_ (or %_) it should complain it's already set
13:54 Skarsnik is there some issue recently with panda? it does not install for me (with rakudobrew)
13:57 tmch joined #perl6
14:02 MadcapJake apparently I had fudged the swapInterval, now the triangle rotates perfectly!
14:02 Skarsnik :)
14:14 manchicken joined #perl6
14:21 timotimo every method takes *%, though
14:22 timotimo m: class Foo { method bar {CALLER::<%*args><baz>??2!!1}; method qux(*%args is dynamic) {self.bar} };my $foo=Foo.new; say [$foo.bar(:baz),$foo.qux(:baz)];
14:22 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/kyVkeg1i49␤Can't use unknown trait 'is dynamic' in a parameter declaration.␤at /tmp/kyVkeg1i49:1␤    expecting any of:␤        rw␤        readonly␤        copy␤        required␤        raw␤   …»
14:22 timotimo m: class Foo { method bar {%*args<baz>??2!!1}; method qux(*%*args is dynamic) {self.bar} };my $foo=Foo.new; say [$foo.bar(:baz),$foo.qux(:baz)];
14:22 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/I6nu8zCgOX␤Can't use unknown trait 'is dynamic' in a parameter declaration.␤at /tmp/I6nu8zCgOX:1␤    expecting any of:␤        rw␤        readonly␤        copy␤        required␤        raw␤   …»
14:22 timotimo m: class Foo { method bar {%*args<baz>??2!!1}; method qux(*%*args) {self.bar} };my $foo=Foo.new; say [$foo.bar(:baz),$foo.qux(:baz)];
14:22 camelia rakudo-moar 1d1256: OUTPUT«[1 2]␤»
14:22 timotimo whatevs.
14:23 timotimo MadcapJake: how did you fudge swapInterval?
14:24 timotimo you set it to a high value?
14:26 rudi_s Is it expected that leading newlines in subs are ignored when calculating the line? E.g. sub foo() { \n\n\n\n\n die "x" } gives the location as line 1.
14:27 timotimo probably an artifact of how the grammar is written
14:30 rudi_s Ok. It's not a big issue, just noticed it.
14:30 timotimo it'd be nice to have that fixed
14:30 rudi_s Does MAIN() support stuff like -v -v which results in $v = 2?
14:30 timotimo i don't think so
14:30 rudi_s :-(
14:32 perlawhirl while it would be nice if MAIN was a fully fledged getopt, i think that is the kind of thing that is best left to a dedicated module, at least for now
14:32 timotimo we already have at least one getopt-style module in the ecosystem right now, iirc
14:33 RabidGravy yeah, people needs and wants are so many and varied that you could never please everyone whatever you diid
14:33 MadcapJake timotimo: yeah I accidentally had an extra 0 after the 1 :P
14:34 timotimo that'd put you at like 5 fps?
14:34 MadcapJake I guess xD it now runs smoothly so at least 30 fps
14:34 MadcapJake Still sits at just over 20% CPU but I've got an older rig
14:35 timotimo fair enough
14:35 Skarsnik timotimo, I updated gptrixie to work with castxml (I did not test really well)
14:35 timotimo wow, neat
14:35 timotimo the api you're using, i.e. glBegin/glEnd, is maximum overhead for perl6
14:35 timotimo as every single native call has much too much overhead, at the moment
14:35 MadcapJake maximum overhead?
14:35 Skarsnik gptrixie --castxml=c89
14:36 MadcapJake Skarsnik++ # Have you tried on glib? :)
14:36 timotimo OpenGL already has vertex buffer objects and stuff like that. those would be much better suited, because you'll reach your goal with much fewer calls
14:36 Skarsnik MadcapJake, na, I was too lazy to install the vboxguest addition on this vm so it's a pain to work on
14:37 MadcapJake Ah, well I'll give it a go sometime soon for sure!
14:37 Skarsnik I openned an issue and the git version of castxml should work with c99-c11 now
14:37 MadcapJake nice!
14:38 MadcapJake timotimo: cool, never used opengl but I noticed that the begin/end style calls are basically gone from the new OpenGL versions
14:38 konobi oh... gptrixie is neat
14:39 Skarsnik Feel free to fill issue about the castxml support
14:39 MadcapJake timotimo: looks like opengl-tutorial.org uses vertex array objects, is that what you're talking about?
14:39 timotimo there are VBOs and there are VAOs if i'm not mistaken
14:39 MadcapJake oi!
14:40 timotimo https://www.opengl.org/wiki/Vertex​_Specification#Vertex_Array_Object  vs  https://www.opengl.org/wiki/Buffer_Object
14:41 timotimo i don't actually grok the difference, mind you
14:41 MadcapJake yeah can't quite figure that out either xD
14:43 tadzik http://learnopengl.com/#!Get​ting-started/Hello-Triangle is nice for this
14:43 tadzik (and other chapters)
14:44 timotimo i suppose if you use a VAO, it'll build a VBO for you to hold the data on the graphics card, and will transfer the data out of the VAO into the VBO?
14:49 Begi1 joined #perl6
14:51 RabidGravy I'm sure I've encountered (and find a way,) before but if one has e.g. "enum F <Foo Bar Baz>; class G { has F $.f; }; G.new(f => Foo) ~~ Foo" where do I put the ACCEPTS to make that work?
14:52 RabidGravy I thought applying a role to the enum with the appropriate ACCEPTS worked but it doesn't seem to do anything
14:53 RabidGravy of course the cheating way is to add a Numeric to the class, but that's a bit meh
14:58 * RabidGravy adds the Numeric for the time being
14:58 timotimo hm. at some point that probably wants to work by allowing a method F to be provided, eh?
15:04 RabidGravy yeah something like that, putting a Numeric wouldn't be so nice if you wanted it for something else
15:11 Begi1 joined #perl6
15:21 RabidGravy if one has a supply and wishes to supply some subsets of that created by .grep is there any reason *not* to just create them up front rather than the first time someone wants to use them?
15:27 isBEKaml joined #perl6
15:32 Begi1 joined #perl6
15:33 RabidGravy masak, strangely apposite https://twitter.com/ThePracticalDev​/status/713379455713026048/photo/1
15:38 Begi Maybe a stupid question : how can I call my DESTROY submethod automatically, when I leave my block ? https://gist.github.com/Eme​ric54/cadd4b0acab2bb4f371d
15:40 RabidGravy with a LEAVE phasor
15:41 RabidGravy m: sub f() { LEAVE { say "byeee" };  return }; f()
15:41 camelia rakudo-moar 1d1256: OUTPUT«byeee␤»
15:45 Begi it works, thanks
15:45 RabidGravy or one a specific variable even
15:45 RabidGravy m: sub f() { my $a will leave { say "byee" }; return }; f()
15:45 camelia rakudo-moar 1d1256: OUTPUT«byee␤»
15:46 RabidGravy which may be more useful if the variable contains something which needs some finalisation
15:48 khw joined #perl6
15:54 wamba joined #perl6
15:56 Begi Can't I use my attributes inside this LEAVE phasor ?
15:59 moritz m: class A { has $.x = 42; method foo () { LEAVE { say $.x } }}; A.new.foo
15:59 camelia rakudo-moar 1d1256: OUTPUT«42␤»
15:59 moritz Begi: seems like you can
15:59 rudi_s m: SetHash.new(<A B C>) eqv SetHash.new(<C B A>)
15:59 camelia rakudo-moar 1d1256: OUTPUT«WARNINGS for /tmp/XgNyLUSory:␤Useless use of "eqv" in expression ".new(<A B C>) eqv SetHash.new(<C B A>)" in sink context (line 1)␤»
16:00 rudi_s m: say SetHash.new(<A B C>) eqv SetHash.new(<C B A>)
16:00 camelia rakudo-moar 1d1256: OUTPUT«False␤»
16:00 rudi_s Is this expected?
16:00 rudi_s I'd expect those two Sets to be equal.
16:00 moritz m: SetHash.new(<A B C>) eqv SetHash.new(<A B C>)
16:00 camelia rakudo-moar 1d1256: OUTPUT«WARNINGS for /tmp/6EHq_lBA0r:␤Useless use of "eqv" in expression ".new(<A B C>) eqv SetHash.new(<A B C>)" in sink context (line 1)␤»
16:00 moritz m: say SetHash.new(<A B C>) eqv SetHash.new(<A B C>)
16:00 camelia rakudo-moar 1d1256: OUTPUT«True␤»
16:01 moritz m: say SetHash.new(<A B C>).perl
16:01 camelia rakudo-moar 1d1256: OUTPUT«SetHash.new("C","A","B")␤»
16:02 rudi_s It looks like it compares the internal representation, sometimes it works
16:10 rudi_s Does multi sub infix:<eqv>(Setty:D $a, Setty:D $b) { $a.ACCEPTS($b) } sound like a sane implementation?
16:11 RabidGravy which is exactly the same then as ~~ which is less typing
16:11 isBEKaml_ joined #perl6
16:12 cpage_ joined #perl6
16:12 rudi_s Which does not work with is-deeply.
16:13 rudi_s m: say is-deeply(SetHash.new(<A B C>), SetHash.new(<A B C>))
16:13 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/daOoh0E4yY␤Undeclared routine:␤    is-deeply used at line 1␤␤»
16:13 RabidGravy I'd say it was fix is-deeply then
16:13 rudi_s m: use Test; say is-deeply(SetHash.new(<A B C>), SetHash.new(<A B C>))
16:13 camelia rakudo-moar 1d1256: OUTPUT«ok 1 - ␤True␤»
16:13 rudi_s m: use Test; say is-deeply(SetHash.new(<A B C>), SetHash.new(<C B A>))
16:13 camelia rakudo-moar 1d1256: OUTPUT«not ok 1 - ␤␤# Failed test at /tmp/mId6l7g7cM line 1␤# expected: SetHash.new("C","B","A")␤#      got: SetHash.new("C","A","B")␤False␤»
16:14 rudi_s Hm.
16:14 rudi_s Still, not being able to eqv two sets sounds like a bug.
16:14 rudi_s Btw. when I declare something like multi sub infix:<eqv>(Setty:D $a, Setty:D $b) { $a.ACCEPTS($b) }  - is it automatically used by all modules?
16:14 cdg joined #perl6
16:15 teatime only in the current scope like any other sub
16:15 teatime you can mark it is export and import it from other modules
16:15 RabidGravy yeah, you'd need to export it
16:16 rudi_s Hm. So I can't fix this temporarily for is-deeply?
16:16 rudi_s Not being able to compare objects which contain sets breaks my tests.
16:28 Begi m: class Foo { has $.x = 42; LEAVE { say $.x; } } { Foo.new() }
16:28 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Zhi9hSZOPx␤Variable $.x used where no 'self' is available␤at /tmp/Zhi9hSZOPx:1␤------> 3lass Foo { has $.x = 42; LEAVE { say $.x7⏏5; } } { Foo.new() }␤    expecting any of:␤        argument list…»
16:28 Begi how can i solve this ?
16:29 RabidGravy by using $!x perhaps
16:29 Begi m: class Foo { has $.x = 42; LEAVE { say $!x; } } { Foo.new() }
16:29 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/z8ddObe2ft␤Variable $!x used where no 'self' is available␤at /tmp/z8ddObe2ft:1␤------> 3lass Foo { has $.x = 42; LEAVE { say $!x7⏏5; } } { Foo.new() }␤»
16:29 rudi_s Hm. Found multi sub infix:<eqv>(Setty $a, Setty $b --> Bool) { commented in src/core/set_operators.pm - any idea why it's not used?
16:30 moritz Begi: you're trying to run LEAVE not in a method, but in the mainline of the class
16:30 Begi moritz : yeah. Can't I use Leave in the mainline of a class ?
16:31 RabidGravy well it doesn't really make sense for one thing
16:31 moritz Begi: and there it's not specific to any instance, but attributes are specific to the class
16:31 moritz Begi: what would that even do?
16:32 Begi I should use a DESTROY method, launched automatically
16:32 Begi but idk how to do
16:32 RabidGravy when?
16:32 Begi When I leave my block
16:33 moritz Begi: rakudo launches DESTROY methods for you when/if the GC runs and collects an object
16:33 gflohr joined #perl6
16:33 RabidGravy right so put the LEAVE in the block
16:34 RabidGravy or
16:34 RabidGravy m: class Foo { has $.x = 42; }; { my $a will leave { say $_.x} =  Foo.new() }
16:34 camelia rakudo-moar 1d1256: OUTPUT«42␤»
16:35 masak people think they need DESTROY far more often than they actually do
16:36 konobi is there a docker image for perl6 dev somewhere?
16:36 RabidGravy yeah in this case if the object has specific finalisation requirements then it's ignore the DESTROY and go for something like the above
16:37 masak this answer at StackOverflow (about Java, but Perl 6 qualifies perfectly) about covers it: http://stackoverflow.com/a/158370
16:37 Begi Hmm. In fact, I have to "translate" this code to Perl 6 : https://github.com/dagolden/File-push​d/blob/master/lib/File/pushd.pm#L101
16:37 Begi (PS : sorry for my  English :S)
16:38 moritz Begi: Perl 6 has indir
16:38 moritz indir( $directory, { code here } )
16:39 moritz which executes the code inside $directory, and makes sure to restore the working directory outside
16:39 ugexe is there a different (correct) way to write `$meth!?chars`? (like $meth.?chars on a private method a role may or may not supply)
16:40 moritz ugexe: I don't think so
16:40 tokomer joined #perl6
16:40 Begi Ah ? i've seen this module in the most wanted modules list, so I've try to implement it to practice
16:41 RabidGravy Begi, I think the bottom line here is that the Perl 5 DESTROY and the Perl 6 DESTROY are different, and you should look at a different way of implementing this
16:43 mst joined #perl6
16:43 Begi And have you an idea to help me ? ;)
16:44 RabidGravy I think, but haven't tried, that you could do some trick by  .add-phaser on the enclosing block when the object is created
16:44 BenGoldberg joined #perl6
16:44 ugexe can you just use END? or is that too late?
16:45 RabidGravy you want it at a block level I think
16:48 _nadim joined #perl6
16:52 * DrForr puts on the 5th game of AlphaGo vs. Lee Sedol.
16:52 nadim joined #perl6
16:56 BenGoldberg Instead of returning a Foo object which gets cleaned up when the block ends, write a method with-valid-foo(Foo:U, &userblock), which first creates a Foo, then uses try and finally to call &userblock and then clean up the Foo.
16:56 yoleaux 01:13 EDT <MadcapJake> BenGoldberg: GLFW/OpenGL
17:04 isBEKaml joined #perl6
17:05 domidumont joined #perl6
17:08 domidumont joined #perl6
17:08 nadim joined #perl6
17:09 isBEKaml left #perl6
17:11 timotimo MadcapJake are you going to keep me updated with your GL stuff? :)
17:11 frank__ joined #perl6
17:12 BenGoldberg joined #perl6
17:13 frank__ joined #perl6
17:15 _nadim joined #perl6
17:15 zakharyas joined #perl6
17:16 BenGoldberg joined #perl6
17:17 BenGoldberg .tell MadcapJake GLFW uses nonstandard terminology -- those are more commonly called bitmasks than bitfields.  Bitfields typicaly refer to special fields within a C/C++ struct which act like ints, but have a nonstandard (but fixed) size.  For example, "struct foo { int a : 3, b : 4, c : 1 };" has three integer members, all of which are bitfields.
17:17 yoleaux BenGoldberg: I'll pass your message to MadcapJake.
17:20 BenGoldberg joined #perl6
17:22 nadim joined #perl6
17:24 BenGoldberg joined #perl6
17:25 Ulti can anyone give me some intuition for when an X::TypeCheck::Binding exception is thrown?
17:29 Sgeo__ joined #perl6
17:31 Ulti aha its somethign around using $/ without type information in the signature I think
17:31 Ulti weird my grammar doesnt even parse anymore
17:37 RabidGravy m: CATCH { say $_.WHAT }; class F {method f(Int $a) {}}; F.new.f("hshs")
17:37 camelia rakudo-moar 1d1256: OUTPUT«(Binding)␤Type check failed in binding $a; expected Int but got Str ("hshs")␤  in method f at /tmp/CAYyB4xjn9 line 1␤  in block <unit> at /tmp/CAYyB4xjn9 line 1␤␤»
17:52 * sjn just saw the Koalatee columon on modules.perl6.org
17:52 sjn *faceslap*
17:53 sjn pretty good pun, in other words. :)
17:53 RabidGravy well after eight months now Lumberjack can do something almost like logging
17:55 MadcapJake timotimo: I just might, it runs better than I thought it would. I'll have to really bunker down and learn it though 😵
17:55 yoleaux 17:17Z <BenGoldberg> MadcapJake: GLFW uses nonstandard terminology -- those are more commonly called bitmasks than bitfields.  Bitfields typicaly refer to special fields within a C/C++ struct which act like ints, but have a nonstandard (but fixed) size.  For example, "struct foo { int a : 3, b : 4, c : 1 };" has three integer members, all of which are bitfields.
17:57 MadcapJake .tell BenGoldberg yeah I noticed that the docs mentioned it had a 32 bit size so I just went with int32 and it worked!
17:57 yoleaux MadcapJake: I'll pass your message to BenGoldberg.
17:59 MadcapJake That's the big thing that irks me about C is all the various styles and patterns. Like glib has all their own types that you have to learn. Ugh.
18:03 RabidGravy yeah, I've known C for some thirty odd years and I still have "#include <stdio.h>   main() { printf("%d", sizeof(sometype)) }" scattered all over the place :)
18:04 teatime hrm... trying to imagine when I would find that useful.
18:05 teatime if the type has a fixed-size everywhere like uint32_t or something, it's usually obvious.
18:05 cdg joined #perl6
18:05 RabidGravy er quite
18:05 teatime I'm more likely to use sizeof(type) directly in the code, and never know what number it returns.
18:06 cognominal joined #perl6
18:07 RabidGravy it's making nativecall bindings where some argument or return is "sometype_t" that is not apparent how big it is
18:08 teatime yeah, I thought maybe that was the context
18:09 timotimo MadcapJake: well, you can just keep the gist up to date whenever you bind more gl functions :)
18:09 teatime it's nice to not have to write explicit C extensions to wrap so's, but I wonder how common well-defined ABIs are, compared to how popular native bindings seem to be.
18:12 MadcapJake timotimo: will do! It looked like that opengl repo was on the right track too.
18:12 timotimo yeah, but it stopped really early
18:12 timotimo and ... we still really want to be using the official xml definition of the API :)
18:13 timotimo https://cvs.khronos.org/svn/repos/ogl​/trunk/doc/registry/public/api/gl.xml
18:13 Begi joined #perl6
18:14 RabidGravy I keep meaning to add the ability to read the amqp protocol definition from XML to the Net::AMQP
18:19 MadcapJake timotimo: would it be possible to parse that to write the bindings ala gptrixie?
18:21 vendethiel joined #perl6
18:22 MadcapJake Gobject-introspection writes an intermediary XML format that you can use to generate bindings too.
18:22 RabidGravy I would say that is entirely doable, is that schema used for some other things or is it unique to that project?
18:22 tadzik Koalatee columon is like Koalatee pokemon
18:22 BenGoldberg joined #perl6
18:23 MadcapJake RabidGravy: it's a special gnome format, but that covers a lot of ground.
18:23 RabidGravy it's sort of like IDL done in XML
18:24 teatime man, I am still super bummed that I can't match solitary combining chars w/ regex
18:26 mr-foobar joined #perl6
18:33 masak not sure how far we got with matching on codepoint level...
18:35 cdg_ joined #perl6
18:36 teatime timotimo said it's just not there ATM.
18:38 cdg joined #perl6
18:46 timotimo MadcapJake: of course it would be possible. go ahead :)
18:46 timotimo i didn't want to
18:50 RabidGravy well, if I had a schema to hand I'd knock up something up with XML::Class, but I'm so not going to wade through that mammoth instance to infer the structure
18:53 timotimo i don't think XML::Class would let you work with that instance without blowing your heap :P
18:53 RabidGravy yeah, we really go do with a libxml parser
18:54 RabidGravy could, could do
18:55 timotimo to be fair, that xml file is almost line-by-line-readable
18:55 RabidGravy yeah, there's just lots of it
19:02 pnu joined #perl6
19:02 solarbunny joined #perl6
19:03 timotimo it'd only have to be done once (per targeted API version)
19:27 mst and you can always make perl5 mangle it into a better format than 'lots of XML'
19:28 mst "we have a dinosaur problem, CALL IN THE VELOCIRAPTOR"
19:30 FROGGS joined #perl6
19:31 BenGoldberg joined #perl6
19:35 Ben_Goldberg joined #perl6
19:42 BenGoldberg joined #perl6
19:42 geekosaur joined #perl6
19:46 labster joined #perl6
19:59 silug joined #perl6
20:04 Ben_Goldberg joined #perl6
20:06 Ben_Goldberg m: sub with-open-file( IO::Path() $path, &callme, *%opts ) { my IO::Handle $h = open( $path, |%opts ); try { callme($h); CATCH { $h.close; die } } }
20:06 camelia rakudo-moar 1d1256: ( no output )
20:09 Ben_Goldberg joined #perl6
20:09 musiKk_ joined #perl6
20:14 Ben_Goldberg m: use MONKEY-TYPING; augment class IO::Handle { method close-after(&callme) { try { callme($self); CATCH { $self.close; die } } } };
20:14 camelia rakudo-moar 1d1256: OUTPUT«5===SORRY!5=== Error while compiling /tmp/VujaM62A6T␤Variable '$self' is not declared␤at /tmp/VujaM62A6T:1␤------> 3hod close-after(&callme) { try { callme(7⏏5$self); CATCH { $self.close; die } } } }␤»
20:14 Ben_Goldberg m: use MONKEY-TYPING; augment class IO::Handle { method close-after(&callme) { try { callme(self); CATCH { self.close; die } } } };
20:14 camelia rakudo-moar 1d1256: ( no output )
20:19 Hotkeys What is monkey typing
20:20 dvinciguerra joined #perl6
20:20 RabidGravy it allows you to augment a class like that
20:24 Ben_Goldberg joined #perl6
20:26 Hotkeys ah
20:27 Ben_Goldberg joined #perl6
20:27 Hotkeys p6 really likes monkeys
20:27 Hotkeys MONKEY-TYPING
20:27 Hotkeys MONKEY-SEE-NO-EVAL
20:28 lizmat MONKEY-GUTS
20:32 noganex_ joined #perl6
20:38 vendethiel joined #perl6
20:38 yqt joined #perl6
20:41 RabidGravy I think there should be "THIS-MONKEYS-GONE-TO-HEAVEN" and the only number allowed is 6
20:41 Xliff LOL
20:41 Xliff RabidGravy, "6" x 3
20:42 Xliff But then that would be the other place, wouldn't it?
20:42 RabidGravy :)
20:42 Xliff MOKNEY-SPEAK-NO-EVIL
20:43 RabidGravy MOKNEY?  You mean like Damon Albarn?
20:44 stmuk_ MONKEY-GONE-TO-HEAVEN
20:46 Xliff D'oh
20:46 Xliff s/KN/NK/
20:46 Xliff <- STOOPID-MONKEY
20:57 tmch joined #perl6
21:01 colomon joined #perl6
21:06 Xliff Dammit! Why are most decent XPath 2.0 or XQuery implementations written in JAVA?
21:07 Xliff Ahhh.... https://sourceforge.net/projects/xqc/
21:09 masak m: enum E <a b c>; class C { has Array[E] @.foo }; say C.new(:foo[[a, b, a], [c, b, c]])
21:09 camelia rakudo-moar e7a09e: OUTPUT«Type check failed in assignment to @!foo; expected Array[E] but got Array ($[E::a, E::b, E::a])␤  in block <unit> at /tmp/KCRJJwGnfV line 1␤␤»
21:09 masak how can I write the above constructor so that it works?
21:09 masak er, constructor call.
21:12 masak m: subset Foo of Array where { .all ~~ Int }; my Foo $foo := [1, 2, 3]; $foo[1] = "oops"; say $foo ~~ Foo # do we want to allow this?
21:12 camelia rakudo-moar e7a09e: OUTPUT«False␤»
21:13 masak or, should I say, "I appreciate how difficult this one is to plug, so do we want to be exremely conservative and disallow `my Foo $foo`, or live with something always getting through?"
21:18 pmurias Xliff: so that you can use on rakudo-jvm ;)
21:18 pmurias * use them
21:19 Xliff Hrm.
21:19 Xliff Another thing I'll need to learn, then.
21:19 Xliff How difficult will it be to get a module from rakudo-nom to interface on rakudo-jvm?
21:20 Xliff Or is the intent to have the perl6 code use rakudo-jvm instead of rakudo-moar?
21:20 Xliff s/rakudo-moar/rakudo-nom/
21:24 masak Xliff: out of curiosity, why do you want XPath 2.0 over XPath 1.0?
21:24 masak Xliff: I love how the XPath 1.0 spec is written. it's very approachable. XPath 2.0 much less so.
21:33 BenGoldberg joined #perl6
21:34 dvinciguerra joined #perl6
21:35 masak I'm curious if anyone has an answer to http://irclog.perlgeek.de/p​erl6/2016-03-26#i_12243113
21:36 masak basically because I have an (array-of-array-of-enum) attribute that I'd like to type, but I can't really see a convenient way to initialize it
21:36 masak also... wow, this heroku thing. pnu++
21:37 masak I'm just playing around so far, but... very slick.
21:37 masak I already know I want to do more of this.
21:37 masak probably end up getting a paying heroku subscription.
21:38 japhb masak: "heroku thing"?
21:38 masak https://github.com/pnu/heroku-buildpack-rakudo
21:39 masak or, to slogan it a bit, "deploy your Bailador app with git push"
21:39 masak I've known about it for two years, but I didn't really have a need until the other day
21:42 kid511 joined #perl6
21:49 BenGoldberg joined #perl6
21:49 japhb masak: What was the need that led you to it?
21:50 BenGoldberg joined #perl6
21:52 masak japhb: http://irclog.perlgeek.de/p​erl6/2016-03-26#i_12242006
21:53 japhb m: enum E <a b c>; constant EA = Array[E]; class C { has EA @.foo }; say C.new(:foo[EA([a, b, a]), EA([c, b, c])])
21:53 camelia rakudo-moar ccc38a: OUTPUT«C.new(foo => Array[Array[E]].new(Array[E].new(E::a, E::b, E::a), Array[E].new(E::c, E::b, E::c)))␤»
21:53 japhb masak: ^^ better than nothing?
21:54 BenGoldberg joined #perl6
21:55 BenGoldberg joined #perl6
21:57 masak japhb: I think that's something like what I'm looking for, yes. thanks.
21:57 masak I'll see if I can make that work in the real thing.
21:59 vendethiel joined #perl6
22:01 BenGoldberg joined #perl6
22:02 telex joined #perl6
22:02 geekosaur joined #perl6
22:03 cdg joined #perl6
22:09 BenGoldberg joined #perl6
22:11 BenGoldberg joined #perl6
22:11 masak so, the way to get the data in a POST is to do `request.body`, right?
22:11 masak I'm doing this: https://github.com/masak/nex/blob/9411d0417​67c34f8820402611d02126c7e062d8c/app.pl#L44
22:11 masak and getting `Method 'decode' not found for invocant of class 'Any'`
22:12 masak any ideas why? :/
22:13 timotimo can you print the .gist or .perl of $data or maybe request?
22:14 BenGoldberg joined #perl6
22:14 masak timotimo: it's request that seems to be Any
22:15 masak or, hm
22:15 masak no, I take that back
22:15 masak in https://github.com/tadzik/Bailador/b​lob/a471c8efaaf0f39f1a3d6e3156058423​22f39abf/lib/Bailador/Request.pm#L86
22:15 masak it's $.env<p6sgi.input> that seems to be Any
22:17 mr-foobar joined #perl6
22:17 masak aha: https://github.com/tadzik/Bailador/issues/43
22:17 BenGoldberg joined #perl6
22:20 Begi joined #perl6
22:23 BenGoldberg joined #perl6
22:24 timotimo :o
22:24 dalek ecosystem: 3abf755 | kmwallio++ | META.list:
22:24 dalek ecosystem: Add Lingua::EN::Stopwords
22:24 dalek ecosystem:
22:24 dalek ecosystem: See https://github.com/kmwallio/p6-Lingua-EN-Stopwords
22:24 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/3abf75545d
22:24 dalek ecosystem: cdc576d | jnthn++ | META.list:
22:24 dalek ecosystem: Merge pull request #178 from kmwallio/master
22:24 dalek ecosystem:
22:24 dalek ecosystem: Add Lingua::EN::Stopwords
22:24 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/cdc576de9e
22:25 BenGoldberg joined #perl6
22:25 masak kmwallio: may I suggest using a hash in https://github.com/kmwallio/p6-Lingua-EN-Stopwor​ds/blob/master/lib/Lingua/EN/Stopwords/Long.pm6 ?
22:26 masak avoids a linear search in `is-stop-word`
22:26 timotimo masak: so ... p6sgi.input is empty, but for some reason you're getting psgi.input instead?
22:27 BenGoldberg joined #perl6
22:27 masak timotimo: that might be it. not sure.
22:27 masak I'll check what I can produce in terms of debug output from my app.pl :)
22:29 timotimo just output all the %*env :P
22:30 masak or just those two
22:30 timotimo oh, wait, that's not the same kind of env
22:30 masak I tried finding that out in the Bailador source
22:31 masak didn't quite find what's setting Bailador::Request's $.env
22:31 masak any help would be appreciated ;)
22:31 BenGoldberg joined #perl6
22:31 masak oh, Bailador::Context sets it
22:31 masak so the question becomes what sets Bailador::Context's $.env
22:33 masak ah, `dispatch` in Bailador.pm does
22:34 masak and it gets passed an $env
22:34 masak argh, which gets called passing the .env from a Bailador::Request
22:35 masak tadzik: halp! :)
22:36 masak oh, it seems to come down to what HTTP::Easy::PSGI passes it as we call its .app
22:36 timotimo well, that's what the ... yeah
22:37 timotimo sorry, i was distracted :S
22:39 masak https://github.com/supernovus/perl6-http​-easy/blob/15659be138eac87be3c1865a1ee29​89a0fb11a3d/lib/HTTP/Easy.pm6#L129-L155
22:39 masak everything in .env seems to come from here
22:41 pnu joined #perl6
22:42 timotimo hm, where's the p6sgi.input would come from?
22:43 masak this is not clear to me
22:43 masak but I think I'm able to dump request.env and have a look at it
22:44 masak let me try
22:45 timotimo ya
22:45 Ulti omg my slang works with the new REPL properly now :D
22:45 Ulti https://gist.github.com/Mat​tOates/60c9a600f6f17cfe2158
22:46 masak yes, I am getting a p6sgi.input
22:46 masak and not a psgi.input
22:46 kurahaupo joined #perl6
22:46 tadzik masak: ... but I don't remember how any of this works /o\
22:47 timotimo whhhyyyyyy
22:47 masak tadzik: then we're both in the same boat right now :P
22:47 tadzik why would you call it p6sgi :(
22:47 masak I think I can work with this
22:47 masak hold on, let me try some crazy shit
22:48 tadzik . o O ( let me put on my shit glasses! )
22:48 masak web development has to hurt somewhere
22:50 masak ok, now it works
22:50 masak but I'm getting an *empty* body... which is not what I'm passing in
22:53 masak tadzik: I don't know about the why, but it seems like the PSGI module (your friendly upstream dependency) changed it at some point, and Bailador adapted: https://github.com/tadzik/Bailador/pull/44/com​mits/fe3f1f36f58ce1e1e1066a73449c2dbb2627ba6a
22:55 timotimo your friendly dependency from up the stream, on which you can depend
22:55 Xliff masak: Re - XPath 1 over XPath 2.  No reason, really. I might be falling into the higher-version-means-better train of thought.
22:55 tadzik hah, I was even the one to merge it
22:56 Xliff Certainly XPath 1 (with proper functions) can do what I need
22:56 masak Xliff: I haven't used XPath 2.0, but I heartily recommend considering XPath 1.0 if that's enough
22:56 masak I like specifications that you can read
22:57 masak tadzik: anyway, I have solved my original problem to my satisfaction.
22:57 masak and my new problem feels like something I should sleep on
22:57 tadzik is there anything in bailador that would make your problem easier to solve?
22:57 tadzik or rather: should there be
22:57 RabidGravy I started doing an XPath module, but it was just before I went to Ibiza last year and haven't picked it back up again
22:57 timotimo you're now getting the values?
22:58 masak (why is the request body empty? how can it be empty? I'm passing stuff in! I'm fairly sure I know how HTML forms work!)
22:58 masak timotimo: when I successfully decode request.env<p6sgi.input>, the result is an empty string
22:58 timotimo well, for that i recommend wireshark :P
22:59 timotimo i'm feeling way tired, but it's too soon for me to go to sleep properly :|
22:59 Xliff masak: You have a good point there, sir.
22:59 perlawhirl joined #perl6
22:59 masak timotimo: ooh, and apt-get carries it
23:00 RabidGravy I can never get wireshark to tell me what I need
23:00 RabidGravy this is probably my fault however
23:00 Xliff And I only want it for node extraction. My issue is that there are special cases that may require more .. um.... massaging.
23:00 solarbunny joined #perl6
23:00 Xliff RabidGravy, what are you trying to do?
23:01 timotimo well, it may already be enough to just turn on the "network" tab in your chrome's dev tools or something
23:01 timotimo or even to strace the process and look for read/recv
23:01 vendethiel joined #perl6
23:01 RabidGravy most recently I was trying to determine exactly what it was that an icecast source client was sending to the server when it first connects
23:03 RabidGravy I resolved it by making a server and got a bit sidetracked thereafter
23:03 Xliff m: say ^6
23:03 camelia rakudo-moar 47d21b: OUTPUT«^6␤»
23:03 Xliff m: say flat ^6
23:03 camelia rakudo-moar 47d21b: OUTPUT«(0 1 2 3 4 5)␤»
23:03 * Xliff wonders....
23:03 masak "network" tab in chrome, check
23:03 Xliff m: say flat ^b
23:03 camelia rakudo-moar 47d21b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Z0NryJoqxk␤Undeclared routine:␤    b used at line 1␤␤»
23:03 Xliff Hah!
23:04 Xliff It would be nifty if you could define a sequence and have the ^ operator work on that.
23:04 Xliff m: say flat ^'b'
23:04 camelia rakudo-moar 47d21b: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5b' (indicated by ⏏)␤  in block <unit> at /tmp/oJjPz0BYwf line 1␤␤Actually thrown at:␤  in block <unit> at /tmp/oJjPz0BYwf line 1␤␤»
23:05 * Xliff goes back under his rock.
23:05 * Xliff is now playing: LOGISTICS - Sentimentality
23:05 timotimo masak: i think the "resources" tab or what it's called also has headers and such
23:06 masak I can see request headers under the Network tab
23:06 masak they don't really tell me anything I didn't know already
23:06 masak specifically, since I'm making a POST, I'd like to be able to see the request body
23:07 masak haven't found that yet in Chrome
23:07 masak Chrome agrees it's getting an empty response back, though
23:08 Hotkeys m: sub prefix:<^> (Str $s) { 'a'..$s }; say flat ^'f';
23:08 camelia rakudo-moar 47d21b: OUTPUT«(a b c d e f)␤»
23:08 Hotkeys Xliff:
23:08 masak oh!
23:08 Hotkeys actually i suppose it would be a letter off
23:08 masak Content-Length: 0
23:09 masak this... would be a problem, yes
23:09 Hotkeys m: sub prefix:<^> (Str $s) { 'a'..^$s }; say flat ^'f';
23:09 camelia rakudo-moar 47d21b: OUTPUT«(a b c d e)␤»
23:10 * masak stares at his HTML form for a while
23:13 masak ooooooooh
23:13 masak yes, clearly I *should* go to sleep
23:14 masak wohoo, now it works :)
23:15 masak 'night, #perl6
23:15 jdv79 nite
23:15 masak stay tuned for the exciting continuation tomorrow ;)
23:23 Ben_Goldberg joined #perl6
23:24 bjz joined #perl6
23:25 cpage__ joined #perl6
23:25 cpage___ joined #perl6
23:26 Ben_Goldberg joined #perl6
23:26 Xliff Hotkeys: YAY!
23:27 Xliff I actually thought about doing that. Have to special case every sequence "type" though.
23:27 Xliff Still. p6++ for having the ability to do that.
23:27 Xliff m: say 'aa' .. 'ad'
23:27 camelia rakudo-moar 47d21b: OUTPUT«"aa".."ad"␤»
23:28 Xliff m: say 'aa'..'ad'
23:28 camelia rakudo-moar 47d21b: OUTPUT«"aa".."ad"␤»
23:28 Hotkeys m: sub infix:<+> (2,2) { 5 }; say 2+1; say 2+2; say 2+3; say 2+4
23:28 camelia rakudo-moar 47d21b: OUTPUT«Constraint type check failed for parameter '<anon>'␤  in sub infix:<+> at /tmp/LkYaUCcrI9 line 1␤  in block <unit> at /tmp/LkYaUCcrI9 line 1␤␤»
23:28 vendethiel joined #perl6
23:28 Xliff LOL
23:28 Hotkeys m: sub infix:<+> (2,2) { 5 }; say 2 + 1; say 2 + 2; say 2 + 3; say 2 + 4
23:28 camelia rakudo-moar 47d21b: OUTPUT«Constraint type check failed for parameter '<anon>'␤  in sub infix:<+> at /tmp/S7LYKqCGE4 line 1␤  in block <unit> at /tmp/S7LYKqCGE4 line 1␤␤»
23:28 Hotkeys I've had it work before
23:29 Hotkeys m: sub infix:<+> (Int 2,Int 2) { 5 }; say 2 + 1; say 2 + 2; say 2 + 3; say 2 + 4
23:29 camelia rakudo-moar 47d21b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/R27COfjCkD␤A parameter may only have one prefix type constraint␤at /tmp/R27COfjCkD:1␤------> 3sub infix:<+> (Int 27⏏5,Int 2) { 5 }; say 2 + 1; say 2 + 2; say␤»
23:29 Xliff m: sub infix:<+> (2,2) { 5 }; say 2+2
23:29 camelia rakudo-moar 47d21b: OUTPUT«5␤»
23:29 Hotkeys rude
23:29 Hotkeys oh right
23:29 Xliff :D
23:29 Hotkeys m: multi infix:<+> (2,2) { 5 }; say 2+1; say 2+2; say 2+3; say 2+4
23:29 camelia rakudo-moar 47d21b: OUTPUT«3␤5␤5␤6␤»
23:29 Hotkeys there
23:30 Xliff Hah! So it just special cases 2+2
23:30 Xliff And the regular infix:<+> takes over for everything else.
23:30 Hotkeys yeah
23:30 Hotkeys m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... 20)
23:30 camelia rakudo-moar 47d21b: OUTPUT«(0 2 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 15…»
23:30 Hotkeys oopsies
23:30 Xliff LOL
23:30 Hotkeys m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... * <= 20)
23:30 camelia rakudo-moar 47d21b: OUTPUT«(0)␤»
23:30 Hotkeys m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... * >= 20)
23:30 camelia rakudo-moar 47d21b: OUTPUT«(0 2 5 7 9 11 13 15 17 19 21)␤»
23:31 Xliff hunh?
23:31 Xliff * >= 20?
23:31 Hotkeys up until a number >= 20
23:31 Xliff Oooh
23:32 Xliff Still not up on my * syntax.
23:32 Ulti hoelzro++ new REPL got all my stuff working so now have a bioinformatics DSL shell for free >:3
23:32 Hotkeys m: say (1,2,4 ... * >= 100)
23:32 camelia rakudo-moar 47d21b: OUTPUT«(1 2 4 8 16 32 64 128)␤»
23:32 Xliff woi! \o/
23:32 Hotkeys Ulti: nice
23:33 Xliff m: say (1,3,9 ... * >= 100)
23:33 camelia rakudo-moar 47d21b: OUTPUT«(1 3 9 27 81 243)␤»
23:33 Xliff m: say (1,3,6 ... * >= 100)
23:33 camelia rakudo-moar 47d21b: OUTPUT«Unable to deduce arithmetic or geometric sequence from 1,3,6 (or did you really mean '..'?)␤  in block <unit> at /tmp/tZzGTP3yqb line 1␤␤»
23:33 Xliff m: say (0,3,6 ... * >= 100)
23:33 camelia rakudo-moar 47d21b: OUTPUT«(0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102)␤»
23:33 Xliff \O/
23:33 Hotkeys it can only magically figure out arithmetic & geometric sequences
23:33 Hotkeys anything else you have to stick a function in there
23:34 * Xliff wonders if there is a nosebleed emoji in unicode.
23:34 Hotkeys m: say (0,1, *+* ... * >= 100)
23:34 camelia rakudo-moar 47d21b: OUTPUT«(0 1 1 2 3 5 8 13 21 34 55 89 144)␤»
23:35 Xliff Yeah, so how do you say '*' * '*'
23:35 Xliff and get 1, 4, 9, 16, 25...
23:36 Xliff m: say (1, 4, *^2 ... * >= 100)
23:36 camelia rakudo-moar 47d21b: OUTPUT«(1 4 one(4, 2) one(one(4, 2), 2) one(one(one(4, 2), 2), 2) one(one(one(one(4, 2), 2), 2), 2) one(one(one(one(one(4, 2), 2), 2), 2), 2) one(one(one(one(one(one(4, 2), 2), 2), 2), 2), 2) one(one(one(one(one(one(one(4, 2), 2), 2), 2), 2), 2), 2) one(one(one(o…»
23:36 Xliff m: say (1, 4, * ** 2 ... * >= 100)
23:36 camelia rakudo-moar 47d21b: OUTPUT«(1 4 16 256)␤»
23:37 kmwallio masak: I was away from my computer, I'll change it to a hash.
23:37 Xliff m: say (1,4, * ** 2 ... * >= 100)
23:37 camelia rakudo-moar 47d21b: OUTPUT«(1 4 16 256)␤»
23:37 Xliff m: say (0,1,4, * ** 2 ... * >= 100)
23:37 camelia rakudo-moar 47d21b: OUTPUT«(0 1 4 16 256)␤»
23:38 Xliff Ah. Using last value and not an iterator.
23:38 dvinciguerra joined #perl6
23:44 Hotkeys Xliff> Yeah, so how do you say '*' * '*'
23:44 Hotkeys m: (1,2,* * * ... *)[^10].say
23:44 camelia rakudo-moar 47d21b: OUTPUT«(1 2 2 4 8 32 256 8192 2097152 17179869184)␤»
23:44 Hotkeys :p
23:45 Hotkeys or
23:45 Hotkeys m: (1,2,* × * ... *)[^10].say
23:45 camelia rakudo-moar 47d21b: OUTPUT«(1 2 2 4 8 32 256 8192 2097152 17179869184)␤»
23:45 Hotkeys gradeschool op makes that nicer to read
23:59 Xliff HotKey: I would expect the output to be (1,4,3,16,25....)
23:59 Xliff Oops.
23:59 Xliff HotKey: I would expect the output to be (1,4,9,16,25....)
23:59 Xliff At least that's what I was trying to get.

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo