»ö« 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.
coreyperry words <LISP PASCAL APL ADA COBOL FORTH PERL PHP> should be group by distinct letters, i.e [FORTH,ADA],[FORTH,APL],[ADA,COBOL,PHP] ... 00:02
timotimo coreyperry: sorry, i don't think i understand 00:37
what does ADA have in common with FORTH, and with COBOL, but COBOL not with FORTH?
timotimo coreyperry: can you explain how you want those lists to be built? 00:47
TEttinger timotimo: they share no letters 00:50
TEttinger ADA uses a different group of 2 letters than any of the 5 in FORTH 00:50
that's the distinct in the request, I think
TimToady what is this ADA of which you speak? I know of a language called Ada, but not language called ADA... 00:58
TimToady
.oO(Another Damn Acronym) :)
01:06
timotimo oh, now i get it 01:08
so basically out of the powerset you want to filter out only those where bagging the combed combination of the names gives you a set with as many entries as there are letters in the combination
i would type it out 01:10
but cat got my hand
MadcapJake` any idea what node_text_set_with_charef might mean? seems like the doxygen docs are copied from node_text_set (in the library MyHTML) 01:18
timotimo t.h8.lv/andshare/IMG_20160316_021713.jpg - hand got by cat 01:19
MadcapJake` lol what kind of cat is that? 01:20
what are the numbers in his ear? o_O 01:21
timotimo it's the regular kind of cat
MadcapJake` oh, nice :P 01:22
Hotkeys Yo
MadcapJake` very cool coloration, looks like savannah coat 01:23
timotimo en.wikipedia.org/wiki/European_Shorthair 01:24
MadcapJake` cool 01:25
timotimo i'm told "european shorthair" is really just a catch-all term for all kinds of wild cats that aren't really bred selectively 01:27
Hotkeys Oh oops is this #cats 01:27
timotimo no, this is patrick!
MadcapJake` lol 01:28
MadcapJake` what would be the point of storing a strings length? Is that really only important in C or should I maintain the functionality in my wrapper? 01:28
AlexDaniel hmm, where is Tag module? 02:07
tweakism MadcapJake`: so that you don't run off the end of it if it fails to be null-terminated and thus commit and invalid memory access or worse. 02:11
AlexDaniel hmm there it is github.com/4d47/perl6-tag-helper but it is not in the module directory, hmmm
tweakism: “fails to be null-terminated”? It is either null-terminated or it's not. Am I missing something? 02:13
tweakism AlexDaniel: the case where 'it's not' == when it 'fails to be'
AlexDaniel tweakism: that is, if you don't trust that it is null-terminated, then why would you trust its length?
tweakism AlexDaniel: I'm not looking at the API, so it depends. 02:14
maybe because you allocated a buffer yourself.
but you can operate on a C string just fine if it's not null-terminated and you know the length.
AlexDaniel: obviously you cannot strlen() it to find out 02:15
you know this though so why are you asking me?
AlexDaniel :) 02:16
AlexDaniel github.com/perl6/ecosystem/commit/...a61a2e8066 02:18
Yeah. Thank you very much. 02:19
I kinda like the fact that it was removed after Christmas… like of course nobody was using it, right? 02:21
sorry for crying out loud
MadcapJake` wait so it is important to keep length? but it's only on return and I can gather length inside perl 6 if I need to send something back to the C api 03:08
sortiz m: my int32 $a = 1; say $a +& 0xfffffffe; 03:24
camelia rakudo-moar 8cbb1e: OUTPUT«0␤»
perlawhirl hi perlers 05:25
perlawhirl coreyperry asked earlier about grouping words by distinct letter (ie, no 2 words share a common letter) 05:27
best i could come up with for now: hastebin.com/rukobuziva.pl
i was thinking of trying to do it with .classify, but things got confusing. 05:28
skids m: (1,2,3,4).combinations(2..*).say # perlawhirl 05:52
camelia rakudo-moar 8cbb1e: OUTPUT«((1 2) (1 3) (1 4) (2 3) (2 4) (3 4) (1 2 3) (1 2 4) (1 3 4) (2 3 4) (1 2 3 4))␤»
perlawhirl golf'd! 05:58
perlawhirl m: for <LISP PASCAL APL ADA COBOL FORTH PERL PHP>.combinations(2..*) -> @w { @w.say if 1 == all @w.join.comb.unique.map:{@w.grep(*.contains: $_)}; } 06:09
camelia rakudo-moar 8cbb1e: OUTPUT«(LISP ADA)␤(LISP FORTH)␤(PASCAL FORTH)␤(APL FORTH)␤(ADA COBOL)␤(ADA FORTH)␤(ADA PERL)␤(ADA PHP)␤(COBOL PHP)␤(LISP ADA FORTH)␤(ADA COBOL PHP)␤»
perlawhirl does 'all' exit early on first False?
just out of curiosity
skids not necessarily it might thread. 06:12
skids m: say (<LISP PASCAL APL ADA COBOL FORTH PERL PHP>».comb».unique».join).combinations(2..*).grep: { +.join.comb.unique == +.join.comb} # just need to map them back. 06:24
camelia rakudo-moar 8cbb1e: OUTPUT«((LISP AD) (LISP FORTH) (PASCL FORTH) (APL FORTH) (AD COBL) (AD FORTH) (AD PERL) (AD PH) (COBL PH) (LISP AD FORTH) (AD COBL PH))␤»
sortiz m: dd Map.new(:a<1); dd Map.new((:b<2)); # First fails, seems that Map.new is ignoring its documented *%args :-( 06:34
camelia rakudo-moar 8cbb1e: OUTPUT«5===SORRY!5=== Error while compiling /tmp/JO31cCHPQ7␤Unable to parse expression in quote words; couldn't find final '>'␤ ␤at /tmp/JO31cCHPQ7:1␤------> 3ew is ignoring its documented *%args :-(7⏏5<EOL>␤ expecting any of:␤ …»
sortiz m: dd Map.new(:a<1); dd Map.new((:b<2)); # First fails, seems that Map.new is ignoring its documented *%args
camelia rakudo-moar 8cbb1e: OUTPUT«5===SORRY!5=== Error while compiling /tmp/QwRaQuO33W␤Unable to parse expression in quote words; couldn't find final '>'␤ ␤at /tmp/QwRaQuO33W:1␤------> 3ap.new is ignoring its documented *%args7⏏5<EOL>␤ expecting any of:␤ …»
sortiz m: dd Map.new(:a<1); dd Map.new((:b<2)); 06:35
camelia rakudo-moar 8cbb1e: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Q_Yo8PQ92F␤Unable to parse expression in quote words; couldn't find final '>'␤ ␤at /tmp/Q_Yo8PQ92F:1␤------> 3dd Map.new(:a<1); dd Map.new((:b<2));7⏏5<EOL>␤ expecting any of:␤ …»
sortiz m: dd Map.new(:a<1); dd Map.new((:b<2>)); # First fails, seems that Map.new is ignoring its documented *%args
camelia rakudo-moar 8cbb1e: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Ky7L6VI6MS␤Unable to parse expression in quote words; couldn't find final '>'␤ ␤at /tmp/Ky7L6VI6MS:1␤------> 3ap.new is ignoring its documented *%args7⏏5<EOL>␤ expecting any of:␤ …»
sortiz m: dd Map.new(:a<1>); dd Map.new((:b<2>)); # First fails, seems that Map.new is ignoring its documented *%args
camelia rakudo-moar 8cbb1e: OUTPUT«Map.new(())␤Map.new((:b(IntStr.new(2, "2"))))␤»
sortiz uff, the third attempt 06:37
skids m: say <LISP PASCAL APL ADA COBOL FORTH PERL PHP>.combinations(2..*).grep: { .join.comb.unique.sort eqv $_».comb».unique.flat.sort } 06:40
camelia rakudo-moar 8cbb1e: OUTPUT«((LISP ADA) (LISP FORTH) (PASCAL FORTH) (APL FORTH) (ADA COBOL) (ADA FORTH) (ADA PERL) (ADA PHP) (COBOL PHP) (LISP ADA FORTH) (ADA COBOL PHP))␤»
Ulti hoelzro just tried out your fancy REPL branch, if you press tab on a blank line you get some unhappy errors followed by a completion to "Any" gist.github.com/MattOates/b80350376b3ba02c8ac7 07:59
RabidGravy boom! 08:37
DrForr My "Intro to Prancer" talk is accepted for YAPC::NA. 08:38
moritz \o 08:39
sortiz \o 08:40
DrForr, congrats! 08:41
m: dd Map.new(:a<1>); dd Map.new((:b<2>)); # First fails, seems that Map.new is ignoring its documented *%args, Bug? 08:42
camelia rakudo-moar 8cbb1e: OUTPUT«Map.new(())␤Map.new((:b(IntStr.new(2, "2"))))␤»
DrForr Thanks. 08:44
nine sortiz: documentation bug. Map.new is: method new(*@args) { @args ?? nqp::create(self).STORE(@args) !! nqp::create(self) } 08:46
sortiz nine, yep, I see the source, but IMO the documented behavior makes sense. 08:50
Why force the user to double the parenthesis? 08:51
jkramer Ahoy 08:52
DrForr Speaking on this subject - I'm calling routes via '$route.(|@args)', and I need to add optional arguments to the @args list. I can include them explicitly via '$route.(|@args, :option("al"))' but I'm having trouble figuring out what to push onto the @arg array. 08:55
nine sortiz: because that's the only way for a subclass of Map to have attributes that can be initialized via constructor 08:58
sortiz nine, I see. :-( 09:10
RabidGravy DrForr, a Pair 09:23
DrForr Ah, so 'Pair $x = ( option => 'al' ); @args.push($x); $route.(|@args);' - I'll test that later. 09:25
RabidGravy yaw
DrForr Thought I tried that but I was just rambling and needed to get to bed.
RabidGravy you could probably do it directly 09:26
Ulti is compiling Rakudo on a Raspberry Pi 3 09:27
RabidGravy I ought to get one to go with the rest of the family 09:28
jkramer What's the equivalent of my $conf = do 'some-file-with-a-hash.conf'; in P6?
RabidGravy EVALFILE
jkramer Thanks! 09:29
DrForr I know that (|@args, :option('al')) works as I tried it, but I wanted to add it in a loop rather than one off, so I wanted to ahve something to push onto an array rather than do it as a one-off.
sortiz m: my %h; %h.push(:a<foo>); %h.push((:b<bar>)); dd %h; # The same problem RabidGravy, Pairs are tricky to pass.
camelia rakudo-moar 8cbb1e: OUTPUT«Hash %h = {:b("bar")}␤»
RabidGravy no, I meant @args.push: (Foo => bar);
sortiz m: my %h; %h.push(A => 'foo'); %h.push((Foo => 'bar')); dd %h; 09:30
camelia rakudo-moar 8cbb1e: OUTPUT«Hash %h = {:Foo("bar")}␤»
sortiz Yep, need a List of pairs. 09:31
DrForr Ah, that form. Fiddling now.
RabidGravy sortiz, you're missing a crucial detail in the requirement 09:32
m: my @a = (Foo => "bar"); say @a.perl; @a.push: (Baz => "zub"); say @a.perl
camelia rakudo-moar 8cbb1e: OUTPUT«[:Foo("bar")]␤[:Foo("bar"), :Baz("zub")]␤»
RabidGravy not a Hash
DrForr foo(|@args); # <-- @args, not hash. 09:33
Hrm. I'm getting "Too many positionals passed", same error as when I was working on it last night. Let me pack the code into one line. 09:34
RabidGravy oh wait, your sub foo() is expecting named args? 09:35
sortiz I need sleep 09:36
RabidGravy the |@args flattens it to a list of positionals 09:36
foo(|%(@args)) if that is the case 09:38
perlawhirl .tell skids one character shorter... <LISP PASCAL APL ADA COBOL FORTH PERL PHP>.combinations(2..*).grep({1==all .join.comb.map(->$l {.grep(*.contains: $l)})}) # though arguably less readable 09:41
yoleaux perlawhirl: I'll pass your message to skids.
RabidGravy sortiz, or more coffee 09:43
sortiz RabidGravy, Sure (and a less ugly API to bind, ODBC is baroque) 09:46
|Tux| test 20.861 10:13
test-t 13.702
csv-parser 47.597
rindolf Hi all. 10:15
moritz: here?
moritz rindolf: kinda 10:16
rindolf moritz: can I PM You?
moritz rindolf: sure
rindolf moritz: OK.
lizmat [Tux]: you probably want to post those numbers on #p6dev :-) 10:45
jnthn lizmat: Something caused a notable slowdown a few days ago...wants hunting down at some point. I'll do it if nobody else gets there first, though want to try and get the heart of the heap snapshot thingy hammered out today 10:46
(Notable slowdown in those numbers, I mean)
lizmat jnthn: yeah, we all noticed... I think heap snapshot tool is a better investment at this point :-) 10:47
jnthn lizmat: Well, today is the last day for several where I can have the peace and quiet I need to get it in :) 10:52
lizmat jnthn: fwiw, I feel the slowdown is (also) in parsing, at least of the core settings 11:00
pmurias any particularly interesting pior work about data flow analysis I should look into (besides the Hoopl library)? 11:49
Woodi jnthn: do heap shapshot can be (someday) used for backup, or freeze/unfreeze of process ? 12:03
lizmat Woodi: afaik, jnthn intends it as a debugging tool 12:06
Skarsnik Hello 12:06
jnthn Woodi: No 12:07
Woodi: It's for memory use profiling, understanding why things don't get collected, etc. 12:08
pmurias isn't serialization something that could be used for freeze/unfreeze? 12:12
RabidGravy So I said yesterday that I would look at PortMIDI after PortAudio, which is all cool and groovy, it's actually quite a simple binding, however making the messages in a somewhat usable way is a proper PITA 12:20
I must have seen into the future when I wrote Util::BitField ;-) 12:21
CurtisOvidPoe Anyone interested in writing a Perl 6 interface for geocoder.opencagedata.com/code? A guy affiliated with it is willing to pay $100 for that. He doesn’t have any user demand or real need, but he’d like to say that they support Perl 6. 12:39
dalek osystem: 8797fcd | kuerbis++ | META.list:
Add Term::Choose::Util to ecosystem

See github.com/kuerbis/Term-Choose-Util-p6
Add Term::TablePrint to ecosystem
See github.com/kuerbis/Term-TablePrint-p6
12:40
osystem: 54b17f9 | RabidGravy++ | META.list:
Merge pull request #171 from kuerbis/master

Add Term::Choose::Util to ecosystem
FROGGS o/
tadzik CurtisOvidPoe: sounds interesting to me 12:41
CurtisOvidPoe Can you drop me an email? I’ll put you in touch with him. He’s a nice guy and like I said, he doesn’t need this, but he think it would be cool to support us. 12:42
jnthn Nice
CurtisOvidPoe++ tadzik++
CurtisOvidPoe That last line was for your, tadzik :)
tadzik CurtisOvidPoe: sure, can you PM it to me?
CurtisOvidPoe tadzik: done. 12:43
RabidGravy cool, looks really, really easy: doesn't need anything that isn't there already 12:44
tadzik yeah
I bet there'll be some surprises on the way; aren't there always? :P
RabidGravy software's like that 12:45
masak tadzik: it'd be a real surprise if there were no surprises! 12:47
tadzik indeed!
RabidGravy tadzik, BTW I may have the portmidi binding in a somewhat usable state sometime today, sugaring the creation of the MIDI messages may take a little longer
perlawhirl There's already a perl5 module, dump it in a pm6 with Inline::Perl5... collect your $100 and dust your hands of :D
tadzik RabidGravy: oh, awesome
perlawhirl or you know... just port it 12:48
tadzik perlawhirl (IRC): hahaha, that'd be such a cheat though :D
that said, think how awesome would it be if Inline::Perl5 supported pulling POD from the modules and exposed it with .WHY and friends
RabidGravy I'd actually "black box" it from the spec
tadzik the api looks really nice 12:49
I waited for the page to load, repeating the mantra "pleasedon'tbeoauth" over and over
perlawhirl yeah... that reminds me. the precomp stuff nine and FROGGS sorted out for Inline::Perl5 is so great. it's now a perfectly reasonable option to use Inline::Perl5 even for short running scripts
so
FROGGS++
thanks 12:50
RabidGravy I've sortakinda implemented enough of OAuth for Webservice::Soundcloud to work 12:51
I ought to whip it out and make it generally usable as a separate module 12:52
or, y'know, someone else could
I'm also in the market for Digest auth if anyone's bored 12:53
psch RabidGravy: fwiw, i think publishing the fork would've been fine. i'd have done the same i did just now then, which is add a README that links your fork 13:26
on the off-chance that someone stumbles on my repo somehow... :)
RabidGravy :) Hope it meets your expectations 13:27
psch prior experience with build scripts made me dislike disappearing git repo
well, if a precomputed sine barely works i think i'll have to wait for a few more opts :) 13:29
but yeah, short on time and brain space anyway, soo... 13:30
RabidGravy it may be possible that at some point in the near future the array operations may be fast enough 13:31
for instance some cursory benchmarks indicate that the CArray constructor is 20% faster with nums 13:35
RabidGravy and the github.com/rakudo/rakudo/commit/e8bc151d27 promises some more good things 13:37
psch m: printf "%d", Mu.new 13:56
camelia rakudo-moar e8bc15: OUTPUT«X::TypeCheck::Binding exception produced no message␤␤»
psch m: sub f(*@a) { }; f Mu.new
camelia ( no output )
psch m: sub f($, *@a) { }; f 1, Mu.new
camelia ( no output )
psch m: sprintf "%d", Mu 13:58
camelia rakudo-moar e8bc15: OUTPUT«Type check failed in binding $x; expected Any but got Mu (Mu)␤␤»
psch m: sprintf "%d", Mu.new
camelia rakudo-moar e8bc15: OUTPUT«X::TypeCheck::Binding exception produced no message␤␤»
psch yeah i don't get that
m: use nqp; nqp::p6box_s(Mu)
camelia rakudo-moar e8bc15: OUTPUT«Cannot unbox a type object␤ in block <unit> at /tmp/tv7FWpor8w line 1␤␤»
psch m: use nqp; nqp::p6box_s(Mu.new) 13:59
camelia rakudo-moar e8bc15: OUTPUT«This type cannot unbox to a native string␤ in block <unit> at /tmp/4q8Tut3vG_ line 1␤␤»
CurtisOvidPoe For those who didn’t see my Perl 6 “Why People Are So Excited” talk at FOSDEM, it’s online now: www.youtube.com/watch?v=hR9UdvxMAbo First three minutes of audio are rather messed up, but then get fixed. 14:00
perlpilot CurtisOvidPoe++ watched it this morning while eating breakfast. Good talk! 14:01
psch hrm. probably something about how it gets passed down to the NQP-level impl through QASTOperationsMAST...
perlpilot CurtisOvidPoe: now if you could give that talk at a *bunch* of events, that would be awesome ;) 14:02
El_Che it's a great talk
psch CurtisOvidPoe: ooc, who was the target of the finger-pointing and "shut up" at the start? :) 14:04
CurtisOvidPoe psch: I don’t remember, sorry.
psch heh, no worries :) 14:05
Azry is there a reason why on every module i read on modules.perl6.org, noone uses "BUILD" and "BUILDALL". everyone uses "multi method new" for object construction 14:08
RabidGravy sound like 32 bit foldover at the beginning, no getting back from that
Azry i'm struggling to find good examples 14:08
RabidGravy Azry, you didn't look hard enough 14:09
moritz Azry: because the module authors all hate subclassing, presumably
Azry okay =) i'll continue searching there x) thanks 14:10
RabidGravy github.com/jonathanstowe/Audio-Por...io.pm#L887
moritz Azry: pro tip: git clone github.com/moritz/perl6-all-modules; cd perl6-all-modules; git grep 'method BUILD' 14:11
masak moritz++ # perl6-all-modules 14:12
RabidGravy github.com/jonathanstowe/Audio-Enc...3.pm#L1301
Azry hanks =) i'll try these 14:13
RabidGravy but you're probably better off just asking the question rather than guessing by looking at other peoples code 14:13
moritz .tell DrForr your module perl6-ANTLR4 has .precomp files under version control. Please git rm -r --fached .precomp && echo .precomp >> .gitignore
yoleaux moritz: I'll pass your message to DrForr.
RabidGravy oh, I've so done that before 14:14
moritz also, if you have feedback on how to improve doc.perl6.org/language/objects#Obje...nstruction that would be appreciated :-)
BUILDALL seems not to be in much use 14:15
just two usages in perl6-all-modules 14:16
RabidGravy I've never used it
Azry I'm trying to figure out how to create an inherited class with a different constructor for different arguments 14:18
Azry i don't quite yet see how to do it =( if you want a gist, i'll be happy to provide =) 14:19
moritz Azry: please do
Azry: and please use named arguments only, that'll make your life much easier
Azry: and that of anybody who wants to subclass your classes
diakopter .u CHEESE 14:20
yoleaux No characters found
RabidGravy Azry, in summary: 14:21
m: class Foo { multi submethod BUILD() { say "no args"; } multi submethod BUILD(:$foo!) { say "args"; } } Foo.new; Foo.new(foo => 1); 14:22
camelia rakudo-moar e8bc15: OUTPUT«5===SORRY!5=== Error while compiling /tmp/PSveIfr8mI␤Strange text after block (missing semicolon or comma?)␤at /tmp/PSveIfr8mI:1␤------> 3lti submethod BUILD() { say "no args"; }7⏏5 multi submethod BUILD(:$foo!) { say "ar␤ expecting an…»
TimToady
.oO("No cheese, Grommit. Not a bit in the house!")
RabidGravy m: class Foo { multi submethod BUILD() { say "no args"; } multi submethod BUILD(:$foo!) { say "args"; } }; Foo.new; Foo.new(foo => 1);
camelia rakudo-moar e8bc15: OUTPUT«5===SORRY!5=== Error while compiling /tmp/UNDg2K9OYK␤Strange text after block (missing semicolon or comma?)␤at /tmp/UNDg2K9OYK:1␤------> 3lti submethod BUILD() { say "no args"; }7⏏5 multi submethod BUILD(:$foo!) { say "ar␤ expecting an…»
RabidGravy m: class Foo { multi submethod BUILD() { say "no args"; }; multi submethod BUILD(:$foo!) { say "args"; } }; Foo.new; Foo.new(foo => 1);
camelia rakudo-moar e8bc15: OUTPUT«no args␤args␤»
RabidGravy I hate that
RabidGravy (the forgetting the semicolon that is, not BUILD) 14:22
Azry i was gonna send this : gist.github.com/anonymous/6e111a1914dfc938c644 but i might rethink it to use name arguments only =) 14:27
RabidGravy: is your class Foo is inherited, how do you pass arguments to the inherited function from the build method (like you would with callwith from buildall) ? 14:30
*if your [...] sorry
moritz Azry: if you use named arguments for new, they are passed to BUILD too 14:32
RabidGravy and passed to the BUILD of all the sub-classes 14:44
Azry shouldnt this code work then ? class IO::Pty is IO::Handle { multi submethod BUILD() { say "no args"; } }; say IO::Pty.new.gist; say IO::Pty.new(path => '/dev/null').gist;
path should be passed for initialization to the inherited method and the cas without argument should be caught by the local build ? i don't know x) 14:45
moritz what do you mean by "caught"? 14:46
moritz methods ignore extra named arguments, so nothing in there would cause an exception 14:46
RabidGravy it appears to "work" 14:47
moritz if you want to enforce the presence of that argument in a subclass, you can make it mandatory: submethod BUILD(:$path!) { } 14:47
Azry alright i think i understand now the root of what confused me : IO::Handle.new.gist; gives me a warning wheras IO::Handle.new.perl; doesn't 15:00
hoelzro o/ #perl6
RabidGravy yeah, LTA but it's when it tries to print the path 15:00
hoelzro Ulti: thanks for trying it, I'll have a look! 15:01
RabidGravy also if you add attributes to your subclass and you want to see them with .gist or .perl and the super-class provides its own .perl or .gist then you will have to over-ride 15:03
which is what happens in this case
Azry OK. I understand that now. But maybe the cas in which $!path is empty in method gist/perl in Handle.pm should be considered ? 15:04
masak fun fact gleaned from perl6-all-modules: there are exactly 2 uses of `CHECK { ... }` in the ecosystem
moritz Tux/CSV/lib/Text/CSV.pm and grondilu/openssl/lib/SSL/Digest.pm 15:07
psch $ ./perl6-m -e'printf "%d", 0^1'|& less 15:08
Cannot sprintf type (Junction)
as X::AdHoc, currently
note sure we want that typed specifically, but i could see X::TypeCheck::Argument
s/note/not/
well, and minus the parenthesis for the type object :) 15:09
RabidGravy well it's better than the previously quite confusing error
:)
psch ...now for all the other directives 15:14
unfortunately i don't really see a way to make that DRYer :/
m: printf "%f", 0^1
camelia rakudo-moar e8bc15: OUTPUT«cannot numify this␤␤»
psch ah, that's something i suppose
m: printf "%d", 0^1
camelia rakudo-moar e8bc15: OUTPUT«P6opaque: get_boxed_ref could not unbox for the representation '20'␤␤»
Juerd In my Perl 5 work I keep running into what I could have solved with an 'except' operator in Perl 6. Frustrating. 15:20
sub infix:<except>(@list, $exception) { @list.grep: * !~~ $exception }
Juerd m: sub infix:<except>(@list, $exception) { @list.grep: * !~~ $exception }; say ^10 except 5 15:20
camelia rakudo-moar e8bc15: OUTPUT«(0 1 2 3 4 6 7 8 9)␤»
moritz Juerd: it's often the small things that annoy me the most in p5; like having to repeat the name of named arguments (name => $name instead of :$name) 15:21
Juerd Of course, I can have my sub except { my ($aref, $exception) = @_; ... } 15:22
But passing a reference, etc, it all seems like so much work once you've used Perl 6 a bit.
moritz aye 15:26
nemo wow. no zoffix still 15:32
tadzik hmm, I wonder how feasible would it be to make everything in JSON::Unmarshal lazy 15:34
it takes 0.17 seconds to unpack an example API resopnse from OpenCageData 15:35
which is not that bad, since there is also latency from actually downloading it too, which mask this a bit :P
|Tux| moritz that CHECK is essential in CSV 15:46
masak |Tux|: yes, I gathered 15:47
psch RabidGravy: gist.github.com/peschwa/b7449b286f5beb194a5e how's that look to you? 15:51
RabidGravy works for me :) 15:52
psch that should work for everything that can't be unboxed (or *ified) to the type matching the directive as well 15:53
m: class A { }; printf "%d", A.new
camelia rakudo-moar e8bc15: OUTPUT«Method 'Int' not found for invocant of class 'A'␤␤»
psch ah, those work there already, hmm
psch checks how that looks locally
psch yeah, that'd also get caught in my changes... 15:55
that actually makes this a tad more complicated :/
ah, no, it still tries e.g. .Int, but fails differently 15:56
i think i like that
psch m: sprintf "%d", 1..* # this throws "Cannot (s)printf a lazy list", too 15:57
camelia rakudo-moar e8bc15: OUTPUT«Cannot .elems a lazy list␤ in block <unit> at /tmp/CgLfsnMvAe line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/CgLfsnMvAe line 1␤␤»
psch well, instead of what it does in nom right now
ufobat FROGGS, are the slides from your perl6 einführungs talk online somewhere? 16:02
FROGGS ufobat: can you read odf files? 16:05
ufobat odf is libreoffice? i can 16:06
FROGGS aye
ohh, it is odp actually 16:07
ufobat yeah, odf would be awesome! i missed the talk and i cant wait for Steffen getting the videos done :)
FROGGS I misremembered
dunno if the slides help that much :o)
ufobat oh :-( 16:08
FROGGS act.yapc.eu/gpw2016/talk/6502
ufobat did you just upload them? i could swear i didnt see then this morning 16:09
thanks!
FROGGS I just did, yes
ufobat thank you :) 16:14
stmuk_ 6502! 16:27
geekosaur somehow I do not expect to see rakudo on apple ][ :p 16:30
masak m: sub postfix:<!>(Int $n) { $n ~ "!" }; say 6502!
camelia rakudo-moar ad1928: OUTPUT«6502!␤»
stmuk_ ah it uses the "sweet64" API 16:31
more seriousily there appears to be a real java port VM02 :O 16:34
masak m: from-json("42") 16:38
camelia rakudo-moar ad1928: OUTPUT«Invalid JSON: 42␤ in block <unit> at /tmp/KpQHqHBsVB line 1␤␤»
masak this seems to be counter to ECMA-404: "A JSON text is a sequence of tokens formed from Unicode code points that conforms to the JSON value grammar." 16:39
www.ecma-international.org/publicat...MA-404.pdf
in other words, it's not just about objects and arrays; numbers, strings, `true`, `false`, and `null` are also valid JSON documents 16:40
masak submits rakudobug
tadzik masak++ 16:43
masak classical rookie mistake #42: rewarding masak's nitpicking :P 16:44
masak .oO( first sign of madness: referring to yourself in the third person... ) 16:45
cfedde that' #42?
ah contextual. in other contexts rule 42 is "bring a towel." 16:46
masak :) 16:47
no, actually Rule 42 is "No one shall speak to the Man at the Helm" 16:48
ufobat how do i get a array from a list? I've got an @array and when do a my @p = @array.permutations; how "work" with the different permutations in @p, e.g. i want to append something on each permutation 16:49
masak m: my @a = 1, 2, 3; .say for @a.permutations 16:50
camelia rakudo-moar ad1928: OUTPUT«(1 2 3)␤(1 3 2)␤(2 1 3)␤(2 3 1)␤(3 1 2)␤(3 2 1)␤»
masak m: my @a = 1, 2, 3; for @a.permutations -> $p { say [$p.Slip, "!"] } 16:51
camelia rakudo-moar ad1928: OUTPUT«[1 2 3 !]␤[1 3 2 !]␤[2 1 3 !]␤[2 3 1 !]␤[3 1 2 !]␤[3 2 1 !]␤»
masak ufobat: like that?
psch m: my @a = (1,2,3).permutations. map: { [$_] }; @a[0].push: "foo"; say @a.perl 16:52
camelia rakudo-moar ad1928: OUTPUT«[[1, 2, 3, "foo"], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]␤»
masak m: my @a = (1,2,3).permutations>>.Array; @a[0].push: "foo"; say @a.perl 16:53
camelia rakudo-moar ad1928: OUTPUT«[[1, 2, 3, "foo"], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]␤»
psch right, that's cleaner
masak I blame tadzik for rewarding my nitpicking :P 16:54
cfedde nitpicking in language design is a virtue
tadzik wait for my reaction gif! 16:55
masak .oO( ain't nobody got time for that )
tadzik gifrific.com/wp-content/uploads/201...-panda.gif 16:55
masak just the URL is funny :D
tadzik it serves as both a spoiler and a time-saver for those who've seen it 16:56
masak haha
ufobat thanks both of you :) 16:57
is .Array something like a cast? 16:58
masak yes 16:58
there's lots of such methods -- they're usually the easiest way to convert values
tadzik ...I'm finding a dir called "FakeDir" in my projects 17:00
.precomp is inside
but it's actually a real dir!
ufobat where is the documentation about those casts? 17:01
masak probably not in a single place 17:04
I also suspect that we could have more of those methods than we currently do
psch note that they're not casts like typecasts in C or Java. as in, not an explicit language feature, but part of the CORE library and in the end normal methods 17:05
masak aye -- suggestively named methods
FROGGS some of these methods are implemented on type Any some on type Cool 17:06
and that's where these are documented I guess
bbl
masak tries to do a conversion which fails, and fails -- and is reluctantly impressed :) 17:07
ufobat the reason why i didnt find it was on docs.perl6.org when you for example type down "recv" you find "Method: recv" and then you get IO::Socket.recv but when you type down "Array" you dont get any method. the class Array and other stuff though 17:09
stmuk_ tadzik: maybe related to github.com/perl6/doc/commit/f306df...0af347eb0c or similar elsewhere? 17:11
RabidGravy can anyone think of a succinct way of doing: 17:18
m: sub mask(*@a) { my int $a = 0; for @a -> $i { $a +|= ( 1 +< $i ) }; $a }; say mask(2,3)
camelia rakudo-moar ad1928: OUTPUT«12␤»
RabidGravy given the @a will be values 0 .. 15
psch m: sub mask(*@a) { [+|] @a.map( 1 +< * ) }; say mask(2,3) 17:19
camelia rakudo-moar ad1928: OUTPUT«12␤»
RabidGravy oook! 17:20
RabidGravy cheers that's better 17:22
psch alternatively it might read nicer as [email@hidden.address] 1 +< * ).reduce( &[+|] )', if you don't want to front-load the reduce op 17:24
stmuk_ actually bin/p6doc is a script and won't get precomped anyway 17:25
not sure what happens with perl6 --doc however 17:26
Azry Is there a perl6 alternative to perl5 IO::Handle->new_from_fd ? 17:28
don't see any in IO::Handle class 17:29
ugexe look at nqp's ops 17:31
Azry i was afraid i would have to dive in that =) is there some kind of documentation on nqp (i don't even really know what it is yet) 17:32
psch m: sub mask(*@a) { [+|] do (1 +< $_) for @a }; say mask(2,3) # not sure why this doesn't work... 17:33
camelia rakudo-moar ad1928: OUTPUT«WARNINGS for /tmp/0oTyjnuRxx:␤Useless use of "+<" in expression "1 +< $_" in sink context (line 1)␤12␤»
psch i mean, it does apparently
ugexe github.com/perl6/nqp/blob/master/d...s.markdown
psch but why does it complain about the sinkage? 17:34
false positive?
Azry ugexe: thanks ;)
ugexe is it `do`ing the result of the (xxx for @a) or each item of @a?
psch m: sub mask(*@a) { [+|] 1 +< $_ for @a }; say mask(2,3) 17:35
camelia rakudo-moar ad1928: OUTPUT«Nil␤»
psch "do" makes statement mods fit in statement
Hotkeys ?p6> m: sub mask (*@a) { [+|] (1 +< $_ for @a) }; say mask(2, 3)
psch (which is clearly a botchy and Perl6::Grammar-reliant explanation) 17:36
Hotkeys Er
Wrong command
Can someone do that with m:
Its a pain on mobile
psch m: sub mask (*@a) { [+|] (1 +< $_ for @a) }; say mask(2, 3)
camelia rakudo-moar ad1928: OUTPUT«WARNINGS for /tmp/Af1LYgZLYv:␤Useless use of "+<" in expression "1 +< $_" in sink context (line 1)␤12␤»
Hotkeys Weird
Why does it sink
ugexe m: sub mask(*@a) { do [+|] do { (1 +< $_) } for @a }; say mask(2,3)
camelia rakudo-moar ad1928: OUTPUT«(4 8)␤»
RabidGravy I'm going with the explicit .map ... .reduce one 17:37
ugexe hmm
psch fwiw, it looks like a false positive to me 17:38
m: my @a = ^5; say do 1 +< $_ for @a
camelia rakudo-moar ad1928: OUTPUT«(1 2 4 8 16)␤»
psch m: my @a = ^5; [+|] do 1 +< $_ for @a
camelia rakudo-moar ad1928: OUTPUT«WARNINGS for /tmp/VcLqX11IFE:␤Useless use of "+<" in expression "1 +< $_" in sink context (line 1)␤»
psch m: &[+|].signature.perl.say 17:39
camelia rakudo-moar ad1928: OUTPUT«:(Mu $?, Mu $?)␤»
psch hrm
m: &prefix:<[+|]>.signature.perl.say
camelia rakudo-moar ad1928: OUTPUT«:(+ is raw)␤»
psch m: &say.signature.perl.say
camelia rakudo-moar ad1928: OUTPUT«:(| is raw)␤»
psch m: sub f(+ is raw) { }; f do $_ for ^5 17:40
camelia ( no output )
psch so not single arg rule, apparently
Azry There is no method to manipulate file descriptors, even in nqp ops 18:05
Azry and implementing one seems like i would have to work on moarvm/jvm is that right ? looks one step harder :o 18:07
ugexe manipulate how 18:12
Azry i have a file descriptor, i want to create a IO::Handle 18:13
tadzik stmuk: ah, might be! So that'd be p6doc's fault for not cleaning it up 18:14
ugexe yeah im not seeing a way to go from descriptor to handle from a cursory glance, although handle to descriptor appears to be doable 18:23
perlpilot fdopen should be in libc, just figure out how to get from a FILE* to an IO::Handle and with a dash of NativeCall, you're all set. :) 18:25
Azry yeah it thought about it, but it doesn't look clean =) is there any way to make a request for such things looks like cross project : MoarVM/JVM/NQP/Rakudo 18:27
i can proably do the rakudo implementation but nqp/VMs is still out of reach to me 18:28
ufobat how do i flat the thing.. i want list of list, whereas the inner list is a e.g. 1,1,x perl6 -e 'my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { say .Array.flat }' 18:29
RabidGravy linenoise anyone? 18:30
grep '#define' /usr/include/portmidi.h | grep FILT | sed -e 's/#define PM_FILT_//' | perl6 -pe '$_ ~~ s/^(\w+)/{ $0.lc.tc }/; $_ ~~ s:g/\<\</+</; $_ ~~ s/_(.)/{$0.tc }/; $_ ~~ s/^(\w+)\s+\(/$0 => (/; $_ ~~ s:g/\|/+|/; $_ ~~ s/$/,/' 18:31
tadzik :D
psch ufobat: you have [[1,1],[2,2]] and <x y> and want to turn that in [[1,1,"x"],[2,2,"y"]]? 18:32
RabidGravy I probably could have typed it quicker than that 18:33
skids m: my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { say $_».list.flat }
camelia rakudo-moar ad1928: OUTPUT«(1 1 x)␤(1 1 y)␤(2 2 x)␤(2 2 y)␤»
yoleaux 09:41Z <perlawhirl> skids: one character shorter... <LISP PASCAL APL ADA COBOL FORTH PERL PHP>.combinations(2..*).grep({1==all .join.comb.map(->$l {.grep(*.contains: $l)})}) # though arguably less readable
ufobat psch, no, i want [[1,1,y] [1,1,y], [2,2,x], [2,2,y]] 18:34
skids m: my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; say [ $_».list.flat.Array for @cross ] 18:36
camelia rakudo-moar ad1928: OUTPUT«[[1 1 x] [1 1 y] [2 2 x] [2 2 y]]␤»
psch m: my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { $_ = $_».list.flat.Array }; say @cross.perl # and with assignment 18:37
camelia rakudo-moar ad1928: OUTPUT«[[1, 1, "x"], [1, 1, "y"], [2, 2, "x"], [2, 2, "y"]]␤»
psch i'm pretty sure that's somewhat the long way around, though...
ufobat whe do i need to use the » on the $_ inside the loop? the $_ is just a List, when when i loop over the elements (thats what i think » is doing) and bring them to a list to flat it? *confused* 18:39
or why is simply .flat not working?
skids $_ is a list of (Array, item)
skids Array.flat does not "work" by design. 18:40
Because Arrays pretect their internal elements from being flattened.
(Lists do not)
Woodi damn, soon compilers will need to emit FPGA programs www.embeddedrelated.com/showarticle/195.php?1 ;) 18:41
DrForr RabidGravy: Got the optional stuff working, there's a possible issue in the URI module. 18:42
yoleaux 14:13Z <moritz> DrForr: your module perl6-ANTLR4 has .precomp files under version control. Please git rm -r --fached .precomp && echo .precomp >> .gitignore
ugexe augment class Array { method flatter-damnit(*@_) { @_.flatmap(*.flat) }; };
psch m: sub f(@a is copy, $b) { @a.push: $b }; my @a = [1,1],[2,2]; my @b = <x y>; my @cross = @a X[&f] @b; say @cross.perl # somewhat cheating... :S
camelia rakudo-moar ad1928: OUTPUT«[[1, 1, "x"], [1, 1, "y"], [2, 2, "x"], [2, 2, "y"]]␤»
DrForr Ah, thanks.
RabidGravy Harr! 18:43
masak Woodi: you say that as if it's a bad thing
ufobat skids, but in this example perl6 -e 'my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { say $_.WHAT; say $_[0].WHAT; say "...." }' the first iteration in the for @cross, everything is a list 18:44
shouldnt $_.flat be the same like in perl6 -e 'say ((1,1), 2).flat'
skids my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { say $_.perl } 18:45
m: my @foo = [(1,1), [2,2]]; my @bar = <x y>; my @cross = @foo X @bar; for @cross { say $_.perl }
camelia rakudo-moar ad1928: OUTPUT«$($(1, 1), "x")␤$($(1, 1), "y")␤$($[2, 2], "x")␤$($[2, 2], "y")␤»
ufobat istn that a list with a list in it plus a "x"
psch m: say ([1,1],2).flat; say ((1,1),2).flat
camelia rakudo-moar ad1928: OUTPUT«(1 1 2)␤(1 1 2)␤»
psch m: say [[1,1],2].flat; say [(1,1),2].flat; 18:46
camelia rakudo-moar ad1928: OUTPUT«([1 1] 2)␤((1 1) 2)␤»
skids The first two are the second two are lists with Array, Str
DrForr multi GET('/post', Int $y, Int $m, Str :$format ) is route {} # matches '/post/2015/02?format=JSON'.
RabidGravy DrForr++ 18:47
skids (And also note that the list in the first two is prtected itself by a scalar)
ufobat Array, Str? why? say $_[0].WHAT; sais (List)
psch m: say ([1,1],"x")[0].WHAT
camelia rakudo-moar ad1928: OUTPUT«(Array)␤»
skids m: say ($(1,1),2).flat 18:48
camelia rakudo-moar ad1928: OUTPUT«((1 1) 2)␤»
ufobat its the scalar then!?
skids It's always Scalars.
psch m: say ([(1,2), 3], ((1,2),3)).flat
camelia rakudo-moar ad1928: OUTPUT«((1 2) 3 1 2 3)␤»
skids Just with Array, the Scalars are automatic (and sometimes invisible when you print them)
n1cky is anyone still working on Perl6 -> LLVM? 18:49
ufobat but i ment the ((1,2), 3) vs ($(1,2), 3) is because the $() protects them as Arrays would protect them? 18:49
skids Yes, you are getting it. 18:50
ufobat does this only apply to .flat or .. what kind of modifications are not working?
skids .flat, and single-argument-rule, and binding operations are affected. 18:52
ufobat thank you very much. i am going to dig deeper into the documentation now ;) 18:53
skids doc.perl6.org/type/Scalar may help
ufobat :)
masak n1cky: things people have been saying on this channel over the years make me suspect Perl 6 -> LLVM would be Very Hard to pull off 19:03
skids Mostly because the "VM" part of LLVM is a bit of an exageration, from what I glean. 19:04
geekosaur it's a VM but not in the sense that people use the term these days 19:06
tadzik also because the LL part indicates that LLVM may be not suited for Perl 6 too much :) 19:09
perlpilot LLVM is a toolkit for building a VM for your project :) 19:15
moritz LLVM is also a compiler backend and a compiler target 19:17
perlpilot I think Perl 6 -> LLVM just need someone with the right kind of stubbornness and love .... perhaps similar to Perl 6 -> CLR 19:19
RabidGravy all sorts of crack 19:21
moritz more like Perl 6 -> C 19:22
n1cky i've never worked with compilers for functinoal languages 19:24
perlpilot yeah, my compilers have never worked either. ;-)
n1cky I've been sitting here for a couple minutes thinking about how the hell first-class functions would even work
haha :s
Hotkeys Why is there a bare 'get' routine that takes lines from $*IN 19:29
but there's no bare 'read($n)' routine for reading bytes from $*IN
(I know I can just do $*IN.read($n) but still) 19:30
lizmat Hotkeys: I think hysterical raisins 19:31
ugexe so you can do `while <> { }` or whatever
perlpilot Hotkeys: I think there's a getc() routine for that
perlpilot Hotkeys: well ... for characters, not bytes 19:32
psch m: say getc $*IN
camelia rakudo-moar ad1928: OUTPUT«C␤»
lizmat Hotkeys: same applies e.g. for a "words" sub
Hotkeys right
psch still needs the handle 19:32
Hotkeys I was thinking for bytes
lizmat m: .say for words
camelia rakudo-moar ad1928: OUTPUT«5===SORRY!5=== Error while compiling /tmp/WYp02duUiR␤Calling words() will never work with any of these multi signatures:␤ ($what, $limit = Inf, *%named)␤at /tmp/WYp02duUiR:1␤------> 3.say for 7⏏5words␤»
lizmat m: .say for words($*IN) # expected this
camelia rakudo-moar ad1928: OUTPUT«Céad␤slán␤ag␤sléibhte␤maorga␤Chontae␤Dhún␤na␤nGall␤Agus␤dhá␤chéad␤slán␤ag␤an␤Eireagal␤ard␤ina␤stua␤os␤cionn␤caor␤is␤coll;␤Nuair␤a␤ghluais␤mise␤thart␤le␤Loch␤Dhún␤Lúich’␤go␤ciúi…»
perlpilot Hotkeys: eagerly awaiting your patch to add a read sub :)
Hotkeys oh
did I just rope myself into that 19:33
lizmat perlpilot: would that not need to be part of 6.d ? 19:33
Hotkeys ^^^ 19:33
Hotkeys unropes
lizmat it would not be an additional method
perlpilot aye, it would steal that sub from the users
Hotkeys m: say getc
camelia rakudo-moar ad1928: OUTPUT«read string requires an object with REPR MVMOSHandle␤ in block <unit> at /tmp/TyY0i1fBMN line 1␤␤»
Hotkeys m: say getc()
camelia rakudo-moar ad1928: OUTPUT«read string requires an object with REPR MVMOSHandle␤ in block <unit> at /tmp/gXYCrV2P6k line 1␤␤»
lizmat is facing a similar dilemma with native str arrays
Hotkeys m: say get()
camelia rakudo-moar ad1928: OUTPUT«Céad slán ag sléibhte maorga Chontae Dhún na nGall␤»
Hotkeys why is get so special 19:34
lizmat Hotkeys: basically, because it was in p5 ?
Hotkeys ah
masak p6: say ("0" x 3 ~ "1").substr(2)
camelia rakudo-moar ad1928: OUTPUT«00␤»
masak :/
masak rt.perl.org/Ticket/Display.html?id=123602 19:34
Hotkeys I think at minimum there should be get, getc, and read
masak open for more than one year now... :/ 19:35
someone^WI should totally track down what's up with that one
Hotkeys weird
lizmat masak: fwiw, it seems MoarVM specific: 19:36
$ ./perl6-j -e 'say ("0" x 3 ~ "1").substr(2)'
01
perlpilot m: say ("0" x 3 ~ "1").substr($_) for ^4; # also this 19:37
camelia rakudo-moar ad1928: OUTPUT«0001␤001␤00␤1␤»
lizmat m: use nqp; say nqp::substr("0" x 3 ~ "1",2) # oddly enough nqp seems ok ? 19:38
camelia rakudo-moar ad1928: OUTPUT«01␤»
psch nqp-m: my $x := nqp::x("0", 3) ~ "1"; nqp::say(nqp::substr($x, 2)) 19:38
camelia nqp-moarvm: OUTPUT«00␤»
perlpilot nqp-j: my $x := nqp::x("0", 3) ~ "1"; nqp::say(nqp::substr($x, 2)) 19:40
camelia nqp-jvm: OUTPUT«(signal ABRT)#␤# There is insufficient memory for the Java Runtime Environment to continue.␤# pthread_getattr_np␤# An error report file with more information is saved as:␤# /tmp/jvm-29419/hs_error.log␤»
perlpilot heh
psch m: use nqp; say nqp::substr(nqp::x("0", 3) ~ "1",2)
camelia rakudo-moar ad1928: OUTPUT«00␤»
masak lizmat: it is MoarVM-specific, as the issue points out :)
lizmat m: use nqp; my $x := nqp::concat(nqp::x("0", 3),"1"); nqp::say(nqp::substr($x, 2))
camelia rakudo-moar ad1928: OUTPUT«00␤»
masak (back then we had Parrot to compare with)
so likely MoarVM gets "roped" into doing it wrong ;)
lizmat m: use nqp; my $x := nqp::concat(nqp::x("0", 3),"12"); nqp::say(nqp::substr($x, 2)) # feels like an off-by-one error somewhere 19:41
camelia rakudo-moar ad1928: OUTPUT«001␤»
masak aye
masak .oO( just enough rope to shoot yourself in the foot... plus one )
lizmat m: use nqp; my $x := nqp::concat(nqp::x("0", 3),"12"); nqp::say(nqp::substr($x,1)) # definitely off-by-one 19:42
camelia rakudo-moar ad1928: OUTPUT«0012␤»
perlpilot seems highly specific to the number 2 though
lizmat
.oO( which is off by one :-)
perlpilot (I bet lizmat's last will work well with 3 instead of 1 too)
masak .oO( well, you see, 2 is off by 1 by 1 ) 19:43
lizmat m: use nqp; my $x := nqp::concat(nqp::x("0", 3),"12"); nqp::say(nqp::substr($x,3)) # indeed
camelia rakudo-moar ad1928: OUTPUT«12␤»
patrickz Hey! How can I compile a .p6 file to a .moarvm file? 19:45
lizmat technically, you can, but support is still very sketchy 19:46
you're probably better of putting the code in a module, and loading that in a script / one liner 19:47
patrickz I'd like to have the .moarvm file for debugging purposes... 19:48
moritz last I tried, you could compile a script to .moarvm. You just couldn't start that bytecode file :-) 19:57
patrickz moritz: I don't want to run it, but dump the bytecode. So, how would I do that? 19:58
diakopter you can, you just gotta supply all the right paths for libs
patrickz: there once was a --dump for the moar executable 19:59
psch patrickz: --target=moarvm --output="$file" from the p6-level
ugexe perl6 --target=mbc --output=filename.moar file-to-precomp
psch ah, mbc it is
psch ...it was moarvm once though, wasn't it? 20:00
patrickz psch: already tried mbc,moar but only get "Cannot dump this object; no dump method"
psch patrickz: that's when you leave out output
patrickz: without --output it tries to print it via a dump method
patrickz ah! 20:01
that was my mistake, thank you!
only tried -o not --output= ...sticking to the docs I should do... 20:02
Azry lizmat: sorry about issue #726 i have some habits to train =( 20:18
lizmat Well, the idea was nice, but it's very much appreciated if you test the patch, and also run a spectest before you do a PR :-) 20:19
Azry first commit ever, i guess i was a little too hasty x) 20:20
lizmat well, we've all been too hasty at some time... 20:21
so keep them coming, but a little less hasty, please :-)
perlpilot lizmat++ Azry++ 20:25
patrickz How can I rebuild nqp + perl6 when I made changes to nqp? Neither in rakudo/ nor in rakudo/nqp/ does 'make realclean' seem to remove enough nqp stuff to actually cause a rebuild... 21:00
hoelzro patrickz: I usually just remove the directory I install nqp to 21:01
hoelzro I build rakudo with `perl Configure --prefix=/tmp/nom --gen-moar && make install`, so for me, that looks like `rm -rf /tmp/nom` 21:01
skids rakudo build will happily use an nqp it finds pre-built, you have rm the binary.
TimToady I usually just a 'make install && (cd ..; make install)' from the nqp directory 21:02
patrickz ah so if I use the default install/ folder I would just remove that one
hoelzro correct 21:03
RabidGravy I really don't like it when stuff segfaults reliably UNTIL YOU RUN IT WITH A DEBUGGER 21:06
patrickz Development is so much easier when you actually manage to build the code you want to try. :-P 21:11
:ratchet is meant to cling to the input and not the regex, right? 21:16
psch i find that unlikely, given :ratchet is a regex adverb
moritz :ratchet is lexically scoped within the regex
so it very much sticks to the regex, not the string 21:17
patrickz Hm, I think I wanted to ask something different. :ratchet prevents backtracking in the input, not in the regex. So going back in the regex is fine as long as one does not release already consumed input, correct? 21:19
psch well, backtracking means "if you can't match anything at the current position, discard successful matches before the current position and try alternatives"
so, you backtrack over the string, discarding the tokens that matched 21:20
patrickz Ok. I think I understood correctly then. 21:20
psch m: grammar G { regex TOP { { say "start of TOP" } ^ <a> <b> $ { say "end of TOP" } }; regex a { { say "start of a" } 'a' 'a' { say "end of a" } }; token b { { say "start of b" } 'a' { say "end of b" } } }; G.parse("aa") 21:22
camelia rakudo-moar 9eb1fb: OUTPUT«start of TOP␤start of a␤end of a␤start of b␤»
psch ...i maybe should've gisted that
psch ehh 21:22
also sequence points mess with backtracking i think? 21:23
so nevermind that anyway >_>
patrickz m: say "asdfEnd" ~~ / :ratchet ^ [ .+? | z ] End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«Nil␤»
patrickz That should match I think
Hotkeys is anyone else having trouble building panda on windows?
specifically Shell::Command
which hasn't changed in a while so I'm not sure why it's breaking 21:24
RabidGravy "trouble"?
psch patrickz: i don't think so. it tries to match "" or z, then tries to match End, fails, and stops 21:25
mind, i'm not great with regex though vOv 21:26
Hotkeys Here's the err gist.github.com/johnspurr/d1f85c4e7bcd8beb848c
sorry for weird wrapping
patrickz but if ratchet only means its forbidden to release consumed input, it should go back and consume more input in .+?
Hotkeys powershell doesn't really do multiline copying well
timotimo i think patrickz misunderstood the function of "ratchet"
Hotkeys RabidGravy:
timotimo and it's likely that the documentation is worded in a misleading way 21:27
psch maybe "don't retry" fits better for what :ratchet does?
well, in this informal context here at least 21:28
timotimo m: say "asdfEnd" ~~ / :ratchet ^ [ End | .+? | z ] <?after End> $ /; 21:28
camelia rakudo-moar 9eb1fb: OUTPUT«Nil␤»
timotimo m: say "asdfEnd" ~~ / :ratchet ^ [ End | .+? | z ] <?before End> $ /; 21:29
camelia rakudo-moar 9eb1fb: OUTPUT«Nil␤»
timotimo oh?
patrickz say "asdfEnd" ~~ / :ratchet ^ [ .+? || z ] End $ /;
m: say "asdfEnd" ~~ / :ratchet ^ [ .+? || z ] End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「asdfEnd」␤»
timotimo oh, of course, the group isn't quantified at all
m: say "asdfEnd" ~~ / :ratchet ^ [ End | .+? | z ]+ <?after End> $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「asdfEnd」␤»
psch m: say "ab" ~~ / a | ab /; say "ab" ~~ / a || ab / 21:30
camelia rakudo-moar 9eb1fb: OUTPUT«「ab」␤「a」␤»
psch hm, that interaction i don't quite see through, i have to say :) 21:31
patrickz Non LTM grouping does seem backtrack in that particular sense. 21:32
psch m: say "asdfEnd" ~~ / :ratchet ^ [ .+? | z ] { say $/ } End $ /; 21:33
camelia rakudo-moar 9eb1fb: OUTPUT«「a」␤Nil␤»
psch m: say "asdfEnd" ~~ / :ratchet ^ [ .+? || z ] { say $/.CURSOR } End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«Cursor.new␤Cursor.new␤Cursor.new␤Cursor.new␤「asdfEnd」␤»
psch err
m: say "asdfEnd" ~~ / :ratchet ^ [ .+? || z ] { say $/ } End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「a」␤「a」␤「a」␤「a」␤「asdfEnd」␤»
psch 'a', 'as', 'asd', 'asdf' would have made a bit more sense to me, but still looked wrong
rudi_s Hi. Can I create random numbers with a fixed seed? 21:34
moritz note that frugal quantifiers force backtracking
psch moritz++
that's the kind of detail i'm likely to forget :)
m: say "asdfEnd" ~~ / :ratchet ^ [ .+ || z ] { say $/ } End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「asdfEnd」␤Nil␤»
moritz otherwise a frugal quantifier within :ratchtet would only ever match the minimal number that the quantifier allows, making it very much useless 21:35
patrickz m: say "asdfEnd" ~~ / :ratchet ^ [ .+? || z ] {say $/} End $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「a」␤「a」␤「a」␤「a」␤「asdfEnd」␤»
patrickz m: say "asdfEnd" ~~ / :ratchet ^ [ .+? | z ] {say $/} End $ /; 21:36
camelia rakudo-moar 9eb1fb: OUTPUT«「a」␤Nil␤»
patrickz LTM alternations allow backtracking into left-to-right alternations don't. Is that the correct interpretation? 21:37
[Coke] m: srand 1234; say rand
camelia rakudo-moar 9eb1fb: OUTPUT«0.652006306578386␤»
[Coke] m: srand 1234; say rand
camelia rakudo-moar 9eb1fb: OUTPUT«0.652006306578386␤»
[Coke] rudi_s: ^^
moritz hates that API
[Coke] doc.perl6.org mentions srand, but doesn't actually describe it.
moritz I'd much rather have (^(2**32)).pick(*, :seed(1234)) 21:38
or something like that
psch m: say "aab" ~~ / ^ [ $<a>=a | ab ]+ $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「aab」␤ a => 「a」␤»
psch m: say "aab" ~~ / ^ [ $<a>=a || ab ]+ $ /;
camelia rakudo-moar 9eb1fb: OUTPUT«「aab」␤ a => 「a」␤»
moritz or maybe a dynamic variable $*SEED or so
[Coke] moritz: your api implies that the seed is a one shot, no?
rudi_s [Coke]: Thanks.
moritz [Coke]: yes; hence the second suggestion with the dynamic variable 21:39
rudi_s Hm.
I guess that's global .. so I'll destroy any other random decision in perl if I force srand, right?
I'd like to get a "local" forced seed.
moritz rudi_s: right. Which is why I don't like that API
rudi_s *for just one rand call.
psch m: say 1 !=3 # oh wow this is still around :/ 21:46
camelia rakudo-moar 9eb1fb: OUTPUT«Cannot modify an immutable Int␤ in block <unit> at /tmp/kYWiThl9lv line 1␤␤»
psch well, it is RT'd at least :S 21:47
patrickz I think I still don't understand it. [ || ] allows to be backtracked into in ratchet mode, while [ | ] does not. My gut feeling tells me the two should behave the same. 21:54
lizmat m: my $a = 1; dd $a !=3; dd $a 21:56
camelia rakudo-moar 92c17e: OUTPUT«Bool::False␤Int $a = 3␤»
lizmat weird 21:57
psch patrickz: if you remove the ? quantifier the behavior changes 21:58
patrickz: so it's clearly an interaction between ratchet, the two alternations, and ?
m: say "aab" ~~ / :ratchet ^ [ $<a>=a || ab ]+ $ /; # this also seems weird 21:59
camelia rakudo-moar 92c17e: OUTPUT«Nil␤»
psch ah, nvm, that's correct 22:00
patrickz the ? is needed, otherwise .+ would eat all input and leave none for 'End'
psch patrickz: is :ratchet needed? 'cause without it works for both
patrickz: and ? disables :ratchet locally
patrickz: i'd suspect that for LTM, +? means "0 chars" (because it can) and that means the longer token is the literal 22:01
that's with really shallow knowledge of the regex engine, though
err, "amount of literal chars before the quantifier", which with .+? is 1, actually... 22:02
hm
m: say "a" ~~ / [ $<a>=. | $<b>=.] /
camelia rakudo-moar 92c17e: OUTPUT«「a」␤ a => 「a」␤»
psch m: say "a" ~~ / [ $<a>=. | $<b>=a] / 22:03
camelia rakudo-moar 92c17e: OUTPUT«「a」␤ a => 「a」␤»
psch ...not sure that actually gives a hint vOv
psch lizmat: the ticket is #121108, fyi 22:03
patrickz I'm trying to fix a bug I reported about this behaviour a long time ago. I think I found the piece of code that is responsible. LTM alternations clear the backtrack stack in ratchet mode when they are done, normal alternations don't. But before thinking about a fix I thought I'd make sure I understood what the correct behaviour should be. 22:05
So my questions are not about "How to get this to work?" but about "How is this meant to work?" 22:06
psch patrickz: i'd say in ratchet mode neither should be allowed to clear the backtrack stack
patrickz: note that, in turn, a ?-quantified token under either alternation is still allowed to clear the backtrack stack
patrickz you mean ::, do you? 22:07
psch 21:34 < moritz> note that frugal quantifiers force backtracking 22:08
so, no, i mean ?
but i might have confused "clearing the backtrack stack" with "allow backtracking" :)
patrickz true 22:09
patrickz :-) 22:09
patrickz clear the backtrack stack == do not backtrack past this point 22:09
psch yeah, that's what i gathered on the second read 22:09
the reference to :: helped :)
patrickz So to get your fist statement clear, you think neither | nor || should allow backtracking into in ratchet mode. 22:10
psch not on their own, yes
if the alternate between tokens of which at least one is frugally quantified, they have to
s/the/they/ 22:11
patrickz Now it's getting complicated. 22:11
psch :r [ a | b ] / and / :r [ a || b ] / both don't backtrack 22:12
:r [ a? | b ] / and / :r [ a? || b ] / both do backtrack
patrickz should, but don't
psch that's my understanding
right, talking in terms of an ideal implementation :)
*i was 22:13
patrickz Wait. It wouldn't hurt if the alternations would also backtrack in the [ a | b ] or [ a || b ] case. 22:14
psch right, the examples are too strongly reduce 22:15
patrickz I think we need a statement from someone authorative. Guessing what the specification might be doesn't help much. :-( 22:17
psch i'd agree 22:18
the bits seem to fit together well enough, but to me at least it happened before that some information i wasn't aware of changed the interpretation completely
psch if it's already RT'd maybe just try and poke jnthn or TimToady about it when they're around. if it's not RT'd, RT it and do the same :) 22:19
patrickz Will do. Thanks so far! 22:20
AlexDaniel “APL does this to make Perl 5 easy to read” hahaha 22:23
CurtisOvidPoe: your talks are awesome. Thank you 22:24
CurtisOvidPoe AlexDaniel: thanks. And I was disappointed that the APL joke didn’t get the laughs I hoped for :) 22:25
TEttinger what's this about APL?
I like a lot of stuff in the language, and I wish multi-dimensional data had better support in more languages/platforms 22:26
CurtisOvidPoe I was talking about punctuation characters. APL uses them to make Perl easy to read :)
TEttinger oh yeah
AlexDaniel TEttinger: youtu.be/hR9UdvxMAbo?t=702
CurtisOvidPoe: this silence in response just makes it even funnier :) 22:27
TEttinger oddly enough, if you're coding on a tablet, APL could use a switchable keyboard to enter the special symbols. making it better suited as a language for the 2020s than the 1960s
AlexDaniel Coding on a tablet? Hmmm…
TEttinger so could perl6 for unicode 22:28
AlexDaniel CurtisOvidPoe: I think that “Perl 6 for Mere Mortals” was the talk that got me seriously into Perl 6. Thanks for that too.
CurtisOvidPoe You’re quite welcome. Share it with others, please! 22:29
TEttinger imagine the emoji as sigils
AlexDaniel UInt? Whoa… 22:35
timotimo UInt tests? 22:55
AlexDaniel timotimo: I see nothing 23:22
timotimo ? 23:24
perlawhirl TEttinger: there are several languages where the entire syntax is emojo... emojicode and emoji-lang... plus various others floating around 23:34
AlexDaniel timotimo: I don't see any tests in roast for UInt 23:35
timotimo oh 23:38
i was just making a pun
sorry about the confusion
Hotkeys I spent way too long explaining (poorly) polymod in a codegolf answer just now 23:42
AlexDaniel timotimo: actually, it turned out to be a good observation 23:45
what to do in such cases? Just create an issue in roast repo? (I don't feel like writing any tests today) 23:46
timotimo polymod is quite lovely, isn't it 23:49
Hotkeys yeah it's pretty cool 23:58
here is my trainwreck of an explanation codegolf.stackexchange.com/a/75659/46687
timotimo: