»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
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␤»
ZoffixLappy wat
m: my $x = ^10; say $x.hyper.WHAT 00:14
camelia rakudo-moar 81558b: OUTPUT«(HyperSeq)␤»
ZoffixLappy m: say ^10 .WHAT
camelia rakudo-moar 81558b: OUTPUT«===SORRY!===␤Method call must either supply a name or have a child node that evaluates to the name␤»
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:15
Does anyone know if this change intentional or an unintended "bug"? Christmas release doesn't act this way. 00:16
timotimo ZoffixLappy: don't forget that >> doesn't guarantee execution order 00:19
i *think* it's just .WHAT being b0rken, because it's not a true method call, btw
m: say ^10 .perl
camelia rakudo-moar 81558b: OUTPUT«^10␤»
timotimo m: say ^10.perl
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␤»
rudi_s timotimo: But it guarantees result order, right?
timotimo yes 00:20
rudi_s Good, thanks.
timotimo "race" is the one that doesn't 00:21
ZoffixLappy Thanks!
timotimo see also the tweet i shot your way about @a.uc
ZoffixLappy timotimo, ahh. thanks. Now I see what it's doing. It's not DWIMing, it's just .Str.uc on an array 00:23
timotimo that's right 00:25
though the other interpretation is just a >> away
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􏿽xBB.uc! timotimo++ You just gave me the perfect example of 􏿽xBB. use for my talk :D
timotimo want me to blow your mind with a little snippet i wrote yesterday? 00:32
hm, though this version of that snippet i have here isn't so great 00:33
timotimo perl6 -e 'for [\~] ({ prompt("") } ... *.not) { .say }' 00:34
^- check it! :)
TreyHarr1 p6: sub MAIN ($x where { $^x > 1 }) { say 1 } 00:35
camelia rakudo-moar 81558b: OUTPUT«Usage:␤ /tmp/tmpfile <x> ␤»
timotimo well, you really want ...^ there
TreyHarr1 p6: unit sub MAIN ($x where { $^x > 1 });
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 { …»
timotimo and if you want a list of elements instead of them concatenated together, you can use [\,] instead
TreyHarr1 what's the difference there?
timotimo huh, that's something interesting you've found there 00:36
TreyHarris unit shouldn't change the signature processing, should it?
timotimo m: unit sub MAIN ($x where { $^x > 1 });␤say "hi"
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…»
timotimo i'd call that a bug 00:37
TreyHarris ok, I haven't found a workaround
ZoffixLappy It may already be reported. I recall complaining about this awhile back and I'm almost sure I filed a bug on RT
m: sub foo ($x where { $^x > 1 });
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 > …»
TreyHarris ZoffixLappy: I thought so but had trouble finding the bug 00:38
it sounded familiar to me
ZoffixLappy lemme try to look for it
TreyHarris rt.perl.org/Public/Bug/Display.html?id=66776 is the closest i found 00:40
but that isn't it
gtodd hey perl6 is fun :-D 00:41
TreyHarris but it being declarations, not "unit" per se, is interesting
ZoffixLappy I may be thinking of this: rt.perl.org/Ticket/Display.html?id=127205 sorry, too drunk to give any useful info 00:42
gtodd, it indeed is!
timotimo ZoffixLappy: how did you like my code?
gtodd there were various perl5 solutions to this problem stackoverflow.com/q/36201884/2019415 "Process string character by character" 00:43
(I tired the list::Gen)
so I winded it totally in perl6 and came up with 00:44
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
and it worked!!
ZoffixLappy timotimo, I don't think I understand what it's doin'
timotimo the sequence grabs lines from the user until one evaluates to false (so either ctrl-d or empty line) 00:46
timotimo and gives a concatenated version of all lines so far to the for block 00:46
i just thought that was the coolest thing ever. i use it to generate a dot from a bunch of dot-compatible lines
gtodd unfortunately on a million character string it was the wrong approach and took about 25 minutes to complete .... but it worked! :-P
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
gtodd: can you try slurp.lines.comb instead?
timotimo gtodd: just yesterday i noticed $file.lines was almost 60x slower than $file.slurp-rest.lines 00:47
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
timotimo: will do
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
why do you sort with a two-argument block?
i'd write it as -*.value
gtodd just goofing around trying perl5-ish things ... and it worked! :-) 00:51
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
instead of giving a single result when everything's there
you get a lazy list of partial results
m: .say for [+] (1, 1, 1, 1, 2, 2, 2, 2) 00:53
camelia rakudo-moar 81558b: OUTPUT«12␤»
timotimo m: .say for [\+] (1, 1, 1, 1, 2, 2, 2, 2)
camelia rakudo-moar 81558b: OUTPUT«1␤2␤3␤4␤6␤8␤10␤12␤»
ZoffixLappy Ah, cool
timotimo "cool"? 00:55
is that all you can say?
this is the second coming of jesus H. christ!
gtodd haha
ZoffixLappy ZOMFG! THAT'S AWEOMEAMAZINGICAN"TBELIEVEITISHAPPENING!!!!!
:P)
timotimo yes! that's better!
ZoffixLappy :) 00:56
timotimo i mean, other languages have that, too. i think haskell calls it "scan" (as opposed to "fold")
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?
timotimo well, that'd only make the first step of the program much faster 00:58
sorting the stuff, and probably also the removal of whitespace from each line, may take a moment longer
so yeah
go grab yourself a sandwich :)
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:03
well, i'll know in like 10 minutes :\ 01:08
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>␤»
TreyHarris I entered rt.perl.org/Ticket/Display.html?id=127785 01:10
timotimo Enter the MaRTix 01:13
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:15
ZoffixLappy :D 01:21
I'm in the camp of "never use 'packages' for modules" though :) Too outdated 01:22
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:23
gtodd timotimo: you were correct ... :-) but ... instead of 1550 seconds it took 1300 seconds so ... 01:26
timotimo :| 01:27
sorry about that, friend
do you have the source file? maybe i'll play around with it for a bit
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)
gtodd timotimo: I just used perl to make it :-) 01:28
timotimo how much faster is perl5 here? :( 01:29
it might be faster actually to substr shifted ranges instead of comb + rotor + join
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
perl5 does it in about 27 seconds
gtodd but differently 01:31
other perl5 scripts took 3 minutes and one minute
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 ...
gtodd heheh
I figure it was only one line so ... :-D
probably not a bottle neck :)
it's the whole making a string into a list problem 01:33
timotimo only for the first ~250 seconds ;)
gtodd it is more of a read seek index sort of problem I guess
but I figured a long anything (Str or whatever) would be good for a lazy approach ... 01:34
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
timotimo hm, but seek doesn't know about graphemes
gtodd and while away the string .... how long is a piece of string
timotimo then it comes down to whether or not you want to be able to handle unicode data incoming
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
then i'd even go so far as to read binary out of that
gtodd but A ITb long string?!? sheesh 01:37
yeah binary
++
teatime Does panda install to cwd by default?
timotimo no
m: say $*REPO.repo-chain
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…»
teatime Does it make workdir in cwd then?
timotimo it might
teatime so, I understand why I can't do this: 01:39
token TOP { ^ <LINE>* $ } 01:40
token LINE { ^^ <.ws> [ <EVENT>+ ':' <.ws> <RESULT> <.ws> ]? <COMMENT>? $$ }
gtodd timotimo: what is a fast language for string manipulation etc. I mean are there languages that love "strings"
timotimo i have no clue
teatime but is this the cleanest thing I can come up with, or is there something a little more straightforward:
token TOP { ^ <LINE>* $ }
token LINE { \n | <COMMENT> [\n|$] | <ENTRY> [\n|$] }
MadcapJake gtodd have you tried --profile?
teatime also: token ENTRY { <.ws> <EVENT>+ ':' <.ws> <RESULT> <.ws> <COMMENT>? }
gtodd: perl5? 01:41
gtodd MadcapJake: yes with the short dataset 01:41
errm small
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
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 stackoverflow.com/questions/3620188...character/
timotimo hmm. of course that reads the file in big-ish chunks 01:46
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.
teatime but premature optimization is evil; be able to justify any departure from straightforward code w/ substantial profiling gains. 01:47
Hotkeys I should learn finnish I like how it sounds 01:48
oops wrong place
gtodd the incredible ease of writing perl6 means it gets to go slower as a courtesy :-) but maybe not 48 times slower :-) 01:49
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
Hotkeys I think the TIMTOWTDI philosophy allows it to be pretty easy to write
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
Hotkeys like how you don't have to inflect sigils in p6 :p
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?
gtodd the tow argument sort bit
timotimo i haven't measured, but i suspect providing a one-arg closure ought to be faster than a two-arg one would
gtodd for %hash.pairs.sort: { $^b.value <=> $^a.value } -> $pair ... 01:53
for %hash.pairs.sort(*).value -> $pair 01:56
oops
timotimo no, you want ... yeah, you already know
1.17845626 01:58
0.979253
^- -*.value is a very small bit faster than $^b.value <=> $^a.value is
gtodd yeah
timotimo 11.56888847 02:00
9.538449
^- even with much bigger value sets it's still roughly the same ratio
but creating that hash takes a while :D 02:01
140k entries, this one hash has
gtodd yes
timotimo mine is just my %hash = ('aaaa'..'hzzz') Z=> (rand xx *) 02:02
gtodd but builtin schwartzian transform :-D
Hotkeys for a second I was parsing <=> as <-> but for => 02:04
and got confused
gtodd when I'm looping does it look childish to write: state $i = 0 ; $i++ ; last if $i == 6;
does perl6 have the concept of "baby perl"? 02:05
Hotkeys at that point why not just use a c-style loop
gtodd I am teenybopper perl in perl5 so ...
Hotkeys you could do 'for ^6 -> $i { ... }' 02:05
or ^7 02:06
if you want to do things with 6
gtodd that's the ticket!
Hotkeys but ^6 is the range 0..5
well technically 0..^6
gtodd at the start if for loop before the assignment arrow
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:07
Hotkeys yeah 02:08
if you're doing it with an array or something I'd do for @a[^6] 02:09
but /o\
timotimo well, you have a sequence there
doesn't slicing work properly there?
Hotkeys hm?
gtodd $++ wtH? 02:10
heheh
Hotkeys $ is the magical anonymous state var
gtodd $++ is a thing!
timotimo it is! 02:11
you can also ++$ if you want
gtodd it comes from Mu ?
timotimo no, it's a language syntax
gtodd ok it comes from nowhere :-) and when I ++ it the first time it becomes 0 :-D
perl6 -e 'say $++'
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
Hotkeys m: say ++$ 02:12
camelia rakudo-moar 81558b: OUTPUT«1␤»
gtodd wheee
Hotkeys m: for ^3 { say $++ }
camelia rakudo-moar 81558b: OUTPUT«0␤1␤2␤»
Hotkeys m: for ^3 { say ++$ }
camelia rakudo-moar 81558b: OUTPUT«1␤2␤3␤»
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
gtodd ++$ incrementing happens before the state of magic is invoked with $++ happens after 02:13
hmm so $ can replace state in a lot of places then 02:14
teatime does panda know how to install executables 02:16
timotimo yeah, i think it does 02:18
some modules have something in bin/
mi6 is probably an example
teatime Tried 'panda install p6doc', which, p6doc is already installed. but I don't know where it's bin is supposed to be.
teatime I assume panda is installing modules to ~/.perl6 ? 02:19
the dir structure is kindof inscrutable.
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
but panda hasn't put anything there?
timotimo hm. 02:28
/home/timo/perl6/install/share/perl6/site/bin
timotimo that's what i have 02:28
Hotkeys I really wish flat worked on lists of arrays 02:29
m: say flat [[-36, -18, 0], [8, 99, 112], [14, 6, -12]]
camelia rakudo-moar 81558b: OUTPUT«([-36 -18 0] [8 99 112] [14 6 -12])␤»
Hotkeys or arrays of arrays, but the same happens with a list
teatime timotimo: heh, I have nothing like that, just ~/.perl6 and ~/.rakudobrew 02:32
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
gtodd hehe
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 ; }
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␤»
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 ....
muwahahah
timotimo gtodd: you may want to use a buf of int8 for this, as our string will use 32bit for every single character :) 02:36
timotimo ought to go to bed 02:37
teatime aha, find reveals p6doc is at .rakudobrew/moar-nom/install/share/perl6/site/bin/p6doc
sortiz rakudobrew keeps symlinks to the current installed binaries in its own bin dir, you can 'rakudobrew rehash" to refresh them.
gtodd :-D 02:38
teatime sortiz: exactly what I was looking for, thxmuch
yay all fixed
sortiz yw 02:39
gtodd timotimo: but then I can't haz comb :) 02:41
and rotor
hehe 02:42
gtodd well I get rotor but then it prints out 99 instead of "a" and 98 instead of "f" :) 02:43
Herby_ Evening, everyone! 03:03
gtodd timotimo: didn't do :bin but 03:08
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:09
timotimo i'm not sure what exactly you changed there, tbh 03:10
but as i said: bedtime nao
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␤»
BenGoldberg What does .pairs do to a hash? I used to know, but it's almost my bedtime ;) 03:17
gtodd BenGoldberg: it put the keys and values together 03:22
it puts the keys and values together in a two item list 03:23
like List::Util 'pairs' in perl5 03:25
BenGoldberg How does %hash.pairs.sort(...) differ from %hash.sort(...) 03:27
gtodd good question :-D 03:44
I though .pairs.sort(-*.value) was needed to get at the values 03:45
I thought 03:46
buit it seems not to be needed
for %hash.pairs -> $kvpair { }.... returns the pairs as lists in $kvpairs and you do what you want 03:48
%hash.sort(*.value) knows what to do .... 03:49
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:50
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:51
MadcapJake how would I represent a bitfield in NativeCall? 04:32
Hotkeys gtodd: I got confused by your last message there because I thought it was p6 04:42
and was like "this isn't valid at all"
gtodd there comes a day when perl6 will just recognize and run p5 code without having to be told :) 04:43
then it won't matter 04:44
BenGoldberg Even in C, a bitfield can only exist within a struct.
gtodd heheh 04:45
sortiz MadcapJake, NYI, you can try with a proper sized int (depends on struct alignment details) and do masking yourself. 04:46
s/do/do the/
BenGoldberg MadcapJake, What library are you dealing with that is giving you / wants from you, a bitfield. 04:50
Hotkeys <gtodd> there comes a day when perl6 will just recognize and run p5 code without having to be told :) 05:02
I think that would just be perl 5 then
which gets a no thanks from me
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…»
MadcapJake .tell BenGoldberg GLFW/OpenGL 05:13
yoleaux MadcapJake: I'll pass your message to BenGoldberg.
MadcapJake anyone wanna try it out 8)
gist.github.com/MadcapJake/b7aa09af1937797dc851 05:15
it's super duper slow but still really cool that it works! 05:16
I always finish things when no one is online anymore xD 05:22
frames change about every 15 seconds or so :P 05:28
sortiz online, fighting with my own NC bindings. 05:30
kmwallio does anyone know what "Missing or wrong version of dependency 'p6scalarfromdesc'" means? 05:41
kmwallio MadcapJake: all I see is a triangle... 05:49
jk
that's pretty cool
MadcapJake kmwallio: that's mostly all I see too! give it a minute and it might move O_O 05:58
teatime help me understand how “my @L = (1, 2, 3);” and “my @L = [1, 2, 3];” differ. 06:01
teatime or how “(1, 2, 3)” and “[1, 2, 3]” differ, in general. 06:02
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)␤»
kmwallio p6: say (1, 2, 3) eq [1, 2, 3] 06:06
camelia rakudo-moar 81558b: OUTPUT«True␤»
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];
camelia rakudo-moar 81558b: OUTPUT«(List)␤(Array)␤»
sortiz teatime, The first is an inmutable List, the second an Array container. 06:12
kmwallio ah... 06:13
sortiz You normally use a List to initialize an Array
kmwallio I learned something new today...
teatime does => always create a Pair() in all contexts ? 06:14
sortiz teatime, Yes.
teatime ty
actually one more thing; help me understand list inter-leaving (that's the wrong word) like the | operator 06:15
Timbus junctions
teatime where [ a(), b() ] might give [ 1, 2, 3, 4 ] but [ c(), d() ] might give [ [1,2], [3,4] ]
Timbus or
.. oh the slip 06:16
teatime yes, that's the word :)
trying to figure out how to control it when my routine returns a list
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)]␤»
sortiz m: my @a = |(1,2,3,4),|(2,3,4,5); dd @a; # Second case 06:18
camelia rakudo-moar 81558b: OUTPUT«Array @a = [1, 2, 3, 4, 2, 3, 4, 5]␤»
teatime yeah, I have figured out that that specific syntax works.
Timbus uh, iirc a | prefix will convert a List/Array to a Slip 06:19
a Slip will flatten for you
Timbus sooo, i guess. 06:20
m: sub slippy { return (|(4,5)) }; say (1,2,3,slippy,6)
camelia rakudo-moar 81558b: OUTPUT«(1 2 3 4 5 6)␤»
sortiz A Slip is a List that want to be flattened when used.
Timbus m: sub slippy { return |(4,5) }; say (1,2,3,slippy,6)
camelia rakudo-moar 81558b: OUTPUT«(1 2 3 (4 5) 6)␤»
Timbus didn't think so..
sortiz m: (|(1,2)).WHAT.say 06:22
camelia rakudo-moar 81558b: OUTPUT«(Slip)␤»
sortiz m: |(1,2).WHAT.say
camelia rakudo-moar 81558b: OUTPUT«(List)␤»
sortiz "when used" ;-) 06:24
Timbus or is it..? 06:26
m: my $a = |(1,2); say $a.WHAT
camelia rakudo-moar 81558b: OUTPUT«(Slip)␤»
sortiz Yep, an scalar can hold any object. 06:27
teatime nice, this actually works: 06:29
@L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
*argh*
m: @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
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 ␤»
teatime is failing so hard right now.
m: my @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)}
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…»
Timbus it happens
teatime well, works locally anyway. 06:30
Timbus you only forgot the )
m: my @L=(1,2,3); sub fun($n){~$n xx $n}; say @L.map({fun($_)}); say @L.map({|fun($_)})
camelia rakudo-moar 81558b: OUTPUT«((1) (2 2) (3 3 3))␤(1 2 2 3 3 3)␤»
teatime is there a simpler map syntax? .map(fun(*)) doesn't seem to work like I expect, .map{fun($_)} seems flat invalid. 06:31
Timbus ? 06:32
m: my @L=(1,2,3); sub fun($n){$n xx $n}; say @L.map(*.&fun); say @L.map(|*.&fun)
camelia rakudo-moar 81558b: OUTPUT«((1) (2 2) (3 3 3))␤(1 2 2 3 3 3)␤»
Timbus :>
teatime so why doesn't .map(fun(*)) work? 06:33
m: my @L=(1,2,3); sub fun($n){$n xx $n}; say @L.map(fun(*));
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␤␤»
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
Timbus don't have that module, im afraid 06:35
uhh but yeah, map(fun(*)) indeed converts to: map(fun({$_})) 06:37
so that's one question answered 06:38
teatime so is that passing a block to fun() and expecting fun() to return a callable?
rather than passing a block to map like I was expecting it to.
Timbus yes 06:39
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`
teatime heh, I was overlooking the simplicity of just doing Dump @L 06:42
Hotkeys if it were a method that took @L as the invocant you could do `Dump @L:` probably 07:03
:p
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␤»
teatime so, 0 is false still but now "0" is true? (no more "0 but true"? :) 08:09
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␤»
teatime "0" being false always feels very wrong to me. 08:19
sortiz major paradigm shift :) 08:23
moritz the main point where that breaks is people setting environment variables to 0, and 'if %ENV<MYVAR> { ... }' being true 09:07
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:11
sortiz \o good * moritz 09:18
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:36
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
m: my $a = 0 but True; say ?$a; say $a; 09:46
camelia rakudo-moar 81558b: OUTPUT«True␤0␤»
moritz m: my $a = "0" but False; say so $a
camelia rakudo-moar 81558b: OUTPUT«False␤»
RabidGravy moritz, but how would I have managed to get one in this code uninitentionally?
Timbus that too
moritz RabidGravy: dunno. Do you do funny things at compile time? 09:47
RabidGravy moritz, well mixing in a role to a classes HOW, but that works fine in elsewhere 09:50
teatime neat stuff.
RabidGravy ah wait, maybe that is it, I'm not actually testing with the class that happens to in a separate file 09:51
masak good antenoon, #perl6 09:56
moritz \o masak, * 09:59
sortiz \o masak 10:04
masak that feeling when your (newly written) code is 25% implementation and 75% tests 10:09
masak the rest of the world still seems to have a problem adopting TDD. that's not the problem I have :P 10:10
RabidGravy masak, I've got quite a lot of stuff like that 10:16
masak RabidGravy: nice! 10:17
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:18
RabidGravy I've actually worked with people who were otherwise quite clever who declared that unit tests were pointless 10:20
teatime “<dead_diaeresis> <acute> : "􏿽xCD􏿽x84" 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
this just threw a wrench in my plans.
RabidGravy so anyway I've narrowed this SCRef thing to calling $method.wrap() in an over-ridden compose on a class
which is odd
masak m: class C { has Int $!x; method set-x(Str $!x) {} }; say "alive" 10:23
camelia rakudo-moar 81558b: OUTPUT«alive␤»
masak this is a situation where we could catch at compile time and say "would never work" 10:24
masak has one of those rare uses of infix:<^^> 10:30
mst sometimes I have trouble distinguishing perl6 code and anime emoticons 10:31
masak mst: if you think this is an accident... ^..^ 10:41
_nadim African greetings! 11:05
_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:06
or more precisely, can I make the infix definition part of the class? 11:07
lizmat exporting the infix definition ? 11:14
masak submitting a cute little board game for your consideration: 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: github.com/masak/nex/blob/master/l...mes/Nex.pm 11:17
rudi_s Hi. Is it expected that this program causes an endless loop which consumes all memory on my system? 11:18
class Foo { has Bool $.bar; method bar() { say $.bar; } }
my $x = Foo.new; $x.bar();
masak rudi_s: yes
rudi_s Why?
masak rudi_s: $.bar is a method call
the method you're defining
you probably want $!bar, the attribute access 11:19
rudi_s: kudos for golfing the problem down to just the necessities
rudi_s Ah, thanks. I'm still a little confused when to use $.bar and $!bar. Should I always use $!bar inside my class?
(Luckily that was easy this time, i only added the $.bar member a short while ago ;-)) 11:20
Or are there reasons to use $.bar inside my methods?
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
mst rudi_s: i.e. I could see reasons for having 'method bar() { $!bar }' and using $.bar everywhere else
lizmat: that's a sane thing, right?
lizmat yes
but $!bar would be much more efficient 11:22
so it's a trade-off
mst right. on whether you want logic in there or not, basically
lizmat and $!bar would be "yours", in the case the subclass would define it's own $!bar
mst (or the possibility of logic)
rudi_s mst: lizmat: Thanks, good point. I'll think about that. 11:23
lizmat so $!bar directly reference the local attribute, $.bar is just short for self.bar 11:24
masak the question comes down to how overridable you want the access to be by subclasses, yes 11:25
I find that a difficult question to answer in most cases
but I've come to default to using $!foo for writes 11:26
sortiz rudi_s, In fact, when you declare 'has $.bar' you're creating both $!bar *and* 'method bar() { $!bar }' 11:27
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:30
mst oh, which reminds me, is thre a current idiom for lazy build? 11:35
I remember there was a feature, but it was an experiment, and then it was a failed experiment, and then I lost track
lizmat I think it actually lives in module space nowadays ? 11:36
github.com/jonathanstowe/Attribute-Lazy
RabidGravy++ :-)
RabidGravy I think someone else made a different implementation 11:40
'ang on 11:41
github.com/pierre-vigier/Perl6-AttrX-Lazy 11:42
mst do you have an opinion between them or do I get to look at both? 11:44
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 :-)
mst RabidGravy: does yours install the block as !build_thing ? 11:46
mst writes a lot of
mst has foo => (is => 'lazy', builder => sub { ... }); these days 11:46
RabidGravy mst, yeah you can supply a block there 11:47
mst yeah, but it doesn't get installed
RabidGravy no 11:48
mst what you've implemented is basically lazy+default
which, AWESOME
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
mst but I've got quite addicted to having it installed as a method I can override
without needing to duplicate the name
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
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 ...
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?
mst has $!foo is lazy(method () { ... }); would be ok. maybe.
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.
RabidGravy i.e. you have summat like "class F { has $.foo is lazy; ..... method burble() is builder-for('foo') { } }"
mst RabidGravy: I'd just like the block converted to a method and shoved in
has $.foo is lazy { <body here> }; 11:52
compared to
has $.foo is lazy; method !build-foo() { <body here> }
(yes, I'm being precious about this, and yes, I'd also like a pony)
dalek rl6-most-wanted: 2651052 | Emeric54++ | most-wanted/modules.md:
Update modules.md
rl6-most-wanted: 6afca4e | lizmat++ | most-wanted/modules.md:
Merge pull request #23 from Emeric54/patch-2

Update modules.md
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:53
mst RabidGravy: hm? 11:54
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
that'd be the first piece of the puzzle for me
RabidGravy what does installing the method give you> 11:56
genuinely curious 11:57
masak mst: adding 'lazy build' to my list of macro use cases. thank you.
mst RabidGravy: if the attribute's in a role, the class can supply it. plus subclasses can wrap or override it. 11:57
this is, for me, occasionally a HUGELY useful feature and has so far never caused me a problem 11:58
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
timotimo the answer is "everything is an object" 12:00
smart matching has behaviour dependent on the types of objects involved
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
but when you smart match against an integer range, for example, your value in question will be intified instead
well, Real-ified actually
rudi_s timotimo: But if both are my custom type can I expect === comparsion?
timotimo m: say "1.5" ~~ 0..3
camelia rakudo-moar 1d1256: OUTPUT«True␤»
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
rudi_s timotimo: What is the default if I do nothgin?
masak m: my @values = 1..10; .say for @values.grep({ 5 ff * })
camelia rakudo-moar 1d1256: OUTPUT«5␤6␤7␤8␤9␤10␤»
masak rudi_s: how's that?
does it do what you want?
m: my @values = 1..10; .say for @values.grep({ 5 ^ff * }) 12:03
camelia rakudo-moar 1d1256: OUTPUT«6␤7␤8␤9␤10␤»
masak ...if you don't care about the element that triggers the keeping
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.
timotimo rudi_s: i don't know the answer to that by heart
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"
nobody took my bait to review 200 lines of game code? :) github.com/masak/nex/blob/master/l...mes/Nex.pm 12:05
timotimo i didn't even see you link to that before :| 12:06
masak rules are explained briefly in the README: github.com/masak/nex/blob/master/README.md 12:07
I recently had a good friend visit. we played our first round of this game, ever. 12:08
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.
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
Can I somehow force ff or ~~ to choose a different comparison operator?
masak rudi_s: well, you can implement your own .ACCEPTS 12:10
rudi_s *for types that I don't control.
(Sorry for not correctly stating that before.)
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
it does sound a little bit like an XY problem or something
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.
masak yeah, I'd write custom code for that
throw one set of frames into a hash, where the hash key is something you choose
then loop through the second set of frames, checking against the hash 12:12
rudi_s masak: I need the correct order.
masak you're getting it that way 12:12
since you're looping through the second set of frames
rudi_s timotimo: How is the block called? With just one argument (which is the left side)? 12:13
masak: Ah, true.
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:14
timotimo that's right 12:16
the part with the argument, i mean
rudi_s Can I iterate over two lists at the same time? 12:17
masak yes 12:20
m: for <a b c> Z (1, 2, 3) -> ($s, $n) { say "$s: $n" }
camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
masak but be away that the loop will stop when one of the lists stops
m: for <a b c d e f g> Z (1, 2, 3) -> ($s, $n) { say "$s: $n" }
camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
masak m: for <a b c> Z (1, 2, 3, 4, 5, 6) -> ($s, $n) { say "$s: $n" } 12:21
camelia rakudo-moar 1d1256: OUTPUT«a: 1␤b: 2␤c: 3␤»
masak aware*
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:23
rudi_s masak: Thanks, perfect in this case. 12:24
masak :) 12:24
timotimo teatime: no, regexes only operate on Str at the moment, support for :codes isn't implemented yet 12:26
and inside a Str, a combining codepoint cannot stand alone
teatime argh. my whole effort is for naught, then. 12:29
lizmat teatime :-( 12:30
timotimo sorry about that :| 12:31
teatime heh, no worries. it will work someday. 12:33
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:35
RabidGravy does some dicking around with the logging thing he put aside in August 12:36
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
one day all the things will be clear and I'll finish them all
I'm at around 10 unfinished ones right now 12:39
sortiz teatime, Readline is tried first, just install it.
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:43
konobi linenoise? 12:44
sortiz teatime, humm, works well for me, and I have both installed. :( 12:46
And yes, Linenoise is confused by unicode 12:47
(seems to be counting bytes, not chars) 12:48
teatime right, same thing I was talking about 12:49
backspacing over breaks them up by bytes too :)
I'll see if I can figure out why readline isn't being used
lol, 'use Readline;' fails, so I'll start thre.
fixed :) 12:51
sortiz :)
teatime “Replace a semicolon (;) with a greek question mark (􏿽xCD􏿽xBE) in your friend's C# code” ... that is evil. 12:55
timotimo try it in perl6 :) 12:56
m: say "what's wrong?"􏿽xCD􏿽xBE say "not feeling well?" 12:57
camelia rakudo-moar 1d1256: OUTPUT«what's wrong?␤not feeling well?␤»
timotimo .u 􏿽xCD􏿽xBE
yoleaux U+037E GREEK QUESTION MARK [Po] (􏿽xCD􏿽xBE)
konobi github.com/antirez/linenoise/issues/25 13:00
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:␤…»
teatime How would you find out what all unicode chars perl6/rakudo currently understands 13:08
teatime you're doing 'my $dbh' in sub init_db 13:14
I fail at IRC today.
timotimo we should introduce a var somewhere that tells you which unicode version your moarvm was built with 13:20
we're on the latest released unicode specification at the moment
teatime I meant as Perl syntax 13:21
I'm trying to find it in the rakudo source
timotimo oh, well, that's different :) 13:22
m: MY::.keys.say
camelia rakudo-moar 1d1256: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)␤»
timotimo m: CORE::.keys.say
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…»
teatime I did run across a directive for specifying which version of unicode to use, in my earlier reading.
timotimo m: CORE::.keys.grep(/fix/).say
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…»
teatime I assume it's unimplemented.
timotimo yeah, that's unimplemented
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
except for making sure a script continues behaving exactly the way it did at some earlier point
teatime m: CORE::.keys.grep(/<[\x7f..\x10ffff]>/) 13:26
camelia ( no output )
teatime m: say CORE::.keys.grep(/<[\x7f..\x10ffff]>/)
camelia rakudo-moar 1d1256: OUTPUT«(&infix:<∖> &infix:<⊎> &infix:<∩> &infix:«~<» &infix:<∈> &infix:«<=>» &infix:<⊉> &infix:«(<=)» &infix:<…^> π &infix:«(>+)» &infix:<∉> &infix:<…> &infix:«=>» &infix:«(>)» &infix:«(<+)» &infix:<⊅> &infix:«+>» &infix:<≼> &…»
timotimo ah, yes :) 13:27
that's a good first approximation
MadcapJake Anyone tried this yet :P gist.github.com/MadcapJake/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
timotimo didn't think i'd see them again
BBIAB 13:31
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
timotimo github.com/bartschuller/perl6-OpenGL
what? one frame every 20 seconds? 13:33
MadcapJake yeah
timotimo that seems ridiculously bad
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 ,
Noa says hi to channel :) 13:35
MadcapJake Noa?
timotimo it uses like almost no cpu time
2.75user 0.22system 0:28.73elapsed 10%CPU (0avgtext+0avgdata 160116maxresident)k 13:36
masak MadcapJake: 1yo
MadcapJake aww 13:37
timotimo: how do you get that stat line?
timotimo that's just "time"
teatime hehe, Noa is a cool name. sounds like a bond villain. 13:38
MadcapJake timotimo: how did you specify when to exit?
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?
MadcapJake Skarsnik: Str :$option 13:40
timotimo i just close the window
MadcapJake Skarsnik: maybe have two multis one with option as Str and another with Bool
timotimo wanna know how to fix the script? 13:41
MadcapJake My machine is not new by any means
timotimo: yes!
arnsholt Or just a positional "$arg = 1"
masak m: enum Stone «:None<.> :Vertical<V> :Horizontal<H> :Neutral<n>»; my %h = Stone.enums.invert; say %h.perl
camelia rakudo-moar 1d1256: OUTPUT«{"." => "None", :H("Horizontal"), :V("Vertical"), :n("Neutral")}␤»
timotimo use the % operator on the argument to glrotatef 13:42
MadcapJake timotimo: the first one where I multiply?
timotimo yeah
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
not their string names
timotimo apparently the higher the number, the wonkier it gets
masak submits rakudobug, just in case he's right
timotimo and "now" and "time" already give you very high numbers. and you're multiplying them with 50 :) 13:43
MadcapJake so how should i % it? 13:44
timotimo % 360
MadcapJake timotimo: that was a huge jump in framerate! haha! 13:45
one per second now!
timotimo no
you're getting many more frames
but you're using the function that returns the time in seconds
use "now" instead of "time"
timotimo that'll get you fractional seconds 13:46
the framerate was already excellent before
it's just that glRotatef(1000000000000, 0, 0, 1) causes the same transformation as glRotatef(1000000000001, 0, 0, 1)
Begi Is there an easy way to get the path of the current directory with Perl6 ? Something like getcwd() with Perl 5
timotimo well, with a "1" you wouldn't be able to see a difference anyway
m: say $*CWD
camelia rakudo-moar 1d1256: OUTPUT«"/home/camelia".IO␤»
Begi thanks ! 13:47
timotimo yw!
i'll be AFK for a little bit
MadcapJake timotimo: thanks for the help here too!
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]␤»
perlawhirl is there a way to make bar see the lexical %_ when coming via qux ? 13:49
MadcapJake self.bar($_) 13:51
perlawhirl no, because bar expects no arguments
and if you tell it to expect $_ (or %_) it should complain it's already set 13:52
Skarsnik is there some issue recently with panda? it does not install for me (with rakudobrew) 13:54
MadcapJake apparently I had fudged the swapInterval, now the triangle rotates perfectly! 14:02
Skarsnik :)
timotimo every method takes *%, though 14:21
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␤ …»
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)];
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␤ …»
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)];
camelia rakudo-moar 1d1256: OUTPUT«[1 2]␤»
timotimo whatevs.
MadcapJake: how did you fudge swapInterval? 14:23
you set it to a high value? 14:24
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:26
timotimo probably an artifact of how the grammar is written 14:27
rudi_s Ok. It's not a big issue, just noticed it. 14:30
timotimo it'd be nice to have that fixed
rudi_s Does MAIN() support stuff like -v -v which results in $v = 2?
timotimo i don't think so
rudi_s :-(
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
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
timotimo that'd put you at like 5 fps? 14:34
MadcapJake I guess xD it now runs smoothly so at least 30 fps
Still sits at just over 20% CPU but I've got an older rig
timotimo fair enough 14:35
Skarsnik timotimo, I updated gptrixie to work with castxml (I did not test really well)
timotimo wow, neat
the api you're using, i.e. glBegin/glEnd, is maximum overhead for perl6
as every single native call has much too much overhead, at the moment
MadcapJake maximum overhead?
Skarsnik gptrixie --castxml=c89
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
Skarsnik MadcapJake, na, I was too lazy to install the vboxguest addition on this vm so it's a pain to work on
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
MadcapJake nice!
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
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?
timotimo there are VBOs and there are VAOs if i'm not mistaken
MadcapJake oi!
timotimo www.opengl.org/wiki/Vertex_Specifi...ray_Object vs www.opengl.org/wiki/Buffer_Object 14:40
i don't actually grok the difference, mind you 14:41
MadcapJake yeah can't quite figure that out either xD
tadzik learnopengl.com/#!Getting-started/Hello-Triangle is nice for this 14:43
(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?
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:51
RabidGravy I thought applying a role to the enum with the appropriate ACCEPTS worked but it doesn't seem to do anything 14:52
of course the cheating way is to add a Numeric to the class, but that's a bit meh 14:53
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?
RabidGravy yeah something like that, putting a Numeric wouldn't be so nice if you wanted it for something else 15:04
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:21
RabidGravy masak, strangely apposite twitter.com/ThePracticalDev/status...48/photo/1 15:33
Begi Maybe a stupid question : how can I call my DESTROY submethod automatically, when I leave my block ? gist.github.com/Emeric54/cadd4b0acab2bb4f371d 15:38
RabidGravy with a LEAVE phasor 15:40
m: sub f() { LEAVE { say "byeee" }; return }; f() 15:41
camelia rakudo-moar 1d1256: OUTPUT«byeee␤»
Begi it works, thanks 15:45
RabidGravy or one a specific variable even
m: sub f() { my $a will leave { say "byee" }; return }; f()
camelia rakudo-moar 1d1256: OUTPUT«byee␤»
RabidGravy which may be more useful if the variable contains something which needs some finalisation 15:46
Begi Can't I use my attributes inside this LEAVE phasor ? 15:56
moritz m: class A { has $.x = 42; method foo () { LEAVE { say $.x } }}; A.new.foo 15:59
camelia rakudo-moar 1d1256: OUTPUT«42␤»
moritz Begi: seems like you can
rudi_s m: SetHash.new(<A B C>) eqv SetHash.new(<C B A>)
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)␤»
rudi_s m: say SetHash.new(<A B C>) eqv SetHash.new(<C B A>) 16:00
camelia rakudo-moar 1d1256: OUTPUT«False␤»
rudi_s Is this expected?
I'd expect those two Sets to be equal.
moritz m: SetHash.new(<A B C>) eqv SetHash.new(<A B C>)
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)␤»
moritz m: say SetHash.new(<A B C>) eqv SetHash.new(<A B C>)
camelia rakudo-moar 1d1256: OUTPUT«True␤»
moritz m: say SetHash.new(<A B C>).perl 16:01
camelia rakudo-moar 1d1256: OUTPUT«SetHash.new("C","A","B")␤»
rudi_s It looks like it compares the internal representation, sometimes it works 16:02
Does multi sub infix:<eqv>(Setty:D $a, Setty:D $b) { $a.ACCEPTS($b) } sound like a sane implementation? 16:10
RabidGravy which is exactly the same then as ~~ which is less typing 16:11
rudi_s Which does not work with is-deeply. 16:12
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␤␤»
RabidGravy I'd say it was fix is-deeply then
rudi_s m: use Test; say is-deeply(SetHash.new(<A B C>), SetHash.new(<A B C>))
camelia rakudo-moar 1d1256: OUTPUT«ok 1 - ␤True␤»
rudi_s m: use Test; say is-deeply(SetHash.new(<A B C>), SetHash.new(<C B A>))
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␤»
rudi_s Hm. 16:14
Still, not being able to eqv two sets sounds like a bug.
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?
teatime only in the current scope like any other sub 16:15
you can mark it is export and import it from other modules
RabidGravy yeah, you'd need to export it
rudi_s Hm. So I can't fix this temporarily for is-deeply? 16:16
Not being able to compare objects which contain sets breaks my tests.
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…»
Begi how can i solve this ?
RabidGravy by using $!x perhaps 16:29
Begi m: class Foo { has $.x = 42; LEAVE { say $!x; } } { Foo.new() }
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() }␤»
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?
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 ?
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
Begi: what would that even do?
Begi I should use a DESTROY method, launched automatically 16:32
but idk how to do
RabidGravy when?
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
RabidGravy right so put the LEAVE in the block 16:33
or 16:34
m: class Foo { has $.x = 42; }; { my $a will leave { say $_.x} = Foo.new() }
camelia rakudo-moar 1d1256: OUTPUT«42␤»
masak people think they need DESTROY far more often than they actually do 16:35
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
masak this answer at StackOverflow (about Java, but Perl 6 qualifies perfectly) about covers it: stackoverflow.com/a/158370 16:37
Begi Hmm. In fact, I have to "translate" this code to Perl 6 : github.com/dagolden/File-pushd/blo...hd.pm#L101
(PS : sorry for my English :S)
moritz Begi: Perl 6 has indir 16:38
indir( $directory, { code here } )
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)
moritz ugexe: I don't think so 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:40
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:41
Begi And have you an idea to help me ? ;) 16:43
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
ugexe can you just use END? or is that too late? 16:44
RabidGravy you want it at a block level I think 16:45
DrForr puts on the 5th game of AlphaGo vs. Lee Sedol. 16:52
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
timotimo MadcapJake are you going to keep me updated with your GL stuff? :) 17:11
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.
Ulti can anyone give me some intuition for when an X::TypeCheck::Binding exception is thrown? 17:25
Ulti aha its somethign around using $/ without type information in the signature I think 17:31
weird my grammar doesnt even parse anymore
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␤␤»
sjn just saw the Koalatee columon on modules.perl6.org 17:52
*faceslap*
pretty good pun, in other words. :) 17:53
RabidGravy well after eight months now Lumberjack can do something almost like logging
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.
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.
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. 17:59
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:03
teatime hrm... trying to imagine when I would find that useful. 18:04
if the type has a fixed-size everywhere like uint32_t or something, it's usually obvious. 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.
RabidGravy it's making nativecall bindings where some argument or return is "sometype_t" that is not apparent how big it is 18:07
teatime yeah, I thought maybe that was the context 18:08
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.
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
and ... we still really want to be using the official xml definition of the API :)
cvs.khronos.org/svn/repos/ogl/trun...api/gl.xml 18:13
RabidGravy I keep meaning to add the ability to read the amqp protocol definition from XML to the Net::AMQP 18:14
MadcapJake timotimo: would it be possible to parse that to write the bindings ala gptrixie? 18:19
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?
tadzik Koalatee columon is like Koalatee pokemon
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
teatime man, I am still super bummed that I can't match solitary combining chars w/ regex 18:24
masak not sure how far we got with matching on codepoint level... 18:33
teatime timotimo said it's just not there ATM. 18:36
timotimo MadcapJake: of course it would be possible. go ahead :) 18:46
i didn't want to
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:50
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
could, could do 18:54
timotimo to be fair, that xml file is almost line-by-line-readable 18:55
RabidGravy yeah, there's just lots of it
timotimo it'd only have to be done once (per targeted API version) 19:03
mst and you can always make perl5 mangle it into a better format than 'lots of XML' 19:28
"we have a dinosaur problem, CALL IN THE VELOCIRAPTOR"
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 ( no output )
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 } } } }␤»
Ben_Goldberg m: use MONKEY-TYPING; augment class IO::Handle { method close-after(&callme) { try { callme(self); CATCH { self.close; die } } } };
camelia ( no output )
Hotkeys What is monkey typing 20:19
RabidGravy it allows you to augment a class like that 20:20
Hotkeys ah 20:27
Hotkeys p6 really likes monkeys 20:27
MONKEY-TYPING
MONKEY-SEE-NO-EVAL
lizmat MONKEY-GUTS 20:28
RabidGravy I think there should be "THIS-MONKEYS-GONE-TO-HEAVEN" and the only number allowed is 6 20:41
Xliff LOL
RabidGravy, "6" x 3
But then that would be the other place, wouldn't it? 20:42
RabidGravy :)
Xliff MOKNEY-SPEAK-NO-EVIL
RabidGravy MOKNEY? You mean like Damon Albarn? 20:43
stmuk_ MONKEY-GONE-TO-HEAVEN 20:44
Xliff D'oh 20:46
s/KN/NK/
<- STOOPID-MONKEY
Xliff Dammit! Why are most decent XPath 2.0 or XQuery implementations written in JAVA? 21:06
Ahhh.... sourceforge.net/projects/xqc/ 21:07
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␤␤»
masak how can I write the above constructor so that it works?
er, constructor call.
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␤»
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:13
pmurias Xliff: so that you can use on rakudo-jvm ;) 21:18
* use them 21:19
Xliff Hrm.
Another thing I'll need to learn, then.
How difficult will it be to get a module from rakudo-nom to interface on rakudo-jvm?
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:21
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:24
masak I'm curious if anyone has an answer to irclog.perlgeek.de/perl6/2016-03-26#i_12243113 21:35
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
also... wow, this heroku thing. pnu++
I'm just playing around so far, but... very slick. 21:37
I already know I want to do more of this.
probably end up getting a paying heroku subscription.
japhb masak: "heroku thing"? 21:38
masak github.com/pnu/heroku-buildpack-rakudo
or, to slogan it a bit, "deploy your Bailador app with git push" 21:39
I've known about it for two years, but I didn't really have a need until the other day
japhb masak: What was the need that led you to it? 21:49
masak japhb: irclog.perlgeek.de/perl6/2016-03-26#i_12242006 21:52
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)))␤»
japhb masak: ^^ better than nothing?
masak japhb: I think that's something like what I'm looking for, yes. thanks. 21:57
I'll see if I can make that work in the real thing.
masak so, the way to get the data in a POST is to do `request.body`, right? 22:11
I'm doing this: github.com/masak/nex/blob/9411d041...app.pl#L44
and getting `Method 'decode' not found for invocant of class 'Any'`
any ideas why? :/ 22:12
timotimo can you print the .gist or .perl of $data or maybe request? 22:13
masak timotimo: it's request that seems to be Any 22:14
or, hm 22:15
no, I take that back
in github.com/tadzik/Bailador/blob/a4...est.pm#L86
it's $.env<p6sgi.input> that seems to be Any
masak aha: github.com/tadzik/Bailador/issues/43 22:17
timotimo :o 22:24
dalek osystem: 3abf755 | kmwallio++ | META.list:
Add Lingua::EN::Stopwords

See github.com/kmwallio/p6-Lingua-EN-Stopwords
osystem: cdc576d | jnthn++ | META.list:
Merge pull request #178 from kmwallio/master

Add Lingua::EN::Stopwords
masak kmwallio: may I suggest using a hash in github.com/kmwallio/p6-Lingua-EN-S...s/Long.pm6 ? 22:25
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?
masak timotimo: that might be it. not sure. 22:27
I'll check what I can produce in terms of debug output from my app.pl :)
timotimo just output all the %*env :P 22:29
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
didn't quite find what's setting Bailador::Request's $.env 22:31
any help would be appreciated ;)
masak oh, Bailador::Context sets it 22:31
so the question becomes what sets Bailador::Context's $.env
ah, `dispatch` in Bailador.pm does 22:33
and it gets passed an $env 22:34
argh, which gets called passing the .env from a Bailador::Request
tadzik: halp! :) 22:35
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
sorry, i was distracted :S 22:37
masak github.com/supernovus/perl6-http-e...#L129-L155 22:39
everything in .env seems to come from here
timotimo hm, where's the p6sgi.input would come from? 22:42
masak this is not clear to me 22:43
but I think I'm able to dump request.env and have a look at it
let me try 22:44
timotimo ya 22:45
Ulti omg my slang works with the new REPL properly now :D
gist.github.com/MattOates/60c9a600f6f17cfe2158
masak yes, I am getting a p6sgi.input 22:46
and not a psgi.input
tadzik masak: ... but I don't remember how any of this works /o\ 22:46
timotimo whhhyyyyyy 22:47
masak tadzik: then we're both in the same boat right now :P
tadzik why would you call it p6sgi :(
masak I think I can work with this
hold on, let me try some crazy shit
tadzik . o O ( let me put on my shit glasses! ) 22:48
masak web development has to hurt somewhere
ok, now it works 22:50
but I'm getting an *empty* body... which is not what I'm passing in
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: github.com/tadzik/Bailador/pull/44...bb2627ba6a 22:53
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.
tadzik hah, I was even the one to merge it
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
I like specifications that you can read
tadzik: anyway, I have solved my original problem to my satisfaction. 22:57
and my new problem feels like something I should sleep on
tadzik is there anything in bailador that would make your problem easier to solve?
or rather: should there be
timotimo you're now getting the values?
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
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
timotimo: when I successfully decode request.env<p6sgi.input>, the result is an empty string
timotimo well, for that i recommend wireshark :P
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.
masak timotimo: ooh, and apt-get carries it 22:59
RabidGravy I can never get wireshark to tell me what I need 23:00
this is probably my fault however
Xliff And I only want it for node extraction. My issue is that there are special cases that may require more .. um.... massaging.
Xliff RabidGravy, what are you trying to do? 23:00
timotimo well, it may already be enough to just turn on the "network" tab in your chrome's dev tools or something 23:01
or even to strace the process and look for read/recv
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:01
I resolved it by making a server and got a bit sidetracked thereafter 23:03
Xliff m: say ^6
camelia rakudo-moar 47d21b: OUTPUT«^6␤»
Xliff m: say flat ^6
camelia rakudo-moar 47d21b: OUTPUT«(0 1 2 3 4 5)␤»
Xliff wonders....
masak "network" tab in chrome, check
Xliff m: say flat ^b
camelia rakudo-moar 47d21b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Z0NryJoqxk␤Undeclared routine:␤ b used at line 1␤␤»
Xliff Hah!
It would be nifty if you could define a sequence and have the ^ operator work on that. 23:04
m: say flat ^'b'
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␤␤»
Xliff goes back under his rock. 23:05
Xliff is now playing: LOGISTICS - Sentimentality
timotimo masak: i think the "resources" tab or what it's called also has headers and such
masak I can see request headers under the Network tab 23:06
they don't really tell me anything I didn't know already
specifically, since I'm making a POST, I'd like to be able to see the request body
haven't found that yet in Chrome 23:07
Chrome agrees it's getting an empty response back, though
Hotkeys m: sub prefix:<^> (Str $s) { 'a'..$s }; say flat ^'f'; 23:08
camelia rakudo-moar 47d21b: OUTPUT«(a b c d e f)␤»
Hotkeys Xliff:
masak oh!
Hotkeys actually i suppose it would be a letter off
masak Content-Length: 0
this... would be a problem, yes 23:09
Hotkeys m: sub prefix:<^> (Str $s) { 'a'..^$s }; say flat ^'f';
camelia rakudo-moar 47d21b: OUTPUT«(a b c d e)␤»
masak stares at his HTML form for a while 23:10
ooooooooh 23:13
yes, clearly I *should* go to sleep
wohoo, now it works :) 23:14
'night, #perl6 23:15
jdv79 nite
masak stay tuned for the exciting continuation tomorrow ;)
Xliff Hotkeys: YAY! 23:26
Xliff I actually thought about doing that. Have to special case every sequence "type" though. 23:27
Still. p6++ for having the ability to do that.
m: say 'aa' .. 'ad'
camelia rakudo-moar 47d21b: OUTPUT«"aa".."ad"␤»
Xliff m: say 'aa'..'ad' 23:28
camelia rakudo-moar 47d21b: OUTPUT«"aa".."ad"␤»
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␤␤»
Xliff LOL 23:28
Hotkeys m: sub infix:<+> (2,2) { 5 }; say 2 + 1; say 2 + 2; say 2 + 3; say 2 + 4
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␤␤»
Hotkeys I've had it work before
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␤»
Xliff m: sub infix:<+> (2,2) { 5 }; say 2+2
camelia rakudo-moar 47d21b: OUTPUT«5␤»
Hotkeys rude
oh right
Xliff :D
Hotkeys m: multi infix:<+> (2,2) { 5 }; say 2+1; say 2+2; say 2+3; say 2+4
camelia rakudo-moar 47d21b: OUTPUT«3␤5␤5␤6␤»
Hotkeys there
Xliff Hah! So it just special cases 2+2 23:30
And the regular infix:<+> takes over for everything else.
Hotkeys yeah
m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... 20)
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…»
Hotkeys oopsies
Xliff LOL
Hotkeys m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... * <= 20)
camelia rakudo-moar 47d21b: OUTPUT«(0)␤»
Hotkeys m: multi infix:<+> (2,2) { 5 }; say (0, *+2 ... * >= 20)
camelia rakudo-moar 47d21b: OUTPUT«(0 2 5 7 9 11 13 15 17 19 21)␤»
Xliff hunh? 23:31
* >= 20?
Hotkeys up until a number >= 20
Xliff Oooh
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
Hotkeys m: say (1,2,4 ... * >= 100)
camelia rakudo-moar 47d21b: OUTPUT«(1 2 4 8 16 32 64 128)␤»
Xliff woi! \o/
Hotkeys Ulti: nice
Xliff m: say (1,3,9 ... * >= 100) 23:33
camelia rakudo-moar 47d21b: OUTPUT«(1 3 9 27 81 243)␤»
Xliff m: say (1,3,6 ... * >= 100)
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␤␤»
Xliff m: say (0,3,6 ... * >= 100)
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)␤»
Xliff \O/
Hotkeys it can only magically figure out arithmetic & geometric sequences
anything else you have to stick a function in there
Xliff wonders if there is a nosebleed emoji in unicode. 23:34
Hotkeys m: say (0,1, *+* ... * >= 100)
camelia rakudo-moar 47d21b: OUTPUT«(0 1 1 2 3 5 8 13 21 34 55 89 144)␤»
Xliff Yeah, so how do you say '*' * '*' 23:35
and get 1, 4, 9, 16, 25...
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…»
Xliff m: say (1, 4, * ** 2 ... * >= 100)
camelia rakudo-moar 47d21b: OUTPUT«(1 4 16 256)␤»
kmwallio masak: I was away from my computer, I'll change it to a hash. 23:37
Xliff m: say (1,4, * ** 2 ... * >= 100)
camelia rakudo-moar 47d21b: OUTPUT«(1 4 16 256)␤»
Xliff m: say (0,1,4, * ** 2 ... * >= 100)
camelia rakudo-moar 47d21b: OUTPUT«(0 1 4 16 256)␤»
Xliff Ah. Using last value and not an iterator. 23:38
Hotkeys Xliff> Yeah, so how do you say '*' * '*' 23:44
m: (1,2,* * * ... *)[^10].say
camelia rakudo-moar 47d21b: OUTPUT«(1 2 2 4 8 32 256 8192 2097152 17179869184)␤»
Hotkeys :p
or 23:45
m: (1,2,* × * ... *)[^10].say
camelia rakudo-moar 47d21b: OUTPUT«(1 2 2 4 8 32 256 8192 2097152 17179869184)␤»
Hotkeys gradeschool op makes that nicer to read
Xliff HotKey: I would expect the output to be (1,4,3,16,25....) 23:59
Oops.
HotKey: I would expect the output to be (1,4,9,16,25....)
At least that's what I was trying to get.