»ö« 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.
00:02 mr-foobar left
AlexDaniel “I plan to keep using Python 2.* until the sun grows cold or I die (whichever comes first.)” – I didn't know that python 2→3 problem is still a thing 00:04
geekosaur at this point it is not a technical problem, but a political problem 00:06
and. let's just say that the Python community created the political problem itself and seems uninterested in any solution other than increasingly shrill hoots 00:07
00:10 ssotka left
rjbs but it's also a technical problem 00:10
00:12 cognominal left 00:28 smls_ joined, smls_ left, smls left 00:30 bjz left 00:32 huggable joined, pierre_ joined 00:38 grassass left 00:44 BenGoldberg joined 00:50 BenGoldberg left
Xliff geekosaur, I just started learning Python coz... calibre 00:54
And that political problem sounds very similar.
geekosaur exactly
Xliff Is it as bad as perl 5 → 6?
00:54 itaipu left 00:55 bjz joined
geekosaur kovid's not the only one, there are a number of others who refuse to move to python3 essentially for political reasons 00:55
Xliff rjbs, how is it a technical problem?
00:55 BenGoldberg joined
geekosaur it's not terrible; there are even programs that will do the lion's share of it, and many projects that have successfully moved. but there are ideological differences, such as a perception that Python 3 is moving in the direction of prioritizing ease over power (I do not know enough to have a position on it, but I have heard this cited numerous times) 00:57
00:58 BenGoldberg left 01:09 BenGoldberg joined
timotimo Xliff: how is perl5 -> 6 bad? 01:12
okay, apart from people stomping around yelling "perl6 killed perl5!"
geekosaur translating programs 01:13
perl6 is a significant departure
Xliff timotimo, I'm talking political, not technical. 01:17
Even though geekosaur has a point. 01:18
geekosaur and that part I couldn't talk about because I got fed up with the perl 5 community some time back. their reaction to perl 6 is, shall we say, symptomatic
jdv79 m: .say for "\x2488".."\x249b" # cool 01:21
camelia rakudo-moar c59e4d: OUTPUT«⒈␤⒉␤⒊␤⒋␤⒌␤⒍␤⒎␤⒏␤⒐␤⒑␤⒒␤⒓␤⒔␤⒕␤⒖␤⒗␤⒘␤⒙␤⒚␤⒛␤»
jdv79 m: .say for ⒈..⒛ # why not the same thing?
camelia rakudo-moar c59e4d: OUTPUT«1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤11␤12␤13␤14␤15␤16␤17␤18␤19␤20␤»
jdv79 also why do those exist and why do they stop at 20? 01:23
timotimo because those are actual number literals in the second one and strings in the first one
jdv79 even though they represent the same glyph they are understood differently?
timotimo um 01:24
m: say "rand"; say rand
camelia rakudo-moar c59e4d: OUTPUT«rand␤0.0296613608515009␤»
geekosaur if you use it as a syntactic component instead of as a string, you get its numeric value
timotimo ⒛ is literally the same thing as 20 01:25
jdv79 i suppose
timotimo .. cannot behave differently because it can't tell the difference
whereas "\x249b" is not the same as 20 01:26
geekosaur and not the same thing as "⒛" which is explicitly a string
01:26 jack_rabbit left
jdv79 m: .say for "⒈".."⒛" # ok 01:26
camelia rakudo-moar c59e4d: OUTPUT«⒈␤⒉␤⒊␤⒋␤⒌␤⒍␤⒎␤⒏␤⒐␤⒑␤⒒␤⒓␤⒔␤⒕␤⒖␤⒗␤⒘␤⒙␤⒚␤⒛␤»
jdv79 .say for "1".."20" # wut 01:27
m: .say for "1".."20" # wut
camelia rakudo-moar c59e4d: OUTPUT«1␤2␤»
timotimo .. with string endpoints that look like numbers seem to WAT everyone
geekosaur people have been wat-ing over that for the past several days. answer is: string ranges behave in a way that only makes sense in some contexts 01:28
01:28 jack_rabbit joined 01:29 wamba left
timotimo though i must admit the "1".."20" one WATs me, too. i only have the intuition for same-length strings 01:29
01:32 kid51 joined
BenGoldberg m: loop (my $x = "1"; $x le "20"; ++$x) { $x.say } 01:35
camelia rakudo-moar c59e4d: OUTPUT«1␤2␤»
timotimo um, wouldn't ++ always be numeric?
BenGoldberg Nope.
timotimo OK
ah, when you do it with le, that makes much more sense 01:36
BenGoldberg :)
m: loop (my $x = "1a"; $x le "2b"; ++$x) { $x.print } 01:37
camelia rakudo-moar c59e4d: OUTPUT«1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z2a2b»
BenGoldberg The peculiar way ++ on strings works is basically inherited from perl5. 01:39
01:39 BenGoldberg left, sufrostico left
mst when writing something like an imap server A001 -> A999 -> B001 etc. is actually really useful 01:40
and I'm unsure what else ++ on strings could do that would be useful ever
timotimo increase the rightmost unicode codepoint by one and when you reach the end of unicode, increase the one one to the left by one and reset to \0 01:41
01:42 BenGoldberg joined
geekosaur the only remotely useful one is str->int,increment,int->str 01:43
other than what it does now, that is
sortiz m: my $x = "file001.gif"; say ++$x; # Modulo some extension
camelia rakudo-moar c59e4d: OUTPUT«file002.gif␤»
timotimo would you prefer file001.gig? 01:44
sortiz Nope
01:44 molaf left
timotimo :) 01:44
sortiz I like that, but was missing in you description. :)
timotimo not by my description
sortiz *your
timotimo my description was actually insane and wrong and terrible 01:45
m: .print for "\c[SNOWMAN]..\c[COMET]" 01:46
camelia rakudo-moar c59e4d: OUTPUT«☃..☄»
timotimo m: .print for @("\c[SNOWMAN]..\c[COMET]")
camelia rakudo-moar c59e4d: OUTPUT«☃..☄»
timotimo huh?
m: .say for @("\c[SNOWMAN]..\c[COMET]")
camelia rakudo-moar c59e4d: OUTPUT«☃..☄␤»
timotimo oh, hahaha
m: .print for @("\c[SNOWMAN]".."\c[COMET]")
camelia rakudo-moar c59e4d: OUTPUT«☃☄»
timotimo oh, they are neighbours?
mst rock beats scissors, comet beats snowman
timotimo m: .say for "\c[SNOWMAN]", *.succ, ... * 01:47
camelia rakudo-moar c59e4d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/oWt7zY_XPj␤Comma found before apparent series operator; please remove comma (or put parens␤ around the ... listop, or use 'fail' instead of ...)␤at /tmp/oWt7zY_XPj:1␤------> 3.say for "\c[SNOWMAN]",…»
timotimo m: .say for "\c[SNOWMAN]", *.succ ... *
i should really go to bed, i can't even ...
camelia rakudo-moar c59e4d: OUTPUT«(timeout)☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤☃␤…»
timotimo ah, that's what it does on .succ when it doesn't has a sensible successor 01:48
little known fact: before the comet, snowmen actually roamed the earth free and careless
BenGoldberg .u ␤☃
yoleaux U+2424 SYMBOL FOR NEWLINE [So] (␤)
U+2603 SNOWMAN [So] (☃)
mst timotimo++ 01:50
BenGoldberg m: "file.gif".succ.say;
camelia rakudo-moar c59e4d: OUTPUT«filf.gif␤»
timotimo the cradle of filf?
BenGoldberg Filfy picture!
geekosaur m: "file.gif".succ.succ.succ.succ.succ.succ.say 01:51
camelia rakudo-moar c59e4d: OUTPUT«filk.gif␤»
BenGoldberg Musical picture! 01:52
m: ("file.gif"..*)[6].say;
camelia rakudo-moar c59e4d: OUTPUT«filk.gif␤»
01:56 tokuhirom joined, pierre_ left, molaf joined 01:58 pierre_ joined 02:00 tokuhirom left 02:04 ssotka joined, pierre_ left 02:14 AlexDaniel left 02:18 pierre_ joined 02:19 pierre_ left 02:20 Xliff_ joined 02:22 pierre_ joined, Xliff left 02:26 pierre_ left 02:54 astj joined 02:56 noganex_ joined 02:58 kid51 left, noganex left 03:01 |2701 left
lizmat hoelzro [Coke] : what is the issue with github.com/rakudo/rakudo/commit/949a7c7 exactly ? 03:05
03:18 khw left
jdv79 m: .say for "⒈".."⒛" 03:29
camelia rakudo-moar c59e4d: OUTPUT«⒈␤⒉␤⒊␤⒋␤⒌␤⒍␤⒎␤⒏␤⒐␤⒑␤⒒␤⒓␤⒔␤⒕␤⒖␤⒗␤⒘␤⒙␤⒚␤⒛␤»
03:37 pierre_ joined 03:41 pierre_ left 03:45 pierre_ joined 03:46 pierre_ left 03:51 tokuhirom joined 03:57 tokuhirom left 04:01 cpage_ left 04:03 cpage_ joined 04:10 finanalyst joined 04:23 BenGoldberg left
MadcapJake Where is the lazy sub documented? 04:23
oh it's not really a sub, it calls .lazy on the following value, correct? 04:26
Xliff_ jdv79: I do agree, that is cool. However who thought that having single characters from 1 to 20 was a thing?
Why not 1..100? 04:27
04:28 BenGoldberg joined
geekosaur it's unicode. best not to ask >.> 04:28
MadcapJake is `lazy 1,2...*` equivalent to `(1,2...*).lazy`?
04:31 jack_rabbit left, jack_rabbit joined 04:32 aries_liuxueyang left, huggable left, huggable joined 04:33 aries_liuxueyang joined
BenGoldberg m: (1,2...*).lazy; 04:37
m: (1,2...*).lazy.sau;
camelia rakudo-moar c59e4d: OUTPUT«(timeout)» 04:38
rakudo-moar c59e4d: OUTPUT«Method 'sau' not found for invocant of class 'Seq'␤ in block <unit> at /tmp/F0xzlWIKGI line 1␤␤»
MadcapJake m: say (lazy 1, 2 ... *) 04:39
camelia rakudo-moar c59e4d: OUTPUT«(...)␤»
MadcapJake m: say (1, 2 ... *).lazy
camelia rakudo-moar c59e4d: OUTPUT«(...)␤»
BenGoldberg m: my $x = (1,2...*) but role { method lazy { 42 } }; say lazy $x
camelia rakudo-moar c59e4d: OUTPUT«42␤»
BenGoldberg m: my $x = (1,2...*) but role { method lazy { 42 } }; say $x.lazy
camelia rakudo-moar c59e4d: OUTPUT«42␤»
BenGoldberg Tada, question answered.
MadcapJake huh so they really do just call the method lazy, interesting! thanks BenGoldberg! 04:40
04:43 Cabanossi left 04:44 Cabanossi joined 04:48 neuron joined
neuron Hi 04:48
If I want to file a bug against nativecall, should I file it against perl6 or against the 'zavolaj' modujle? 04:49
04:49 rindolf joined
MadcapJake neuron: github.com/rakudo/rakudo#reporting-bugs 04:50
zavolaj has been integrated into rakudo and is no longer maintained as a separate module
neuron MadcapJake: Thanks, that's what I wanted to hear 04:51
04:53 telex left 04:54 kaare_ left, telex joined 04:56 wgb joined 04:58 pierre_ joined 05:00 pierre_ left 05:02 wgb left
MadcapJake looking for some feedback on the generator article I've been chipping away at: gist.github.com/MadcapJake/2e27822...ff10db858f 05:04
What to add? What to shorten? What to explain more?
05:08 pierre_ joined, sortiz left, BenGoldberg left
neuron I like it 05:09
05:09 kaare_ joined
MadcapJake thanks! :) 05:10
05:10 BenGoldberg joined 05:14 kaare_ left
lizmat MadcapJake: too tired to really look at it in depth, but a quick scan looks good 05:22
good night, #perl6!
MadcapJake night!
05:24 tokuhirom joined 05:28 astj left, tokuhirom left 05:29 kaare_ joined 05:36 CIAvash joined 05:39 pierre_ left 05:41 skids joined 05:42 CIAvash left 05:48 kaare__ joined, kaare_ left 05:49 CIAvash joined 05:53 dalek joined, ChanServ sets mode: +v dalek 05:57 aries_liuxueyang left 05:59 edehont joined, aries_liuxueyang joined 06:00 neuron left 06:03 BenGoldberg left 06:04 mr-foobar joined 06:05 kaare__ left 06:06 BenGoldberg joined 06:08 kaare__ joined 06:11 BenGoldberg left 06:12 pmurias joined
pmurias hi 06:12
06:14 kaare__ left 06:16 kaare__ joined, kaare__ left 06:21 mr-foobar left 06:24 mr-foobar joined 06:31 matiaslina joined 06:39 pierre_ joined 06:45 labster left 06:46 pierre_ left 06:48 bjz_ joined, kurahaupo left 06:49 bjz left 06:52 wamba joined 06:54 labster joined 07:02 domidumont joined 07:06 domidumont left, domidumont joined 07:07 wamba left 07:09 wamba joined 07:12 skids left 07:13 aries_liuxueyang left 07:14 aries_liuxueyang joined 07:16 edehont left 07:17 _dolmen_ joined 07:26 firstdayonthejob joined 07:27 ssotka left 07:28 bjz joined 07:29 bjz_ left 07:31 RabidGravy joined
RabidGravy morning! 07:34
07:35 Xliff_ left 07:37 wamba left
pmurias RabidGravy: morning 07:39
07:39 matiaslina left 07:41 domidumont left, kaare_ joined
RabidGravy harr! 07:41
07:45 _dolmen_ left 07:46 firstdayonthejob left 07:54 aries_liuxueyang left 07:55 aries_liuxueyang joined 07:59 mr-foobar left
RabidGravy tum ti tum 08:09
08:13 darutoko joined
pmurias RabidGravy: ? 08:27
08:32 huggable left 08:34 pierre_ joined 08:37 pierre_ left
RabidGravy not really waking up very quickly this morning 08:40
08:53 jjido joined 09:01 cognominal joined 09:06 spider-mario joined 09:21 xinming_ joined 09:22 shmibs joined
RabidGravy wonders why the gtk action bar is only 1 pixel high 09:23
dalek c: 8a694d2 | (Jan-Olof Hendig)++ | doc/Type/Date.pod:
Fixed typo, added some missing C<> tags and wrote two new examples
09:24
09:25 tokuhirom joined
dalek k-simple: 9bcd1c3 | RabidGravy++ | / (2 files):
Add ActionBar

One widget a day :)
09:29
09:29 tokuhirom left 09:30 TEttinger left 09:34 cognominal left, mr-foobar joined 09:35 pmurias left 09:36 titsuki joined 09:38 jjido left 09:40 pierre_ joined, ecocode joined
titsuki Hi. Does anyone know how to see the internal state when debugging the NativeCall bindings ? 09:43
"perl6-gdb-m"doesn't seem to return useful results. 09:44
09:45 pierre_ left
titsuki example: gist.github.com/titsuki/1a50197595...433f814fe7 09:46
09:48 aries_liuxueyang left 09:55 cognominal joined
titsuki I want to know the line where the error has occurred. 09:56
RabidGravy you will need to build the library with the debugging symbols 10:04
-g with gcc
10:05 wamba joined
titsuki RabidGravy: Thanks. Is this correct ? : gist.github.com/titsuki/15182a4d37...34556040b1 10:06
RabidGravy looks alright
titsuki then I have already set g option 10:07
10:09 labster left
RabidGravy well it's not in effect 10:10
have you deleted all the *.o files and the .so file and rebuilt since adding that?
titsuki RabidGravy: I did so. 10:11
RabidGravy or you're using another c compiler and the -g doesn't mean the same
10:12 hankache joined 10:13 aries_liuxueyang joined
RabidGravy does it actually have the -g in the resulting Makefile? 10:13
titsuki RabidGravy: This is the resulting Makefile gist.github.com/titsuki/51c9ed6efb...97d5af402c 10:14
It contains g option.
hankache hello #perl6 10:17
RabidGravy erp
titsuki and I use a common gcc compiler gist.github.com/titsuki/83c5e2bd25...956bb724f3 10:18
10:19 jjido joined
dalek k-simple: f8eb045 | azawawi++ | examples/0 (4 files):
Add missing `use v6; use lib 'lib'` to examples
10:22
RabidGravy titsuki, dunno then, it should have the debug information - the only remaining possibility is that you are loading a different version of the .so without the debug information 10:26
10:28 jjido left
titsuki RabidGravy: I see. Thanks for the reply ! 10:31
10:32 jjido_ joined 10:38 kaare_ left, kid51 joined 10:39 bjz_ joined 10:41 bjz left 10:43 cpage_ left 10:44 ocbtec joined 10:45 cpage_ joined 10:54 pyrimidine joined 11:03 jjido_ left
dalek osystem: 3c935ad | (Francis Whittle)++ | META.list:
Add Path::Map to the ecosystem

Port of Path::Map from Perl5 with extended functionality.
See github.com/fjwhittle/p6-Path-Map
11:13
osystem: 0f86c0e | titsuki++ | META.list:
Merge pull request #208 from fjwhittle/fjwhittle-p6-Path-Map

Add Path::Map to the ecosystem
11:14 buharin joined 11:22 jjido joined 11:26 jjido left 11:38 jjido joined, tbrowder joined
tbrowder good morning perl 6 people 11:42
11:46 jjido left 11:49 jjido joined
tbrowder question about testing: is there currently a way to declare tests that are (1) expected to fail and (2) unexpectedly pass. the use case I am thinking about is for adding time tests to roast. 11:49
psch tbrowder: look for "todo" in t/spec 11:50
tbrowder: specifically e.g. "#?rakudo todo reason here" 11:51
well, more specifically - i don't think we have a todo with reason "reason here" :)
11:52 jjido left
masak isn't "todo" for tests that expectedly fail but *don't* unexpectedly pass? 12:00
tbrowder I was thinking of something on the order of the XFAIL tests of gcc, but it looks like that could be done by just adding another test series (sub dir) of expected failures where the user could be alerted if one or more passed, correct?
psch masak: i think you're right, and i misunderstood tbrowder's question 12:01
tbrowder psch: what repo is t/spec in?
psch like, i seem to have added a 'might' in (2), but on closer inspection that's not really there :)
tbrowder: that's where 'make spectest' puts roast 12:02
12:04 aries_liuxueyang left
tbrowder i don't see t/spec in rakudo or roast 12:05
12:05 aries_liuxueyang joined 12:06 jjido joined
psch tbrowder: when you run 'make spectest' inside the rakudo repository, the makefile downloads perl6/roast into the local folder t/spec 12:06
tbrowder: sorry for being confusing... :) 12:07
github.com/perl6/roast/blob/master...ence.t#L19 is one example 12:08
but i think masak++ is right and that's not quite what you're looking for
fwiw, i don't think defining the Perl 6 specification in terms of "this bit should just not work in whatever way, and if it works something is wrong" seems sensible 12:09
12:09 hankache left
psch but well, i am having trouble thinking of an example, so there :) 12:09
tbrowder psch: thanks, i've only run roast outside rakudo and haven't really looked hard at it. i just thought of the timing thing upon reading of the latest rakudo release and how i am going to run my own timing tests i have used since the Christmas release 12:12
psch tbrowder: did you look at p6bench? i think we could use someone to involve themselves with that... :)
github.com/japhb/perl6-bench 12:13
tbrowder my tests are at github.com/tbrowder/perl6-read-write-tests 12:14
i have looked at p6 bench before and intended to run it on one of my servers but haven't yet gotten a round TOIT. my test is very simple and pragmatic for my typical use case. i also have a non-working native call version in the works to see if the rw can be improved 12:18
psch doc.perl6.org/language/testing#Skipping_tests is how to use todo outside of roast, fwiw 12:20
12:30 Ven joined 12:32 huggable joined 12:38 tbrowder left 12:42 hankache joined
hankache m: use Test; is-approx 2, 2, 'Two is equal to two'; 12:43
camelia rakudo-moar 4f046d: OUTPUT«ok 1 - Two is equal to two␤»
hankache m: use Test; is-approx 2, 2;
camelia rakudo-moar 4f046d: OUTPUT«Absolute tolerance must be a positive number greater than zero␤ in sub is-approx at /home/camelia/rakudo-m-inst-2/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 251␤ in block <unit> at /tmp/L8iAhr7H3y line 1␤␤»
hankache This is misleading ^^
The doc doc.perl6.org/language/testing states that is-approx signature is either is-approx($value, $expected, $description?) or is-deeply($value, $expected, $description?) 12:44
12:45 domidumont joined
hankache so if you use the first signature and omit a description it doesn't work and expects a tolerance 12:45
sorry the 2 signatures are: is-approx($value, $expected, $description?) and is-approx($value, $expected, $tol, $description?) 12:46
psch m: use Test; is-approx 2, 2, :1abs_tol
camelia rakudo-moar 4f046d: OUTPUT«ok 1 - ␤»
hankache who's wrong in this case the doc or the implementation?
psch hankache: the is-approx candidates are a mess, imo :/ 12:47
there was a bit of discussion about this a few weeks back, but i can't find it right now 12:48
hankache psch aha
well i just wanted to flag it. I can live with it as is, just thought maybe it's a bug or wrong doc 12:49
psch i think there's just too many candidates 12:50
m: use Test; say +&is-approx.candidates
camelia rakudo-moar 4f046d: OUTPUT«3␤»
psch m: use Test; say &is-approx.candidates
camelia rakudo-moar 4f046d: OUTPUT«(sub is-approx (Numeric $got, Numeric $expected, $desc = "") { #`(Sub|71995304) ... } sub is-approx (Numeric $got, Numeric $expected, Numeric $tol, $desc = "") { #`(Sub|71995456) ... } sub is-approx (Numeric $got, Numeric $expected, Numeric :$rel_tol = 1e-…»
psch the second one there just isn't useful
m: use Test; say &is-approx.candidates[2] 12:51
camelia rakudo-moar 4f046d: OUTPUT«sub is-approx (Numeric $got, Numeric $expected, Numeric :$rel_tol = 1e-06, Numeric :$abs_tol = 0, :$desc = "") { #`(Sub|88281304) ... }␤»
psch well, maybe not "not useful", but at least breaking dispatch expectations :S 12:52
hankache psch shouldn't the 1st candidate work? 12:53
m: say &is-approx.candidates[0]
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/tKhTorxkNx␤Undeclared routine:␤ is-approx used at line 1␤␤»
psch m: multi f($?) { "one opt" }; multi f() { "none" }; f()
camelia ( no output )
psch m: multi f($?) { "one opt" }; multi f() { "none" }; say f()
camelia rakudo-moar 4f046d: OUTPUT«none␤»
hankache m: use Test; say &is-approx.candidates[0]
camelia rakudo-moar 4f046d: OUTPUT«sub is-approx (Numeric $got, Numeric $expected, $desc = "") { #`(Sub|89001128) ... }␤»
psch m: multi f($,$?) { "one opt" }; multi f($) { "one" }; say f(1)
camelia rakudo-moar 4f046d: OUTPUT«one␤»
hankache this one ^^
psch m: multi f($) { "one" }; multi f($,$?) { "one opt" }; say f(1)
camelia rakudo-moar 4f046d: OUTPUT«one␤»
psch m: multi f($) { "one" }; multi f($,$="") { "one opt" }; say f(1) 12:54
camelia rakudo-moar 4f046d: OUTPUT«one␤»
psch oh duh, got lead astray
dispatch isn't the problem, the problem is bad invocation of something else, isn't it 12:55
m: use Test; is-approx 2, 2;
camelia rakudo-moar 4f046d: OUTPUT«Absolute tolerance must be a positive number greater than zero␤ in sub is-approx at /home/camelia/rakudo-m-inst-2/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 251␤ in block <unit> at /tmp/MPC2NxQ_m1 line 1␤␤»
hankache psch no idea
psch huh 12:56
hankache see this should use the first candidate but it is not
psch m: multi f($a, Numeric $b) { say "$b" }; multi f($a) { f($a, 1e-6) }; say f(1)
camelia rakudo-moar 4f046d: OUTPUT«1e-06␤True␤»
12:57 jjido left, pierre joined
psch m: say 1e-06 > 0 12:57
camelia rakudo-moar 4f046d: OUTPUT«True␤»
psch github.com/rakudo/rakudo/blob/nom/...t.pm6#L232 is where it dies 12:58
but it really shouldn't
'cause that candidate gets invoked with 1e-6
m: say 1e-6 > 0
camelia rakudo-moar 4f046d: OUTPUT«True␤»
hankache the dispatcher is getting lost 12:59
psch m: use Test; say &is-approx.candidates[2](2, 2, 1e-6)
camelia rakudo-moar 4f046d: OUTPUT«Too many positionals passed; expected 2 arguments but got 3␤ in sub is-approx at /home/camelia/rakudo-m-inst-2/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 246␤ in block <unit> at /tmp/tF1G1bugIl line 1␤␤»
psch m: use Test; say &is-approx.candidates[1](2, 2, 1e-6) 13:00
camelia rakudo-moar 4f046d: OUTPUT«ok 1 - ␤True␤»
psch m: use Test; say &is-approx.candidates[0](2, 2)
camelia rakudo-moar 4f046d: OUTPUT«ok 1 - ␤True␤»
hankache it should use this one github.com/rakudo/rakudo/blob/nom/...t.pm6#L226
13:00 AlexDaniel joined
psch oh, right 13:00
missed the "Absolute"
13:00 buharin left
psch so the actual problem is that the candidate with nameds has a default for one of its nameds that's actually wrong 13:01
hankache m: use Test; is-approx 2.Num, 2.Num;
camelia rakudo-moar 4f046d: OUTPUT«Absolute tolerance must be a positive number greater than zero␤ in sub is-approx at /home/camelia/rakudo-m-inst-2/share/perl6/sources/C712FE6969F786C9380D643DF17E85D06868219E (Test) line 251␤ in block <unit> at /tmp/uEjVD1TjIK line 1␤␤»
psch i mean, yes, no nameds should be narrower than optional nameds
but that's not the easy way to fix this... :)
and besides, it'd *still* have a bad default
13:02 pierre left
psch i don't know what a good default for absolute tolerance would be though vOv 13:02
hankache ah i got an idea 13:03
how can i add a new candidate using monkey-patching? 13:04
maybe if you add a type to $desc (Str) it could work?
13:06 pierre joined
psch m: multi f(:$ = "foo") { "named with default" }; multi f() { "no params" }; say f 13:09
camelia rakudo-moar 4f046d: OUTPUT«named with default␤»
psch hankache: types don't matter. it's just that a named that has a value is narrower than no named
which is actually reasonable, i think :)
13:09 domidumont left
psch hankache: the fix really is just changing the default for abs_tol 13:09
this might even want to be a FAQ 13:10
...do we have a multi dispatch traps FAQ?
hankache ah well adding a type to $desc doesn't solve it 13:11
13:11 silug joined
hankache psch if we have i'd gladly take a look at it 13:11
13:12 Emeric joined
psch hm, it does seem a bit too in-depth for the FAQ we have :/ 13:13
dalek c: ae0a4bd | (Jan-Olof Hendig)++ | doc/Type/X/Temporal/InvalidFormat.pod:
Added docs for X::Temporal::InvalidFormat
hankache what would happen in the case you had these 2 candidates? is-approx(Numeric $got, Numeric $expected, :$desc = '') and is-approx(Numeric $got, Numeric $expected,Numeric :$rel_tol = 1e-6) ? 13:16
13:17 CIAvash left, pierre left
psch m: multi is-approx(Numeric $got, Numeric $expected, :$desc = '') { "desc" }; multi is-approx(Numeric $got, Numeric $expected,Numeric :$rel_tol = 1e-6) { "rel-tol" }; say is-approx 1, 1 13:18
camelia rakudo-moar 4f046d: OUTPUT«desc␤»
13:18 bjz_ left
psch m: multi is-approx(Numeric $got, Numeric $expected,Numeric :$rel_tol = 1e-6) { "rel-tol" }; multi is-approx(Numeric $got, Numeric $expected, :$desc = '') { "desc" }; is-approx 1, 1 13:18
camelia ( no output )
psch m: multi is-approx(Numeric $got, Numeric $expected,Numeric :$rel_tol = 1e-6) { "rel-tol" }; multi is-approx(Numeric $got, Numeric $expected, :$desc = '') { "desc" }; say is-approx 1, 1
camelia rakudo-moar 4f046d: OUTPUT«rel-tol␤»
psch hankache: falls back to order-of-declaration 13:19
13:19 bjz joined
hankache psch ok 13:19
psch hankache: way i see it there's two solutions. either abs_tol and rel_tol get their default values removed, or abs_tol gets a useful default 13:25
hankache: the first case means we dispatch to the 3-param cand with 2 args, the second means the current behavior stays, but works
13:26 wamba left
hankache psch which one is more _sane_ ? 13:27
psch well, considering the abs_tol candidate does something different i'd say the first one 13:28
i suppose the default for rel_tol probably could stick around
but having abs_tol without default means it's opt-in
which is probably what was intended, and isn't currently work as such 13:29
hankache aha
13:33 |2701 joined 13:34 Ven left
dalek c: bbe2538 | (Jan-Olof Hendig)++ | doc/Type/Signature.pod:
Fixed broken link
13:39
masak m: sub infix:<y->($coords, $dy) { $coords ~~ /(.*)\,(.*)/ or die "not coords"; "$0,{$1 - $dy}" }; say "4,5" y- 20 13:50
camelia rakudo-moar 4f046d: OUTPUT«4,-15␤»
masak quite possibly the weirdest custom op I've created for some real purpose.
psch that's amazing :D 13:51
masak part of why I needed is because I'm taking temporary shortcuts with my model 13:52
but they make sense in the moment :)
MadcapJake Looking for some input (before I publish) on my generators article: gist.github.com/MadcapJake/2e27822...ff10db858f 13:53
psch MadcapJake: the only thing of note is that the remark "As you can see, it is quite a bit more verbose." doesn't really seem to fit to me 13:59
as in, i can't see that, because i don't have the same semantics with non-OO code
hm, maybe the actual problem is that there's that long a "real-world" example suddenly at the end 14:00
as in, everything else was just minimal and demonstrative, and then there's an example for a different concept that's muddled in a lot of not-really-related code 14:01
MadcapJake yeah I just wanted to show using an Iterator/Iterable roled class. I could make it shorter.
Good point, I'll shorten it to something simple then.
masak MadcapJake: "within these walls, `take` returns a value to be pushed onto an array"
MadcapJake: that makes it sound like `gather` is a lexical construct. but it's dynamic. 14:02
m: my @a = gather { foo() }; sub foo() { take 1; take 2; take 3 }; say @a
camelia rakudo-moar 4f046d: OUTPUT«[1 2 3]␤»
hoelzro o/ #perl6 14:03
MadcapJake ok, yeah I should definitely explain that 14:04
masak not sure how best to phrase it 14:06
but "within these walls" sounds like a lexical-not-dynamic construct to me
14:10 raiph joined
stmuk_ oh I never knew Intel 64 bit is actually 48bit! 14:12
MadcapJake what would you say is the difference between Seq and List? 14:16
14:17 Ven joined, pierre joined
MadcapJake figured it out 14:20
arnsholt IIRC a Seq can only be traversed once 14:21
14:22 pierre left 14:28 khw joined 14:30 wamba joined
Ven arnsholt: unless you call *cache* on it 14:38
m: sub f($a) { for $a { .say }; for $a { .say }; }; f((1, 2, 3)) 14:39
camelia rakudo-moar 4f046d: OUTPUT«(1 2 3)␤(1 2 3)␤»
Ven m: sub f($a) { for $a { .say }; for $a { .say }; }; f((1, 2 X+ 3, 4))
camelia rakudo-moar 4f046d: OUTPUT«(4 5 5 6)␤(4 5 5 6)␤»
14:40 cpage_ left
Ven m: say map(-> ($i, $j) { $i + $j }, (-1, 0 X 0, 1)); 14:40
camelia rakudo-moar 4f046d: OUTPUT«(-1 0 0 1)␤»
Ven m: for ^2 { say [+] map(-> ($i, $j) { $i + $j }, (-1, 0 X 0, 1)); } 14:43
camelia rakudo-moar 4f046d: OUTPUT«0␤This Seq has already been iterated, and its values consumed␤(you might solve this by adding .cache on usages of the Seq, or␤by assigning the Seq into an array)␤ in block <unit> at /tmp/gXbGg4BN5R line 1␤␤»
Ven There, that was the one I hit last time.
14:44 BenGoldberg joined 14:47 cdg joined 14:53 buharin joined 15:03 CIAvash joined 15:06 Actualeyes left 15:11 buharin left 15:12 buharin joined 15:15 buharin left 15:20 buharin joined
MadcapJake It's up: madcapjake.github.io/2016/perl6-generators/ 15:23
psch, masak: thanks for the tips! I've made adjustments accordingly
15:24 tokuhirom joined 15:29 tokuhirom left 15:31 cpage_ joined 15:34 smls joined
masak MadcapJake++ 15:34
hankache MadcapJake++ 15:37
smls Could someone (ideally TimToady) take a look at RT #123933, and decide what the expected regex behavior is there?
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=123933
15:44 firstdayonthejob joined 15:57 Ven left
TimToady I'll have to page in my regex brane to think about that one; historically rakudo just slapped ':' on various things, but that wasn't necessarily how it was originally envisioned to work, so I need to reconstruct the arguments 15:59
(and my branes don't page out/in till I've had more coffee than this...) 16:00
smls :) 16:01
16:03 KotH joined
MadcapJake m: say "abcd" ~~ /:r ["foo" | .+!] "d"/ 16:04
camelia rakudo-moar 4f046d: OUTPUT«Nil␤»
16:07 pierre joined
smls Yeah, it only matches with || not | 16:07
MadcapJake smls: what about this line in S05: "Note: for portions of patterns subject to longest-token analysis, a : is ignored in any case, since there will be no backtracking necessary." 16:08
16:09 pecastro left 16:10 pmurias joined
smls I think that talks about the : being redundant in [ <a>: | <b> ] 16:10
16:12 pierre left
MadcapJake m: say "abcd" ~~ /["foo" | .+!]: "d"/; say "abcd" ~~ /["foo" | .+!] "d"/ 16:13
camelia rakudo-moar 4f046d: OUTPUT«Nil␤「abcd」␤»
hankache can stdout be redirected to a variable? 16:17
16:18 dwarring left
MadcapJake hankache: yeah, via Proc.new(:out) and $proc.out (an IO::Pipe) doc.perl6.org/type/Proc#method_new 16:20
ugexe something like $*OUT = class :: { method print(*@_) { $whatever = @_ }; method flush(|) { } }; 16:21
hankache thn
thanks
tadzik IO::Capture::Simple does roughly that 16:22
you may find it useful
hankache thanks 16:25
ugexe $*OUT.Supply.tap: {.say}; would probably be the cleanest way, but currently it just freezes
16:26 pmurias left
MadcapJake start { $*OUT.Supply.tap: {.say} }; say 'hello!' 16:29
m: start { $*OUT.Supply.tap: {.say} }; say 'hello!'
camelia rakudo-moar 4f046d: OUTPUT«hello!␤»
MadcapJake huh, on my machine it prints «hello!␤True» 16:30
psch m: my @*LINES; start { $*OUT.Supply.tap: { @*LINES.push: $_ } }; say 'hello!'; #note @*LINES
camelia rakudo-moar 4f046d: OUTPUT«hello!␤»
psch m: my @*LINES; start { $*OUT.Supply.tap: { @*LINES.push: $_ } }; say 'hello!'; note @*LINES
camelia rakudo-moar 4f046d: OUTPUT«hello!␤[]␤»
ugexe m: start { $*OUT.Supply.tap: {say "xxx"} }; say 'hello!'
camelia rakudo-moar 4f046d: OUTPUT«hello!␤»
psch m: my @*LINES; start { $*OUT.Supply.tap: { @*LINES.push: $_ } }; $*OUT.say: 'hello!'; note @*LINES 16:31
camelia rakudo-moar 4f046d: OUTPUT«hello!␤[]␤»
dalek k-simple: d3ac2da | azawawi++ | README.md:
Fix spelling typo in README
16:32 huggable left
BenGoldberg The way IO::Capture:: 16:32
16:33 Zoffix joined
BenGoldberg The way IO::Capture::Simple uses global variables means that if you do capture(&something_which_throws_an_exception), then capturing will remain in effect... 16:33
ugexe i always temp $*OUT but i tend to avoid modules for 1 liners 16:35
Zoffix Hey. When is it best to use roles instead of classes? I've seen people rage about awesomeness of roles, but all I know about them is they behave as if all the methods were part of the class they're composed into and not passed up the food chain with inheritance... Is that all there is to it? 16:36
ugexe parameterization, method resolution, etc 16:37
MadcapJake ensuring that your class matches a specified interface
Ulti MadcapJake++ I like your generators article, you should check out Icon if you want to see early implementations of the idea :3 where the keyword was "suspend" rather than yield en.wikipedia.org/wiki/Icon_(progra...Generators
ugexe container[My::Type].new(blah => 1) # sometimes i use them to allow me to write initialization like this instead of passing My::Type into new 16:38
Zoffix MadcapJake, oh, that's my current need. So I should use a Role.
I need to readup on parameterization 16:39
16:40 CIAvash left
MadcapJake Ulti: thanks! That's really neat about Icon. I'm not sure I've ever even heard of the language! :P 16:40
psch m: role R { method foo { "foo" } }; class A does R { }; class B is A { }; say B.foo
camelia rakudo-moar 4f046d: OUTPUT«foo␤»
ugexe also roles with a single member can use `xxx but My::Role($member)`
psch isn't sure whether B is "up the foodchain" from A
Zoffix m: role R { method foo { "foo" } }; class A does R { }; class B is A { method foo { 'bar' } }; say B.foo 16:41
camelia rakudo-moar 4f046d: OUTPUT«bar␤»
psch well, that's just normal shadowing 16:42
Ulti MadcapJake yeah its sort of obscure, its the child of SNOBOL which was an early string processing language in the 60s, Icon is one of those 70s languages that never quite made it because it was ahead of its day
psch m: class A { method foo { "foo" } }; class B is A { method foo { "bar" } }; B.foo.say
camelia rakudo-moar 4f046d: OUTPUT«bar␤»
ugexe m: role R { method foo { "foo" } }; class A does R { }; class B is A { method foo { 'bar' } }; say B.*foo
camelia rakudo-moar 4f046d: OUTPUT«(bar foo)␤»
Zoffix By "up the foodchain" I meant that if it's not found in B, it goes to look in A, while with roles, the method gets composed into the class
geekosaur did a fair bit with icon bitd
Ulti orly 16:43
psch Zoffix: right, but if the parent clase composes the role that's the same, isn't it?
*class
Zoffix Looks like it.
Ulti my Dad used it for work and since it was so high level I learnt quite a bit of programming in it since graphics and GUIs were really easy to program
Zoffix psch, I just don't really see the benefit for R to be a role and not a class in that case :/
Or I don't get what the benefit is. 16:44
psch fwiw, i don't have strong opinions on how to do OO. well, except "inheritance is a mess" maybe :S
MadcapJake Ulti: neat! It looks really clean and expressive for an old language
psch well, the difference between roles and classes is that the latter cannot be composed 16:45
only inherited
ugexe you cant mixin a class
psch right, "composed into something else", which is probably better expressed as mixin, ugexe++ 16:46
MadcapJake Zoffix: I think it can often be a matter of choice. But I would say classes are for instantiation and roles are for enclosing specific "roles" that you want to have multiple classes utilize. By "roles" I mean a set of methods that all work around a specific task
psch MadcapJake: that's not really an argument against making that same role a parent class, though
MadcapJake: and, well, roles can be punned too
i think it was masak++ who said to usually just use roles, 'cause they do everything classes do and more vOv 16:47
...or maybe the actual argument was "it's the shorter keyword"
i don't remember
MadcapJake Here's how S14 describes the difference: design.perl6.org/S14.html#Roles 16:50
ugexe theres some problems with punning though, although i cant recall them off the top of my head
MadcapJake Though is it wrong about roles not being able to be instantiated?
ugexe when you are trying to do more advanced initialization 16:51
psch m: role R { method f(::?CLASS:D: ) { say "i'm definite!" } }; R.new.f
camelia rakudo-moar 4f046d: OUTPUT«i'm definite!␤»
ugexe m: role Foo[$a] { has $.b; method new ($b) { self.bless(b => $b * $a); }; }; say Foo[10].new(2).perl # ehh 16:52
camelia rakudo-moar 4f046d: OUTPUT«Foo[Int].new(b => 20)␤»
Zoffix m: say (1, 2, 3).Seq.is-lazy
camelia rakudo-moar 4f046d: OUTPUT«False␤»
Zoffix MadcapJake, what do you mean by Seq is inherently lazy? (RE: your article)
psch ugexe: what's 'ehh' about that?
MadcapJake Zoffix: is-lazy is for Array and List to know what to do when they build (whether to do it eagerly or not)
Zoffix MadcapJake, ahh. Thanks. 16:53
MadcapJake m: say (lazy 1, 2, 3).is-lazy
camelia rakudo-moar 4f046d: OUTPUT«True␤»
ugexe because you can't actually initialize foo with that
psch ugexe: i don't get it? what's "that"? 16:54
ugexe m: role Foo[$a] { has $.b; method new ($b) { self.bless(b => $b * $a); }; }; say Foo[Int].new(20).perl
camelia rakudo-moar 4f046d: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in method new at /tmp/Bvk0Rf7wEY line 1␤ in any at gen/moar/m-Metamodel.nqp line 1736␤ in block <unit> at /tmp/Bvk0Rf7wEY line 1␤␤»
psch ohh
the .perl is wrong then, yeah 16:55
Zoffix MadcapJake++ # informative article 16:59
17:01 finanalyst left
ugexe m: role Foo { has $.a; }; my $x but Foo(42); say $x.a # maybe needs a better error message (my $x = 1 but Foo(42)) 17:02
camelia rakudo-moar 4f046d: OUTPUT«Unexpected named parameter 'value' passed␤ in block <unit> at /tmp/iCEiY4dzvb line 1␤␤»
psch m: role Foo { has $.a }; Foo(42) 17:03
camelia rakudo-moar 4f046d: OUTPUT«Cannot invoke this object (REPR: Uninstantiable; Foo)␤ in block <unit> at /tmp/8a6akFTj_v line 1␤␤»
psch eh, probably different code path due to the but
ugexe thats probably trying to use a class CALL-ME
psch yeah. i'm not aware of "but Role($attr-value)" meaning anything, but that doesn't have to mean anything... :) 17:04
ugexe m: role Foo { has $.a; }; my $x = 1 but Foo(42); say $x.a
camelia rakudo-moar 4f046d: OUTPUT«42␤»
Zoffix 0.o
ugexe single attribute role can use that form
17:05 domidumont joined
ugexe m: role Foo { has $.a; has $.b; }; my $x = 1 but Foo(42); say $x.a 17:05
camelia rakudo-moar 4f046d: OUTPUT«Can only supply an initialization value for a role if it has a single public attribute, but this is not the case for 'Foo'␤ in any mixin at gen/moar/m-Metamodel.nqp line 1293␤ in block <unit> at /tmp/Ju0JNlN6OZ line 1␤␤»
dalek k-simple: f74f422 | finanalyst++ | / (2 files):
Added set-active method to preselect an combobox option. Modified example 06 to demonstrate.
17:08
k-simple: 93c8774 | RabidGravy++ | / (2 files):
Merge pull request #32 from finanalyst/master

Added set-active method to preselect an combobox option. Modified exa…
buharin hey can I ask emacs question?
Zoffix You just did! 😜
timotimo i know emacs has the "therapist mode" where you can ask it questions 17:09
hm. actually. i think it asks you questions
Zoffix timotimo++
llfourn checks to see if this is real
Zoffix Wait... that wasn't a joke? :o
timotimo not a joke
geekosaur and never forget M-x psychoanalyze-pinhead
Zoffix :O
geekosaur (eliza connected to yow) 17:10
timotimo what is yow?
geekosaur zippy the pinhead quotes
timotimo oh?
never heard of that comic 17:11
geekosaur en.wikipedia.org/wiki/Zippy_the_Pinhead
(it is ... inexplicable)
17:12 firstdayonthejob left
dalek c: cc620b5 | titsuki++ | doc/Type/Str.pod:
Fix printf arguments
17:17
c: 0cd4571 | (Zoffix Znet)++ | doc/Type/Str.pod:
Merge pull request #535 from titsuki/fix-printf

Fix printf arguments
buharin Zoffix: when I am trying to paste by ctrl+shift+v from clipboard I get additional spaces with every line
like: original text is some\nsome\n and yanked some\nsome\n\n
Zoffix buharin, ¯\_(ツ)_/¯ I use Sublime Text 2 and Atom.
buharin if you know what I mean
ohh ok 17:18
:(
Zoffix I'm sure there's #emacs or similar on Freenode
llfourn buharin: I use ctrl-y which seems to use the clipboard anyways but this is on mac
buharin wait will check
17:19 Emeric left
geekosaur if you paste with ctrl+shift+v then autoindent and other settings apply, just as if you typed it. if you use ctrl-y, they don't 17:20
17:20 firstdayonthejob joined
TimToady has special vim commands to turn autoindent off and on for that reason 17:20
geekosaur ...but emacs in terminal may not have pasteboard/clipboard access 17:21
buharin on Linux I cann't do this with ctrl-y
geekosaur (especially on OS X where things are Weird)
TimToady also has firefox bindings that let ctrl+shift+v work :)
geekosaur right, on linux you'd need a build with X11 support and emacs -nw
...and -nw might nevertheless block access to X11 selections 17:22
buharin :(
geekosaur vim has specific support for running in a terminal but connecting to X11 to read its selections. I don't recall emacs having this
timotimo there's also "fakeclip" for vim
17:22 Zoffix left 17:25 khw left 17:26 khw joined 17:28 willthechill joined 17:33 Emeric joined 17:42 skingsbu joined 17:46 rindolf left 17:50 buharin_ joined 18:03 cdg left 18:05 kurahaupo joined, kurahaupo left 18:06 TimToady joined, hankache_ joined 18:09 hankache left
smls moritz: Are you fine with closing #123666 ? 18:12
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=123666
18:25 hankache_ left, hankache joined
moritz smls: yes 18:30
smls ok
18:30 cdg joined 18:38 domidumont left 18:39 aries_liuxueyang left 18:41 aries_liuxueyang joined 18:48 BenGoldberg left 18:49 BenGoldberg joined, BenGoldberg left 18:51 hankache left
TimToady what a strange caller-id: LLDSGJL JLDFSJL 19:12
all home-row keys...
19:18 rindolf joined 19:25 tokuhirom joined
masak TimToady: all we know about them is they probably don't use Dvorak :P 19:26
TimToady yeah, that occurred to me :) 19:27
(having won the obfuscated C contest once with a Dvorak emulator) 19:28
19:29 tokuhirom left 19:30 jjido joined 19:31 |2701 left, KotH left 19:33 bjz left, jjido left 19:37 jjido joined 19:38 pecastro joined, awwaiid joined
AlexDaniel can't write a comment on RT /o\ 19:51
ah, it logged me out, that's why 19:52
19:57 TEttinger joined 20:00 brrt joined 20:05 |2701 joined 20:07 _dolmen_ joined 20:08 darutoko left
psch AlexDaniel: yeah, the auto logout on RT doesn't make sense to me 20:12
dalek c: a957eef | raiph++ | doc/Language/objects.pod:
Show BUILDALL example returning built object

  "It doesn't seem clear from the documentation that returning from BUILDALL would matter."
See www.perlmonks.org/?node_id=1163681
psch i mean, i never figured out when or why it happens
20:17 brrt left, pecastro left
dalek c: e3555ea | raiph++ | doc/Language/traps.pod:
Fix mistake in BUILDALL example code

Immediate `nextsame` makes a method a no op. Switched to `callsame`. This revealed that the BUILDALL example failed to return `self`.
20:24
20:32 KotH joined, huggable joined
moritz m: multi e(@tree) { my \op = &::("infix:<{@tree.shift}>); @tree.map(&e).reduce(op) }; multi (\e) { e }; say e ['+', 5, 7] 20:32
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/XEpQjJy5DN␤Unable to parse expression in double quotes; couldn't find final '"' ␤at /tmp/XEpQjJy5DN:1␤------> 3) }; multi (\e) { e }; say e ['+', 5, 7]7⏏5<EOL>␤ expecting any of:␤ hori…»
timotimo why would you return self from a BUILD method? 20:33
moritz m: multi e(@tree) { my \op = &::("infix:<{@tree.shift}>"); @tree.map(&e).reduce(op) }; multi (\e) { e }; say e ['+', 5, 7]
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/m31xfDiy2f␤An anonymous routine may not take a multi declarator␤at /tmp/m31xfDiy2f:1␤------> 3t}>"); @tree.map(&e).reduce(op) }; multi7⏏5 (\e) { e }; say e ['+', 5, 7]␤»
20:33 matiaslina joined
moritz m: multi e(@tree) { my \op = &::("infix:<{@tree.shift}>"); @tree.map(&e).reduce(op) }; multi e(\x) { }; say e ['+', 5, 7] 20:33
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/3FGQmdJfyY␤Missing infix inside []␤at /tmp/3FGQmdJfyY:1␤------> 3.reduce(op) }; multi e(\x) { }; say e [7⏏5'+', 5, 7]␤ expecting any of:␤ bracketed infix␤ infix␤ inf…»
TimToady we should probably force the siggie on those to --> Nil
moritz timotimo: cargo culting, most likely
20:34 jjido left
timotimo but why would we encourage that in the docs? 20:34
moritz m: multi e(@tree) { my \op = &::("infix:<{@tree.shift}>"); @tree.map(&e).reduce(op) }; multi e(\x) { }; say e(['+', 5, 7])
camelia rakudo-moar 4f046d: OUTPUT«Use of Nil in numeric context in sub e at /tmp/9zizSaS4Lx line 1␤Use of Nil in numeric context in sub e at /tmp/9zizSaS4Lx line 1␤0␤»
timotimo oh, returning from BUILDALL
20:34 jjido joined
timotimo yeah, that's different 20:34
moritz m: multi e(@tree) { my \op = &::("infix:<{@tree.shift}>"); @tree.map(&e).reduce(op) }; multi e(\x) { x }; say e(['+', 5, 7])
camelia rakudo-moar 4f046d: OUTPUT«12␤»
moritz finally
my generic-ish tree evaluator 20:35
timotimo yeah, bless just returns what BUILDALL returns
moritz timotimo: yes, BUILDALL should return self
TimToady and we should force buildall to --> self except that doesn't work yet :)
unless it does
m: my method foo (--> self) { 42; }; foo("bar") 20:36
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/aPzAytoQhh␤Type 'self' is not declared␤at /tmp/aPzAytoQhh:1␤------> 3my method foo (--> self7⏏5) { 42; }; foo("bar")␤»
TimToady nah 20:37
odd error though
I guess self isn't introduced soon enough to be in the siggie
arguably a buglet
20:38 jjido left, jjido joined
moritz masak: a few days ago, you said that code using map felt more declarative to you than one using explicit loops, with fewer moving parts. How do you feel about code using list comprehensions? 20:40
masak: I ask, because in the python community, list comprehensions seem to be seen as more idiomatic 20:41
TimToady yeah, those are python's new hammer
moritz (presumably because they are a bit more general, and python's lambdas are... weirdish)
RabidGravy what are "list comprehensions"? I understand both the words individually the idiom makes no sense to me 20:43
infact the plural of comprehension makes no sense 20:44
TimToady en.wikipedia.org/wiki/List_comprehension 20:45
RabidGravy I'm not convinced that helps me understand, infact the article seems designed as a barrier to, er, comprehension 20:48
;-)
TimToady blames the mathematicians 20:50
RabidGravy I blame my maths teacher
I jacked it all in and studied literature when I was 19 20:51
moritz RabidGravy: in python, you might write new = [x + 1 for in old] to generate a list of elements where each item is increased by one
*for x in old
that's a list comprehension
and the map variant would be new = map(lambda x: x +1, old) 20:52
in p6, @new = map * + 1, @old
TimToady the main problem with them linguistically is that they're postdeclarations
the other problem is that they put the 'if' outside the loop 20:53
moritz right, that's the really weird part
RabidGravy never liked it in python
smls TimToady: It's like the american date format... middle->right->left
;)
moritz at_most_five = [x for x in old if x <= 5]
TimToady we've just tried to get as close as possible by making it fall out of normal statement modifiers
RabidGravy yeah, either of the object form or statement modifier seem more natural to me 20:55
TimToady $_ if $_ <= 5 for @old
-> $x { $x if $x } for @old
awwaiid in haskell the list is lazy
moritz grep * <= 5, @old 20:56
TimToady m: say ( -> $x { $x if $x <= 5 } for 1..10 )
camelia rakudo-moar 4f046d: OUTPUT«(1 2 3 4 5)␤»
20:57 willthechill left 20:58 Emeric left
TimToady awwaiid: the lists are lazy in p6 too 20:59
AlexDaniel I've always thought that list comprehensions in python are popular only because it lacks a good enough .map
am I wrong?
TimToady it's cargo-culted math, basically 21:00
masak moritz: I think I consider maps and list comprehensions about equally declarative, at least in Python. 21:01
moritz: the differences are minute. I could imagine if I had several transformation steps then using `map()` or `filter()` would feel more natural, perhaps. 21:02
but most of the time it's a wash.
TimToady I'd say that .map has to be late-bound, but a built-in can make more assumptions about it 21:04
AlexDaniel m: say ($_ + 1 for <1 2 3>) # by the way, do we call this ← a “list comprehension” in perl 6?
camelia rakudo-moar 4f046d: OUTPUT«(2 3 4)␤»
TimToady yes, we do
moritz masak: ok, thanks
TimToady but only when we're trying to show off
21:05 Emeric joined
moritz I do feel a bit of envy that it's so easy to get a reference to a bound method object in python 21:05
python: obj.foo Perl 6: -> |c { $obj.foo: |c } 21:06
masak moritz: yes, me too. 21:07
moritz: I've been meaning to blog about bound methods in various languages -- haven't got achhhround tuit yet though 21:08
awwaiid I've been reading so much ruby where they use |x| for params in blocks that it took me three readings to see the |c as a super-slurpy param :) 21:10
TimToady
.oO( 'foo'.assuming($obj:) )
21:11
awwaiid yeah, partial was coming to my mind also. that work?
masak TimToady, the language design troll :P
TimToady to really use partial you'd have to use .can 21:12
masak no, it won't work -- that `:` only works in signatures, not in argument lists
TimToady sez who? 21:13
masak ...assuming TimToady doesn't change the rules just to prove a point, natch...
RabidGravy :-^
TimToady looks for his deloran
*rean
awwaiid that'd be another colon for my collection :) 21:14
RabidGravy we saw one in a petrol station in Melksham of all places
TimToady m: say polymod(42, 3 xx *) 21:15
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/gExnBfMncG␤Undeclared routine:␤ polymod used at line 1␤␤»
masak I think "set the invocant" might be a solution to a problem that was never that general to begin with
TimToady m: say polymod(42: 3 xx *)
camelia rakudo-moar 4f046d: OUTPUT«(0 2 1 1)␤»
TimToady returns in his DeLorean 21:16
masak in the overwhelming majority of the cases, one wants to extract a bound method with the invocant set to the object the method was pulled out of
TimToady that being said, dunno that .assuming will accepting a colon
psch m: printf("%d": 5)
camelia rakudo-moar 4f046d: OUTPUT«5»
TimToady in fact, pretty sure it won't
psch m: Str.^can('printf').say 21:17
camelia rakudo-moar 4f046d: OUTPUT«(printf)␤»
psch huh, i thought we didn't have that
TimToady is a bit surprised too
but pleasantly so
21:21 Emeric left, labster joined
TimToady wonders if we could have some kind of curry-the-rest-of-these-args notation 21:22
to be applied on the arguments end, not the . end 21:23
21:26 _dolmen_ left 21:27 tokuhirom joined 21:28 TimToady left
RabidGravy so I've concluded that the mango mint and chilli sauce our lovely neighbour brought round is the great satan, I can't feel my lips 21:28
TEttinger Satan, devourer of lips
llfourn maybe your neighbour can brand it "Satan's kiss" and make a mint 21:29
a mint of money that is :)
timotimo get tongue-kissed by satan
sounds lovely, don't it?
21:30 TimToady joined
jast that sauce does sound interesting, though 21:30
it might even be worth sending your lips to purgatory... 21:31
21:31 tokuhirom left
awwaiid m: class Baz { method greet($name) { say "Greetings, $name!" }; method get-method($m) { self.^methods.grep($m)[0].assuming(self) } }; my $b = Baz.new; $f = $b.get-method('greet'); $f('Pat') 21:33
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/usrCYL8OBQ␤Variable '$f' is not declared␤at /tmp/usrCYL8OBQ:1␤------> 030].assuming(self) } }; my $b = Baz.new; 7⏏5$f = $b.get-method('greet'); $f('Pat')␤»
awwaiid m: class Baz { method greet($name) { say "Greetings, $name!" }; method get-method($m) { self.^methods.grep($m)[0].assuming(self) } }; my $b = Baz.new; my $f = $b.get-method('greet'); $f('Pat')
camelia rakudo-moar 4f046d: OUTPUT«Method object coerced to string (please use .gist or .perl to do that) in method get-method at /tmp/mEKeXZnho1 line 1␤Greetings, Pat!␤»
21:37 kaare_ joined
TimToady maybe something like $obj.foo(1,2,3,,,), with $obj.foo(,,,) as a degenerate case 21:39
MasterDuke i just noticed that the jvm's nqp::nextfiledir returns results with the the path of the dir that was nqp::opendir'ed, but moar's doesn't 21:40
e.g., nqp-j -e 'nqp::say(nqp::nextfiledir(nqp::opendir("nqp")))' # nqp/bin, but nqp-m -e 'nqp::say(nqp::nextfiledir(nqp::opendir("nqp")))' # bin 21:41
jjido TimToady: $obj.foo(*,*,*,*)
MasterDuke is that expected behavior?
TimToady jjido: we can't know whether .foo is already expecting to process Whatevers, so that synax is not really available 21:48
I picked ,,, because it's currently a syntax error
m: say 1,,,
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/rd0fMI_ZBh␤Preceding context expects a term, but found infix , instead␤at /tmp/rd0fMI_ZBh:1␤------> 3say 1,,7⏏5,␤»
21:49 rindolf left
TimToady but maybe we could come up with something better 21:49
jjido don't know 21:50
21:51 kaare_ left
masak TimToady: something tells me it'd be a regret-later kind of mistake to start messing with comma/argument clocking, for pretty much the same reasons we've decided not to do it with terms and ops 21:54
TimToady well, I'd treat ,,, as a single token, but yeah 21:55
maybe some unicode would be clearer
masak :P
21:56 ssotka joined
TimToady $obj.foo(┅) looks pretty darn impressive :) 21:57
but what I'm proposing is a general syntax that degrades to what other languages provide :) 21:58
psch i had thought $obj&.foo as shortcut for .^can('foo'), but that'd serve a different purpose i think
also not sure that works sensibly enough as a method op, and in a class scope it's probably weirdish
timotimo &obj &.foo is already a thing 22:00
as is &obj & .foo
psch m: say 5&.abs
camelia rakudo-moar 4f046d: OUTPUT«Method 'abs' not found for invocant of class 'Any'␤ in block <unit> at /tmp/s91gCtJgyI line 1␤␤»
psch yeah, that goes to infix:<&> 22:01
m: $_ = 1; say 5&.abs
camelia rakudo-moar 4f046d: OUTPUT«all(5, 1)␤»
timotimo m: say 5 &.abs # also a thing
camelia rakudo-moar 4f046d: OUTPUT«Method 'abs' not found for invocant of class 'Any'␤ in block <unit> at /tmp/ngFm40jwaW line 1␤␤»
timotimo oh, apparently not a thing
psch yeah, the same thing :)
timotimo i thought that could be like $.foo or @.bar
i.e. a call to self
psch m: class A { has &.foo = -> { say "hi" }; method f { &.foo } }; A.f 22:02
camelia rakudo-moar 4f046d: OUTPUT«Cannot look up attributes in a type object␤ in method f at /tmp/skb6ddkWtJ line 1␤ in block <unit> at /tmp/skb6ddkWtJ line 1␤␤»
psch m: class A { has &.foo = -> { say "hi" }; method f { &.foo } }; A.new.f
camelia ( no output )
psch m: class A { has &.foo = -> { say "hi" }; method f { say &.foo } }; A.new.f
camelia rakudo-moar 4f046d: OUTPUT«-> { #`(Block|75882256) ... }␤»
timotimo oh, haha
psch that's what i mean with "in a class scope weirdish" :)
jnthn timotimo: It is, when the parser is looking for a term rather than an infix :)
timotimo would have been TTIAR
yeah
took me a minute to realize that
jnthn m: &.foo
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/cKMFktWt49␤Variable &.foo used where no 'self' is available␤at /tmp/cKMFktWt49:1␤------> 3&.foo7⏏5<EOL>␤ expecting any of:␤ term␤»
22:04 jack_rabbit left
psch i like the idea of a shortcut for $obj.can("$meth").assuming($obj: *) 22:08
timotimo you mean **? :P 22:09
oh, no
22:10 buharin left 22:13 rindolf joined 22:15 bjz joined 22:24 cdg left 22:30 RabidGravy left 22:35 ocbtec left
psch m: my &printf-wrap = printf(**); printf-wrap("%s", "foo") 22:35
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/NtSbarxp3W␤Calling printf(HyperWhatever) will never work with declared signature (Cool $format, *@args)␤at /tmp/NtSbarxp3W:1␤------> 3my &printf-wrap = 7⏏5printf(**); printf-wrap("%s", "foo")␤»
psch m: my &printf-wrap = printf.assuming(**); printf-wrap("%s", "foo") 22:36
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/akLDGJpV3T␤Calling printf() will never work with declared signature (Cool $format, *@args)␤at /tmp/akLDGJpV3T:1␤------> 3my &printf-wrap = 7⏏5printf.assuming(**); printf-wrap("%s", "␤»
psch ...okay that is a bit LTA
m: my &printf-wrap = printf.assuming(*,*); printf-wrap("%s", "foo")
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/lW2LS6jc25␤Calling printf() will never work with declared signature (Cool $format, *@args)␤at /tmp/lW2LS6jc25:1␤------> 3my &printf-wrap = 7⏏5printf.assuming(*,*); printf-wrap("%s", ␤»
psch wait, i'm just doing it wrong again, aren't i? :)
m: my &printf-wrap = &printf.assuming(**); printf-wrap("%s", "foo")
camelia rakudo-moar 4f046d: OUTPUT«Type check failed in binding $format; expected Cool but got HyperWhatever (**)␤ in sub trybind at EVAL_1 line 1␤ in block <unit> at EVAL_1 line 1␤ in block <unit> at /tmp/5oYyvKPpGc line 1␤␤»
psch m: my &printf-wrap = &printf.assuming(*,*); printf-wrap("%s", "foo") 22:37
camelia rakudo-moar 4f046d: OUTPUT«foo»
psch yeah, i was
jjido psch: ah that works? 22:38
psch jjido: the latest iteration, yeah.. :) 22:39
22:39 brabo joined
psch m: my &printf-wrap = &printf.assuming("%s", *); printf-wrap "foo" # this too, works 22:40
camelia rakudo-moar 4f046d: OUTPUT«foo»
psch m: my &printf-wrap = &printf.assuming(*, 5); printf-wrap "%08d" # as does this
camelia rakudo-moar 4f046d: OUTPUT«00000005»
psch i forget who did that work there, but i'm glad it happened
jjido: basically, assuming takes Whatever to mean "these are the parameters i *don't* want to give values for" 22:41
smls psch: What would ** do there?
m: my &printf-wrap = &printf.assuming(); printf-wrap("%s", "foo")
camelia rakudo-moar 4f046d: OUTPUT«foo»
psch smls: i don't think that's specified anywhere. i'd probably interpret it to mean "all positional from here on" 22:42
smls you can just pass less parameters, to achieve that
(to assuming)
psch yeah, i see that
i'm not sure there's anything left it could mean 22:43
mean "make this positional slurpy instead"?
AlexDaniel m: &printf.wrap: { nextsame }; printf “%08d”
camelia rakudo-moar 4f046d: OUTPUT«Your printf-style directives specify 1 argument, but no argument was supplied␤ in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1␤ in any panic at /home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm line 1…»
psch although that's kind of ugh
AlexDaniel “Your printf-style directives specify 1 argument, but no argument was supplied” … what's the right way to read this?
aah 22:44
right, I see
psch m: printf "%d", class :: { } 22:45
camelia rakudo-moar 4f046d: OUTPUT«Directive d not applicable for type <anon|56507504>␤ in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1␤ in any panic at /home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm line 1␤␤»
AlexDaniel m: &printf.wrap: { say ‘hello world’ }; printf “%08d”
camelia rakudo-moar 4f046d: OUTPUT«hello world␤»
AlexDaniel m: &printf.wrap: { say ‘hello world’ }; printf “%08d”, 42
camelia rakudo-moar 4f046d: OUTPUT«Too many positionals passed; expected 0 or 1 arguments but got 2␤ in block <unit> at /tmp/9xTKYMFF_1 line 1␤␤»
AlexDaniel is there any way to make that work?
psch m: &printf.wrap: { .say }; printf “%08d”
camelia rakudo-moar 4f046d: OUTPUT«%08d␤»
psch AlexDaniel: i think you're misusing .wrap there :) 22:46
AlexDaniel: or rather, i don't understand what you're trying to achieve
AlexDaniel psch: doesn't mean that there's no way to make it work :D
psch m: &printf.wrap: -> $fmt, *@stuff { say "calling printf!"; printf $fmt, @stuff }; printf "%08d", 5 22:47
ugh
AlexDaniel /o\
camelia rakudo-moar 4f046d: OUTPUT«(timeout)calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling printf!␤calling print…»
psch ...that should've been "nextwith $fmt, @stuff" instead of "printf ..." :P
geekosaur whoops
psch or callwith..?
22:48 TakinOver joined
psch anyway, yeah 22:48
if you want to wrap a sub with a slurpy, you have to wrap it with a callable with a slurpy in its sig
AlexDaniel m: &printf.wrap: -> $fmt, *@stuff { say "calling printf!"; nextsame }; printf "%08d", 5
camelia rakudo-moar 4f046d: OUTPUT«calling printf!␤Attempt to return outside of any Routine␤ in block <unit> at /tmp/PW6TNh3oLI line 1␤␤»
AlexDaniel m: &printf.wrap: -> $fmt, *@stuff { say "calling printf!"; callsame }; printf "%08d", 5
camelia rakudo-moar 4f046d: OUTPUT«calling printf!␤»
22:48 firstdayonthejob left
AlexDaniel m: &printf.wrap: -> $fmt, *@stuff { callwith($fmt, 42) }; printf "%08d", 5 22:49
camelia ( no output )
psch i don't really know how .wrap works though :/
might also be buggy from... something... recently
no idea
AlexDaniel star: &printf.wrap: -> $fmt, *@stuff { callwith($fmt, 42) }; printf "%08d", 5
camelia ( no output )
AlexDaniel m: &printf.wrap: -> $fmt, *@stuff { callsame }; printf "%08d", 42 22:50
camelia ( no output )
AlexDaniel huggable: dunno 22:51
huggable AlexDaniel, ¯\_(ツ)_/¯
psch hrm
maybe something weird about slurpies there
i mean, i recently (as in, a few weeks ago) learned that {call,next}{same,with} on redispatch on candidates with the same arity 22:52
s/on/only/
which is why this doesn't work:
m: sub f($a) { say "got $a" }; &f.wrap( sub ($a, $b) { say "$b here!"; callwith $a } ); f(1, 2)
camelia rakudo-moar 4f046d: OUTPUT«5===SORRY!5=== Error while compiling /tmp/cejBqg2Oku␤Calling f(Int, Int) will never work with declared signature ($a)␤at /tmp/cejBqg2Oku:1␤------> 3 $b) { say "$b here!"; callwith $a } ); 7⏏5f(1, 2)␤»
psch well, maybe not quite *why*, but it's related :P
m: multi f($) { nextwith 1, 2 }; multi f($, $) { say "all good" }; f 1 22:54
camelia ( no output )
psch ^^^ that's what i mean
AlexDaniel interesting
well, what's even more interesting, is that nothing happens 22:55
psch m: multi f($) { callwith 1, 2 }; multi f($, $) { say "all good" }; f 1
camelia ( no output )
AlexDaniel m: multi f($) { say callwith(1, 2) }; multi f($, $) { say "all good" }; f 1 22:56
camelia rakudo-moar 4f046d: OUTPUT«Nil␤»
jjido AlexDaniel: not returning anything in either func 22:57
psch jjido: &say returns True 22:58
m: say say 1
camelia rakudo-moar 4f046d: OUTPUT«1␤True␤»
jjido k 22:59
23:11 |2701 left 23:14 jack_rabbit joined 23:16 jjido left 23:17 jjido joined 23:19 jack_rabbit left 23:20 spider-mario left, cdg joined, jack_rabbit joined 23:21 jjido left 23:23 tokuhirom joined 23:29 tokuhirom left
TimToady vaguely attempts to backlog all the #perl6 that happened during OSCON, with mixed results :) 23:31
23:36 rindolf left 23:42 wamba left 23:56 cognominal left 23:59 bjz left