»ö« 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:19 japhb_ is now known as japhb
bioduds_ hi ugexe 00:36
how are you doing?
00:39 simcop2387 left 00:41 simcop2387 joined 00:46 ka joined 00:53 DrParis joined 00:54 isacloud joined 00:55 jnthn left, edenc joined 00:56 Jonis left, integral joined, chris2 left 00:57 kipd joined 00:58 albongo joined 00:59 smash left 01:00 jnthn joined 01:02 chris2 joined, jnap_ joined, chee joined 01:03 Jonis joined 01:17 AlexDaniel joined 01:19 smash joined 01:21 xinming left 01:22 xinming joined 01:28 pierre_ joined 01:32 pierre_ left 01:36 rindolf left 01:54 grondilu left 01:56 sufrostico joined 02:08 fudje joined 02:09 fudje left 02:10 noganex joined 02:14 noganex_ left 02:19 BenGoldberg joined
tushar I am trying to implement multi methods. "multi method get-row (Int :$index! --> Array) { code.. }" and "multi method get-row (Array :@index! --> Array) { code.. }". When I try to call one of them "$obj.get-row(index => [0..2]);", I am experiencing an error stating "Cannot resolve caller AUTOGEN(DataTable: Array); none of these signatures match:". Any idea why any of them are not found? Is there anything wrong that I am doing? 02:23
yoleaux 23 Sep 2016 02:05Z <BenGoldberg> tushar: For a conventient way to install libmagic, consider using the perl5 module Alien::LibMagic.
tushar BenGoldberg: Thanks 02:24
02:25 tadzik joined, M-Illandan joined, Matthew[m] joined
geekosaur wonders if multis can dispatch solely on named parameters currently 02:29
tushar geekosaur: can elaborate your statement? Thanks. 02:30
you*
geekosaur all the examples I've seen of multis have at least one positional parameter they can dispatch on type. your multis have each one named parameter and no positiona;s 02:31
ugexe m: class Foo { multi method get-row (Int :$index! --> Array) { ["int",] }; multi method get-row (:@index! --> Array) { ["array",] } }; say Foo.new.get-row(index => 1); say Foo.new.get-row(index => [1..2])
camelia rakudo-moar 690d4a: OUTPUT«[int]␤[array]␤»
geekosaur ok, guess that works 02:32
can you provide a bit more context for the program and the error, tushar?
raydiak m: multi get-row (Int :$index! --> Array) { say 0 }; multi get-row (Array :@index! --> Array) { say 1 }; get-row(index => [0..2]);
camelia rakudo-moar 690d4a: OUTPUT«Cannot resolve caller get-row(Array); none of these signatures match:␤ (Int :$index! --> Array)␤ (Array :@index! --> Array)␤ in block <unit> at <tmp> line 1␤␤»
ugexe im assuming they are having problems doing `Array :@already-an-array`
otherwise 02:33
m: class Foo { multi method get-row (Int :$index! --> Array) { ["int",] }; multi method get-row (Array :$index! --> Array) { ["array",] } }; say Foo.new.get-row(index => 1); say Foo.new.get-row(index => [1..2])
camelia rakudo-moar 690d4a: OUTPUT«[int]␤[array]␤»
raydiak m: multi get-row (Int :$index! --> Array) { [] }; multi get-row (Array :@index! --> Array) { [] }; get-row(index => [0..2]); 02:34
camelia rakudo-moar 690d4a: OUTPUT«Cannot resolve caller get-row(Array); none of these signatures match:␤ (Int :$index! --> Array)␤ (Array :@index! --> Array)␤ in block <unit> at <tmp> line 1␤␤»
ugexe m: my Array @index; say @index.perl; # [0..2] does not pass this constraint 02:36
camelia rakudo-moar 690d4a: OUTPUT«Array[Array].new()␤»
raydiak ah ha
tushar geekosaur: Sure, I am implementing a method in which user can supply a single value or an array with values. I hope this clarify things.
raydiak m: multi get-row (Int :$index! --> Array) { [] }; multi get-row (Array :$index! --> Array) { [] }; get-row(index => [0..2]); 02:37
camelia ( no output )
geekosaur mm, I meant actual code and the code context for the error message
since the error you got is ... somewhat odd
I could see it being internal but I don't recognize AUTOGEN(DataTable: Array) 02:38
tushar ugexe: you are damm right about it. I always forget that when you use sigil "@", it says I am an array and you don't need to set "Array" type. When you specify "Array" type with "@" it expects to have array of array of array.
geekosaur AUTOGEN's a thing but DataTable isn't 02:39
tushar geekosaur: I will provide paste bin for that in a minute.
DataTable is my module name.
raydiak also, the way the error seems to suggest that an array was passed positionally is LTA 02:40
geekosaur ah. this sounds like an internals leak reported LTA
yeh
(I suspect AUTOGEN should never show up in an error message from a user error) 02:41
BenGoldberg m: multi m(Int $:i) { say 1 }; multi m(Array $:i) { say 2 }; m( i:(1) } 02:44
camelia rakudo-moar 690d4a: OUTPUT«5===SORRY!5===␤In signature parameter, placeholder variables like $:i are illegal␤you probably meant a named parameter: ':$i'␤at <tmp>:1␤------> 3multi m(Int $:i7⏏5) { say 1 }; multi m(Array $:i) { say 2 ␤In signature parameter, placeho…»
BenGoldberg m: multi m(Int :$i) { say 1 }; multi m(Array :$i) { say 2 }; m( i:(1) }
camelia rakudo-moar 690d4a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤You can't adverb i␤at <tmp>:1␤------> 3; multi m(Array :$i) { say 2 }; m( i:(1)7⏏5 }␤»
BenGoldberg m: multi m(Int :$ix) { say 1 }; multi m(Array :$ix) { say 2 }; m( ix:(1) } 02:45
camelia rakudo-moar 690d4a: OUTPUT«===SORRY!===␤This type (QAST::WVal) does not support positional operations␤»
tushar geekosaur: here is the pastebin : pastebin.com/KBhfcz45
BenGoldberg Well, that's definitely a LTA error message :)
tushar what is LTA? 02:46
BenGoldberg Less than Awesome
Perl6 is supposed to have super awesome error messages, and never something nonsensical. 02:47
geekosaur basically means a crap error message, or one that leaks internals
tushar seriously?.. haha..
that's why I love perl 6..
geekosaur ideally the error messages are clear and helpful
sometimes this isn't possible just because it's impossible to tell what was intended, though >.>
BenGoldberg Anything mentioning QAST is LTA, since that's internal to rakudo. 02:48
geekosaur strong AI is not (yet?) a feature of perl6
yep. as is AUTOGEN, which is what makes the error you got kinda terrible
tushar I am looking forward to strong AI..
BenGoldberg "And you can't adverb i" only makes sence if you happen to know that perl6 has support for complex, and 'i' is reserved for making imaginary numbers. 02:49
s/sence/sense/
BenGoldberg 's fingers are stilly tpying nsense tday. 02:51
02:51 mr-foobar joined
geekosaur aaand pastebin is giving me "Please refresh the page to continue" again. ad-ridden POS. 02:54
tushar geekosaur: that's wierd. Because when I clicked on it, it works fine.. 02:57
geekosaur I think it just gets grouchy when people load the raw URL to avoid the ads 02:59
sometimes it works, sometimes you get that and it refuses to ever load (refreshing doesn't get the paste, neither does shift-refresh) 03:00
tushar try this Github Gist -- gist.github.com/tushardave26/5e9d7...08de5b497d . Hope this works.
03:08 skids joined
AlexDaniel acmmittolbe6: HEAD say 42 # :D 03:12
committable6 AlexDaniel, ¦«HEAD»: 42
AlexDaniel levenstein kinda makes sense. Sift4 is fast but wtf? How?? :D 03:14
TEttinger AlexDaniel: woah 03:22
table6commit: HEAD say "wow" 03:23
tablecommit6: HEAD say "wow"
AlexDaniel TEttinger: you can use this to test it: siderite.blogspot.com/2014/11/supe...tance.html 03:24
TEttinger: it currently triggers on anything that is ≤3
bisectable and benchable are set to trigger on distance ≤2 because guess what, the distance between bisectable6 and benchable6 is 3. :D 03:25
bectable6: exit 0 # /o\ 03:27
benchable6 AlexDaniel, starting to benchmark the 1 given commits
AlexDaniel, ¦«exit»:Cannot find this revision
bisectable6 AlexDaniel, On both starting points (old=2015.12 new=376b5f4) the exit code is 0 and the output is identical as well
AlexDaniel, Output on both points:
TEttinger heh 03:28
geekosaur heh
03:37 TEttinger left 03:40 tushar left 04:02 Guest68793 is now known as nemo 04:06 Cabanossi left 04:10 Cabanossi joined 04:12 labster left 04:15 TEttinger joined 04:17 cpage joined 04:25 labster joined
raydiak m: Nil.?Str 04:38
camelia rakudo-moar 9dcde7: OUTPUT«Use of Nil in string context␤ in block <unit> at <tmp> line 1␤»
raydiak should that warning be silenced?
04:42 labster left
geekosaur didn't it do what you asked it to? 04:42
m: dd Nil.?Str
camelia rakudo-moar 9dcde7: OUTPUT«Use of Nil in string context␤ in block <unit> at <tmp> line 1␤""␤»
geekosaur hm, guess not
thought it was producing Nil from the .?
so yes that seems LTA 04:43
m: dd Nil
camelia rakudo-moar 9dcde7: OUTPUT«Nil␤»
geekosaur ...right, that'd be wrong then.
m: dd Nil.Str 04:44
camelia rakudo-moar 9dcde7: OUTPUT«Use of Nil in string context␤ in block <unit> at <tmp> line 1␤""␤»
geekosaur ah. so Nil actually has a Str method which throws that 04:45
making .? kinda useless in that context
raydiak yeah dunno how we'll fix that :) but I'll at least file a bug report some time tonight 04:46
TimToady yeah, .? is about finding the method, not about checking the result 04:47
geekosaur right, the assumption was that there was no such method so $var-that-might-be-Nil.?Str could do something saneish
(I think)
TimToady well, a $var generally can't be Nil unless you bind it 04:48
raydiak named capture inside an optional branch of the regex
TimToady well, that's bound :) 04:49
raydiak I have "$<title> ?? $<title>.Str !! Nil" scattered around in my actions. it doesn't feel very nice. how would you write it?
geekosaur m: say Nil // '' 04:50
camelia rakudo-moar 9dcde7: OUTPUT«␤»
geekosaur m: say (Nil // '').Str
camelia rakudo-moar 9dcde7: OUTPUT«␤»
TimToady with $<title> { .Str } 04:51
m: my $x := Nil; say ($x andthen '')
camelia rakudo-moar 9dcde7: OUTPUT«()␤»
TimToady m: my $x := Nil; say ($x andthen $x) 04:52
camelia rakudo-moar 9dcde7: OUTPUT«()␤»
TimToady m: my $x := 42; say ($x andthen $x)
camelia rakudo-moar 9dcde7: OUTPUT«42␤»
TimToady m: my $x := 42; say ($x with $x)
camelia rakudo-moar 9dcde7: OUTPUT«42␤»
TimToady m: my $x := Nil; say ($x with $x)
camelia rakudo-moar 9dcde7: OUTPUT«()␤»
raydiak I suppose it doesn't matter if the undefined thing it returns is Nil or (). Thank you for the help that is quite a bit nicer 04:53
05:03 khw left 05:07 pierre_ joined 05:33 djbkd joined 05:34 Sgeo joined 05:38 AlexDaniel left 05:39 Guest94548 joined 05:41 BenGoldberg left 06:02 pierre_ left 06:03 rgrinberg left 06:19 wamba joined 06:26 cyphase joined 06:28 andrzejku joined 06:36 k-man__ is now known as k-man 06:39 firstdayonthejob joined 06:42 labster joined 06:43 skids left 06:44 domidumont joined 06:49 domidumont1 joined, domidumont left 06:53 CIAvash joined 06:55 domidumont1 left 07:04 djbkd left, darutoko joined 07:06 sufrostico left 07:10 Guest77506 left, Guest77506 joined, Guest77506 left, Guest77506 joined, Guest77506 is now known as scott 07:17 cyphase left 07:22 cyphase joined 07:27 setty1 joined 07:29 domidumont joined 07:44 andrzejku left 07:45 rindolf joined, djbkd joined 07:51 andrzejku joined 07:58 djbkd left, cpage_ joined 08:01 cyphase left 08:06 cyphase joined 08:11 andrzejku left 08:13 pierre_ joined 08:22 cyphase left 08:24 FROGGS joined
FROGGS o/ 08:24
08:27 cyphase joined
timotimo o/ 08:28
psch o/
08:45 nadim joined 08:49 cyphase left 08:53 cyphase joined 08:54 ab6tract joined
ab6tract s: Duration, "new" 08:56
SourceBaby ab6tract, Sauce is at github.com/rakudo/rakudo/blob/9dcd...tion.pm#L5
08:57 rindolf left
ab6tract was expecting Duration to support the named arguments like :8hours . obviously we might not want to support months or even weeks, but surely minutes and hours would be useful here? 08:59
psch sounds reasonable to me 09:00
09:03 rindolf joined 09:16 cyphase left 09:21 cyphase joined 09:25 Guest94548 left, nebuchadnezzar joined 09:28 domidumont left, Guest94548 joined 09:30 rudi_s left, canopus left
FROGGS enjoys perl6.fail 09:35
09:36 canopus joined 09:44 espadrine joined 09:45 RabidGravy joined 09:50 labster left 09:55 cyphase left 09:59 pierre_ left, pierre_ joined 10:00 cyphase joined 10:04 st_iron joined
st_iron good morning my friends 10:04
10:15 cyphase left 10:19 cyphase joined
tailgate morns 10:28
10:28 cyphase left, nadim left 10:32 cyphase joined 10:42 cyphase left 10:46 cyphase joined 10:48 pmurias joined 10:58 cyphase left 10:59 st_iron left 11:03 cyphase joined, TEttinger left 11:05 st_iron joined 11:07 Actualeyes joined 11:10 cyphase left 11:11 Actualeyes left 11:12 iH2O joined 11:15 cyphase joined 11:23 cyphase left 11:28 cyphase joined 11:36 cyphase left, Actualeyes joined 11:40 cyphase joined
RabidGravy I don't suppose anyone has a clone of HTTP::Server::Tiny handy? I'm struggling to work out the reason for the deadlock in t/12-supply.t 11:40
the actual thing it's testing (i.e. returning a Supply as the body of the response,) works if the client and server are in separate processes 11:45
just not in the test
and it definitely did work fine at some point 11:46
11:48 iH2O left 11:52 cyphase left
samcv what am i doing wrong with this regex? $line ~~ s/^%// 11:53
psch samcv: what's it supposed to mean? what's the failure mode? 11:54
samcv it's supposed to remove a % at the start of a line
psch m: /^%/
camelia rakudo-moar 448f82: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing quantifier on the left argument of %␤at <tmp>:1␤------> 3/^%7⏏5/␤»
samcv yep 11:55
i'm not sure what i did wrong
psch samcv: docs.perl6.org/language/regexes#Mo...ntifier:_%
m: say "1, 2" ~~ / \d+ % ', '/
camelia rakudo-moar 448f82: OUTPUT«「1, 2」␤»
samcv ok so i need to escape it?
psch samcv: yes, you need to escape everything that's not alnum 11:56
samcv: or quote it
samcv so $line ~~ s/^'%'// would work?
psch m: say "%foo" ~~ s/^'%'//; 11:57
camelia rakudo-moar 448f82: OUTPUT«Cannot modify an immutable Str␤ in block <unit> at <tmp> line 1␤␤»
psch m: say ($= "%foo") ~~ s/^'%'//;
camelia rakudo-moar 448f82: OUTPUT«「%」␤»
psch m: say (my $a = "%foo") ~~ s/^'%'//; say $a
camelia rakudo-moar 448f82: OUTPUT«「%」␤foo␤»
11:57 cyphase joined
psch samcv: yes, or as you said /^\%/ should work to 11:58
+o
samcv kk
m: say (my $a = "%foo") ~~ s/^\%//; say $a
camelia rakudo-moar 448f82: OUTPUT«「%」␤foo␤»
samcv m: say "%foo" ~~ s/^\%//;
camelia rakudo-moar 448f82: OUTPUT«Cannot modify an immutable Str␤ in block <unit> at <tmp> line 1␤␤»
samcv m: my $a = "%foo"; $a ~~ s/^\%//; say $a 11:59
camelia rakudo-moar 448f82: OUTPUT«foo␤»
samcv ok
12:03 cyphase left 12:07 pierre_ left 12:08 cyphase joined 12:16 pierre_ joined 12:18 pierre__ joined 12:19 dayangkun joined 12:20 pierre_ left 12:29 dayangkun left, cyphase left 12:34 cyphase joined 12:39 bjz left 12:41 adu joined 12:42 Alikzus left, bjz joined 12:44 adu left 12:45 cyphase left 12:47 Alikzus joined 12:48 st_iron left 12:50 cyphase joined 12:51 jnap_ left, isacloud left, kipd left, NeuralAnomaly left, BuildTheRobots left, peteretep left 12:52 buggable left, huggable left 12:53 kipd joined, peteretep joined, jnap_ joined, isacloud joined 12:54 BuildTheRobots joined 12:55 tadzik left 13:03 cyphase left 13:07 pierre__ left 13:08 cyphase joined 13:10 ka left 13:14 rindolf left 13:17 Guest94548 left 13:19 ka joined 13:23 cyphase left 13:24 rindolf joined 13:25 dayangkun joined 13:28 cyphase joined 13:44 dayangkun left 13:49 cyphase left 13:54 cyphase joined 13:56 ribasushi left 13:59 espadrine left, andrzejku joined, tadzik joined, grondilu joined 14:02 AlexDaniel joined
samcv what is the perl6 equivilent of this? open my $SAID_OUT, '-|', "perl", @said_args; 14:07
14:08 ribasushi joined
samcv basicaly opening a pipe to perl supplied with the arguments in the array @said_args 14:08
timotimo something with run and :in, i'd say. potentially have to flatten the @said_args array by spelling it |@said_args
samcv will that make it run concurrently with the current script or will it wait for it to finish? 14:09
geekosaur concurrently, with :in
since otherwise that would be useless
masak not entirely, if I understand correctly 14:10
I mean, if you know up-front exactly what inputs you're going to give, irrespective of any outputs that come back...
14:10 cyphase left
samcv i'm trying to look up info on :in but not having any luck 14:11
timotimo docs.perl6.org/type/Proc - this has more info
probably really needs a link from the page on routine/run to type/Proc
because that has some more examples with :in and :out 14:12
actually
not really an example with :in per se. just one with :in using a pipe from another run's :out
samcv does :in supply command line args though? 14:13
timotimo :in is only for specifying that you want an input pipe, it has nothing to do with the commandline args
RabidGravy no, run takes a list of command line arguments 14:14
samcv oh i don't want that
RabidGravy what do you want then?
timotimo i thought you wanted to open a pipe?
samcv run 'perl', @said_args, :out;
would that work?
timotimo oh, you only want the *out* pipe
samcv yeah
RabidGravy m: say run("perl", "-v", :out).out.slurp-rest;
camelia rakudo-moar bb52f8: OUTPUT«run is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub run at src/RESTRICTED.setting line 14␤ in block <unit> at <tmp> line 1␤␤»
RabidGravy boo
timotimo you need to flatten the @said_args, i believe
samcv hmm
i can do that 14:15
14:15 cyphase joined
samcv as long as i can supply command line args with spaces in them 14:15
some of the ARGV's have spaces in them and i need to make sure it's not seperated by space
geekosaur run does that. (shell would be the one that flattens into a string) 14:16
RabidGravy yes, it's a single slurpy, so you'd have "run('perl', | @args, :in)"
timotimo oh, do we allow a space there?
RabidGravy dunno, just my typing :)
samcv my $SAID_OUT = run ('perl', | @said_args, :out); Unexpected named argument 'out' passed in sub-signature of parameter @args 14:18
:(
timotimo you put a space after run before the ( 14:19
so you're passing a list as a single argument
samcv ah ok
gfldex lolibloggedagain: gfldex.wordpress.com/2016/09/25/th...s-are-lta/
timotimo and you get a Proc object out of the run command, not just the out pipe
the out pipe itself can be accessed by $result.out
gfldex: your keys are on fi-yah!
samcv and before i was doing: while ( defined (my $line = <$SAID_OUT> ) ) { 14:20
to process each line as the script spits it out, how would i process by line without waiting for script completion in perl6?
timotimo "for $proc.out.lines { ... }" 14:21
samcv where $proc would be $SAID_OUT ?
timotimo yeah
samcv cool :)
14:22 ka left
samcv for my $line = $SAIDOUT.out.lines { will work? 14:22
14:22 cyphase left
timotimo that doesn't mean what you think it means 14:22
but i think it'll "work"
RabidGravy m: my $p = run("perl",:in, :out); $p.in.say("print 1 + 1"); $p.in.close; say $p.out.slurp-rest 14:23
camelia rakudo-moar bb52f8: OUTPUT«run is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub run at src/RESTRICTED.setting line 14␤ in block <unit> at <tmp> line 1␤␤»
timotimo except it'll only run a single iteration
14:23 gnull joined
RabidGravy gah, forgot about that 14:23
timotimo you ran into that 10 minutes ago! :D
RabidGravy I know, having a funny memory afternoon 14:24
timotimo samcv: "for my $line = $SAIDOUT.out.lines {...}" will create a scalar variable named $line, put the result of $SAIDOUT.out.lines into it and then iterate over that scalar variable. but a scalar will only run a single iteration, so you'll have one run of the body with $_ set to $line, which is the Seq that'll give you the lines when you iterate over its .list 14:26
psch plus it leaves $line in the same scope as the for itself, which i think we have in p5-to-6 pitfalls or something..? 14:27
'cause that might not be what you mean
14:27 cyphase joined
timotimo it's 100% not what samcv means :) 14:27
samcv so is there a way other than my $line = $_ on the first line of the loop? 14:28
gfldex m: for my @a = lines() { $++ }; @a.elems.say
camelia rakudo-moar bb52f8: OUTPUT«20␤»
gfldex m: for my @a = lines() { .say }; @a.elems.say
camelia rakudo-moar bb52f8: 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úin sa ghleann ina luí␤I mo dhiaidh bhí gleanntáin ghlas’ G…»
samcv so for $SAID_OUT.out.lines = my $line { ? 14:29
RabidGravy not really 14:30
psch samcv: well, for takes a Block, and anon Blocks get their signature after the pointy
m: say -> $a { } 14:31
camelia rakudo-moar bb52f8: OUTPUT«-> $a { #`(Block|59191480) ... }␤»
RabidGravy for $SAID_OUT.out lines -> $line { }
gfldex samcv: assignment to a @-sigiled container gets you one .flat-call for free.As a result it iterates properly
RabidGravy except I missed a dot
no I didn't 14:32
for $SAID_OUT.out.lines -> $line { }
14:32 khw joined
samcv nice, okay that makes sense 14:33
14:34 Guest94548 joined
RabidGravy anyhow, to repeat my earlier question, does anyone have a local clone of HTTP::Server::Tiny and want to offer any suggestions as to why the deadlock in t/12-supply.t? 14:38
timotimo RabidGravy: ??? "not really"?
RabidGravy eh?
timotimo i'm confused
psch probably lag-based line ordering mixup?
'cause it's perfectly sensible here 14:39
timotimo: irclog.perlgeek.de/perl6/2016-09-25#i_13278499
RabidGravy psch, are you on linux or something else?
timotimo i'm interpreting it as "is there a way ... ?" "not really" "here's how you do it"
psch RabidGravy: i'm on windows with putty to irc.p6c.org
RabidGravy: so, technically, "yes" 14:40
RabidGravy oh no, it was to "so <not worky thing>" :)
Hmm
that's very, very odd
timotimo oh
psch RabidGravy: my 3 lines about lag-based line ordering mixup were about timotimos confusion though :) 14:41
RabidGravy: i have no idea about HTTP::Server::Tiny
RabidGravy oh
14:43 cyphase left 14:48 cyphase joined 14:51 breinbaas joined 14:59 cyphase left 15:03 cyphase joined 15:12 domidumont joined 15:15 cyphase left 15:16 espadrine joined 15:20 cyphase joined 15:35 cyphase left 15:40 cyphase joined 15:44 andrzejku left 15:45 Guest94548 is now known as kaare_ 15:53 rgrinberg joined 15:54 cyphase left 15:56 rgrinberg left 15:57 rgrinberg joined 15:59 cyphase joined 16:08 cyphase left 16:13 cyphase joined 16:15 cbk_ joined 16:18 skids joined 16:22 andrzejku joined
dalek c: 03a21f8 | (Jan-Olof Hendig)++ | doc/Type/Parameter.pod6:
Added a few missing method definitions
16:22
gfldex is there a way for a trait_mod:<is>(Parameter:D \param, :$element-of) to add a where-clause to the parameter? 16:25
psch m: multi trait_mod:<is>(Parameter:D \param where *.sigil eq '$', :$element-of) { } # ? 16:31
camelia ( no output )
16:36 cibs joined 16:39 andrzejku left 16:45 xinming left 16:46 cbk_ left
gfldex psch: i want to add a where-constraint by the trait_mod not on it 16:48
psch m: multi trait_mod:<is>(Parameter:D \param, :$element-of) { die if param.sigil ne '$'; ... } # ? 16:49
camelia ( no output )
psch gfldex: i think you cannot do things about the *value* of the Parameter though
gfldex psch: that would be run at compile time, where clauses are runtime things
psch gfldex: so, if i now finally understand your question correctly, you can't 16:50
m: say &trait_mod:<where>
camelia rakudo-moar bb52f8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ trait_mod:<where> used at line 1. Did you mean 'trait_mod:<hides>', 'trait_mod:<is>', 'trait_mod:<handles>', 'trait_mod:<trusts>', 'trait_mod:<returns>'?␤␤»
psch gfldex: i mean, maybe you can somehow hack something together with Parameter.constraints and cargo-culting what we do internally for post constraints, but i'm pretty sure there's no clean and easy interface for that kinda thing 16:53
16:57 ufobat joined 17:01 lichtkind_ joined 17:02 dj_goku joined, noganex_ joined 17:04 sjohnsen- joined, [particle]1 joined, [particle] left 17:05 lichtkind left 17:06 noganex left, dj_goku_ left 17:07 setty1 left 17:12 andrzejku joined 17:18 andrzejku left 17:52 Actualeyes left 17:57 tushar joined, nadim joined 18:11 sufrostico joined 18:12 El_Che_ is now known as El_Che 18:15 gnull left 18:19 andrzejku joined 18:20 cbk_ joined, maybekoo2 joined
dalek c: 9e92433 | (Jan-Olof Hendig)++ | doc/Type/Parameter.pod6:
Added a few more method definitions and an example
18:22
18:24 labster joined 18:25 sufrostico left
tushar Is there any way to extract an element of each array from array of array? Ex: "my @a = [[1,2,3],[4,5,6]]". How can I extract second element from both the arrays i.e. [2,5]? Thanks. 18:27
FROGGS m: my @a = [[1,2,3],[4,5,6]]; say @a.map({ $_[1] }) 18:28
camelia rakudo-moar bb52f8: OUTPUT«(2 5)␤»
FROGGS tushar: ^^
18:29 girafe joined
FROGGS m: my @a = [[1,2,3],[4,5,6]]; my @b = @a.map({ $_[1] }); dd @b 18:29
camelia rakudo-moar bb52f8: OUTPUT«Array @b = [2, 5]␤»
FROGGS m: my @a = [[1,2,3],[4,5,6]]; my @b = @a.map(*.[1]); dd @b
camelia rakudo-moar bb52f8: OUTPUT«Array @b = [2, 5]␤»
tushar FROGGS: Thanks. 18:30
FROGGS: When you said ^^, you meant ^^ operator. Correct? 18:31
FROGGS no, I meant "look"
:o)
or even "look to what I wrote" 18:32
tushar haha.. got it..
18:32 rindolf left
gfldex m: my @a = [[1,2,3],[4,5,6]]; say @a[0,1][1] 18:32
camelia rakudo-moar bb52f8: OUTPUT«[4 5 6]␤»
gfldex m: my @a = [[1,2,3],[4,5,6]]; say @a[0;1,1;1][1] 18:33
camelia rakudo-moar bb52f8: OUTPUT«Index out of range. Is: 1, should be in 0..0␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
gfldex m: my @a = [[1,2,3],[4,5,6]]; say @a[0,1;1,1]
camelia rakudo-moar bb52f8: OUTPUT«(2 2 5 5)␤»
gfldex m: my @a = [[1,2,3],[4,5,6]]; ssy @a[0,1;1,1]
camelia rakudo-moar bb52f8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ ssy used at line 1. Did you mean 'say'?␤␤»
gfldex m: my @a = [[1,2,3],[4,5,6]]; dd @a[0,1;1,1]
camelia rakudo-moar bb52f8: OUTPUT«(2, 2, 5, 5)␤»
FROGGS m: my @a = [[1,2,3],[4,5,6]]; say @a[0,1;1]
camelia rakudo-moar bb52f8: OUTPUT«(2 5)␤»
FROGGS m: my @a = [[1,2,3],[4,5,6]]; say @a[*;1] 18:34
camelia rakudo-moar bb52f8: OUTPUT«(2 5)␤»
FROGGS though, .map is easier to explain and understand I'd say
18:35 rindolf joined
gfldex tushar: see docs.perl6.org/language/subscripts...dimensions 18:37
tushar FROGGS and gfldex: Thanks.
18:39 dataangel joined
dalek osystem: 22488ae | (Fernando Correa de Oliveira)++ | META.list:
Add ProblemSolver

  github.com/FCO/ProblemSolver
18:40
osystem: 90d5d51 | RabidGravy++ | META.list:
Merge pull request #253 from FCO/master

Add ProblemSolver
SmokeMachine____ :) 18:42
18:53 rodarmor joined
tushar FROGGS: What would you recommend if I would like to extract multiple elements as an array and make array of array out of them. Ex: " my @a = [[1,2,3],[4,5,6]]; say @a[*;0..1];". When I tried it, I got back flatten list. I can use map and push results into new array. I am just wondering is there any other way I can accomplish that? I hope that I am clear enough. 18:54
m: my @a = [[1,2,3],[4,5,6]]; say @a[*;0..1];
camelia rakudo-moar bb52f8: OUTPUT«(1 2 4 5)␤»
tushar what I would like to get "[[1,4],[2,5]]". 18:55
FROGGS m: my @a = [[1,2,3],[4,5,6]]; dd @a[*;0..1]; 18:57
camelia rakudo-moar bb52f8: OUTPUT«(1, 2, 4, 5)␤»
FROGGS hmmm
psch slices always flatten, don't they? 18:59
18:59 FROGGS left 19:00 FROGGS joined
psch so you'd have to map that 19:00
mst m: my @a = [[1,2,3],[4,5,6]]; @a.map: *[0..1]
camelia ( no output )
FROGGS seems like...
mst m: my @a = [[1,2,3],[4,5,6]]; dd @a.map: *[0..1]
camelia rakudo-moar bb52f8: OUTPUT«((1, 2), (4, 5)).Seq␤»
mst that's not completely horrible 19:01
gfldex m: sub g($x where -> \x { fail X::AdHoc.new(payload=>'bad ' ~ x.VAR.name) }) {}; g(1) 19:02
camelia rakudo-moar bb52f8: OUTPUT«bad $topic␤ in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1␤ in sub g at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch m: my @a = [[1,2,3],[4,5,6]]; dd [do [@a[$++;0,1]] for @a]
camelia rakudo-moar bb52f8: OUTPUT«[[1, 2], [4, 5]]␤»
psch that's at least a bit more horrible :P
FROGGS hehe
tushar haha.. 19:03
psch looks a bit like python, actually
19:03 nowan left
tushar hahahaha 19:03
ugexe m: my @a = [[1,2,3],[4,5,6]]; dd [Z] @a; 19:04
camelia rakudo-moar bb52f8: OUTPUT«((1, 4), (2, 5), (3, 6)).Seq␤»
19:05 nowan joined
ugexe m: my @a = [[1,2,3],[4,5,6]]; dd ([Z] @a)[0..1]; 19:07
camelia rakudo-moar bb52f8: OUTPUT«((1, 4), (2, 5))␤»
tushar ugexe++ . How can I convert the resulted list of list to array of array i.e. [[1,4],[2,5]] . I have tried "my @a = [[1,2,3],[4,5,6]]; my @b = ([Z] @a)[0..1];" which gave me an array consisting of list. 19:14
m: my @a = [[1,2,3],[4,5,6]]; my @b = ([Z] @a)[0..1];
camelia ( no output )
tushar m: my @a = [[1,2,3],[4,5,6]]; my @b = ([Z] @a)[0..1]; @b.say;
camelia rakudo-moar bb52f8: OUTPUT«[(1 4) (2 5)]␤»
timotimo m: my @a = [[1, 2, 3], [4, 5, 6]]; say @a[0].WHAT 19:15
camelia rakudo-moar bb52f8: OUTPUT«(Array)␤»
timotimo it's already an array of arrays
19:15 darutoko left
psch ooh misread the question the whole time, ugexe++ 19:15
i mean, i did :) 19:16
tushar timotimo: I know that @a is array of array. I am how can i convert result of "([Z] @a)[0..1];" to array of array. It returns list of list. 19:19
ugexe m: my @a = [[1,2,3],[4,5,6]]; my @arr = ([Z] @a)[0..1]>>.Array; say @arr.perl # if thats what you *really* want 19:20
camelia rakudo-moar bb52f8: OUTPUT«[[1, 4], [2, 5]]␤»
SmokeMachine____ m: sub f([$a, *@a], [$b, *@b]) {gather {take [$a, $b]; if @a & @b { .take for f(@a, @b)}}}; .say for f([1,2,3], [4,5,6])[^2] # :P
camelia rakudo-moar bb52f8: OUTPUT«[1 4]␤[2 5]␤»
mst tushar: them being lists instead of arrays shouldn't I don't think be a problem?
psch: yeah, same here
ugexe++
19:22 perlawhirl joined
tushar hmm 19:22
timotimo well, with lists you don't get scalar containers guaranteed, right?
19:22 cuonglm joined
tushar ugexe++ 19:24
19:27 domidumont left 19:35 cbk_ left 19:36 cuonglm left 19:44 poisonby_ is now known as poisonby 19:46 ufobat left 19:53 mst left, mst joined 20:07 kaare_ left 20:12 andrzejku left 20:13 andrzejku joined 20:16 labster left 20:18 TEttinger joined 20:20 labster joined 20:26 andrzejku left 20:30 FROGGS left 20:38 kurahaupo joined 20:42 rgrinberg left 20:57 espadrine left 21:06 CIAvash left 21:11 rgrinberg joined 21:14 rindolf left 21:19 mspo_ is now known as mspo
dalek c: 6b99fb8 | (Zoffix Znet)++ | doc/Type/Baggy.pod6:
Improve Baggy.classify-list

  - List all possible mappers
  - Document multi-level classify will throw
21:22
21:24 gfldex joined 21:29 tushar left, girafe left 21:31 canopus left
dalek c: eee5cfa | (Zoffix Znet)++ | doc/Type/Baggy.pod6:
Improve Baggy.categorize-list

  - Document all mappers
  - Doocument throwage conditions
21:32
21:36 rba_ joined 21:38 canopus joined, RabidGravy left
dalek c: b4575c9 | (Zoffix Znet)++ | doc/Type/Hash.pod6:
Document Hash.classify-list

Closes #916
21:55
21:56 tushar joined, rba_ left
dalek c: 782e000 | (Zoffix Znet)++ | doc/Type/Hash.pod6:
Document Hash.categorize-list

Closes #916
22:09
c: b234967 | (Zoffix Znet)++ | doc/Type/Hash.pod6:
Explain Hash.classify-list :&as argument
22:10
22:11 aod joined
aod can someone help me with perl6 loops? 22:12
I saw in several places loops like this: for 1, 3..10 { .say }
timotimo that'll need flattening for the second half 22:13
m: .say for 1, 3..10
camelia rakudo-moar 922afd: OUTPUT«1␤3..10␤»
timotimo m: .say for 1, |3..10
camelia rakudo-moar 922afd: OUTPUT«1␤1..10␤»
timotimo whoops, hehe. precedence of operators
m: .say for 1, |(3..10)
camelia rakudo-moar 922afd: OUTPUT«1␤3␤4␤5␤6␤7␤8␤9␤10␤»
aod what about (1,3..10)?
22:14 nadim left
timotimo same as just 1, 3..10 22:14
22:14 nadim joined
timotimo if you want all of it as a single iteration, you can do: 22:14
m: .say for (1,3..10),
camelia rakudo-moar 922afd: OUTPUT«(1 3..10)␤»
Juerd m: sub infix:<except> (@a, $b) { @a.grep: * !~~ $b }; for [1..10] except 2 { .say } 22:15
camelia rakudo-moar 922afd: OUTPUT«1␤3␤4␤5␤6␤7␤8␤9␤10␤»
aod ok. but I saw an example like 0,2..10 where only even numbers were generated> I think I saw it on a larry wall video
Juerd aod: That's with 3 dots
timotimo you need ... for that instead of ..
aod ahhh bingo! 22:16
Juerd m: say 1, 3 ... 10
camelia rakudo-moar 922afd: OUTPUT«(1 3 5 7 9)␤»
aod thanks a lot
I have another question
I saw something like for (1..10) -> $i { say $i } 22:17
timotimo yeah
grondilu (what a tease)
22:18 tushar left
aod actually this for <123> ->$i { .print } 22:19
but I got "control flow error"
22:19 tushar joined
aod nvm I just saw my mistake 22:19
timotimo m: for <123> -> $i { .say } 22:20
camelia rakudo-moar 922afd: OUTPUT«(Any)␤»
timotimo m: for <123> -> $i { $i.say }
camelia rakudo-moar 922afd: OUTPUT«123␤»
22:20 maybekoo2 left
MasterDuke m: for <1 2 3> -> $i { $i.say } 22:20
camelia rakudo-moar 922afd: OUTPUT«1␤2␤3␤»
22:21 firstdayonthejob left, maybekoo2 joined
aod for <1 2 3> -> $i { $i.say } works, but for <1 2 3> -> $i { .say } dowsnt 22:21
timotimo yeah
because .say is syntax for $_.say
if you have -> $i, it won't store the data into $_ 22:22
MasterDuke m: for <1 2 3> { .say }
camelia rakudo-moar 922afd: OUTPUT«1␤2␤3␤»
timotimo right, when you don't give it a ->, it'll be as if you had used "-> $i" 22:23
MasterDuke "-> $_" 22:24
timotimo sorry. yes
if you give it only -> { ... }, it'll be a block that takes no arguments. for will then call it with an argument and it'll promptly explode
m: for <1 2 3> -> { say "oh" }
camelia rakudo-moar 922afd: OUTPUT«Too many positionals passed; expected 0 arguments but got 1␤ in block <unit> at <tmp> line 1␤␤»
22:24 perlawhirl left 22:26 bjz left 22:29 maybekoo2 left 22:32 poisonby left 22:46 rgrinberg left
gfldex omgibloggedagain!!1! gfldex.wordpress.com/2016/09/26/i-...e-channel/ 22:48
also, the docs are LTA on where-clauses 22:49
aod guys how do I list available methods of an object? Like pythons dir? 22:50
timotimo you can call .^methods on it
aod cool thx
timotimo sometimes you'll get an error if you're going too deep into the metaobjects. then you can .map(*.name) to make things readable 22:51
aod ok, like ().^methods.map(*.name) 22:52
more readable
timotimo well, i mean it like this:
m: say Attribute.^methods
camelia rakudo-moar 922afd: OUTPUT«(<anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> <anon> compose apply_handles get_value set_value container readonly package inlined WHY set_why Str gist)␤»
timotimo hm, not quite
gfldex m: say "foo".^methods».&{ .name, .signature.perl }.join: "\n"
camelia rakudo-moar 922afd: OUTPUT«BUILD :(Str $: :$value = "", *%_ --> Nil)␤Int :(Str:D $: *%_)␤Num :(Str:D $: *%_)␤chomp :(Str:D $: *%_)␤pred :(Str:D $: *%_)␤succ :(Str:D $: *%_)␤simplematch :(Str $: $pat, *%_)␤match :(Str $: $pat, :continue(:$c), :pos(:$p), :global(:$g), :o…»
timotimo m: say BOOTAttribute.^methods
camelia rakudo-moar 922afd: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤ BOOTAttribute used at line 1␤␤»
timotimo *shrug* 22:53
gfldex aod: see the following how to detect the odd cases (some are very internal and don't provide introspection) github.com/perl6/doc/blob/master/u...methods.p6 22:54
aod Do you know the rationale behind the choice of ~ as concatenation intead of + in perl6? Im just curious
gfldex aod: sorry wrong link, github.com/perl6/doc/blob/master/u...g-types.p6 22:55
timotimo because operators are coercive in perl6
+ will always turn its arguments into numbers, ~ will always turn its arguments into strings
so you'll never get confused with number + string or string + number
gfldex it's very easy to get that wrong and very hard to have complete tests for it (in languages that overload + for string concat) 22:56
timotimo especially when you look at how - behaves in languages like javascript
aod ok like the weird NaN stuff in JS. But I think the + operator could work id both types were strings. Its just hard to look at ~ and not see it as "negate" 23:00
if both types 23:01
23:02 labster left
timotimo we think it's a good idea to have ~ separate from + 23:02
gfldex hardly ever use ~, most of the time interpolation works better 23:03
timotimo yeah
zengargoyle ~ is like a thread sewing strings together. :)
+ adds
23:04 dayangkun joined
timotimo if you prefer ++ for string concat, you can put "my &infix:<++> = &infix:<~>" at the top of your scripts 23:04
also, in perl5 you used . for string concat, not +.
geekosaur aod, in a language where string and number get conflated a lot, it makes a lot of sense to not require + to guess which one you intended
23:05 dayangkun left
timotimo also, if the operator decides what the result will be, you don't have to look at what types come in to see what type comes out 23:05
23:11 labster joined
aod ok. talking about interpolation, whats the difference between "$a" and "{$a}", if any? {$a} is new to me... 23:11
timotimo no difference 23:12
but you can put any code between the { }
aod oh executable code?
is it like eval? 23:13
timotimo no
gfldex no, it's simply a concat
timotimo it's like writing code into your program
gfldex m: say "a { 41 + 2} b";
camelia rakudo-moar 922afd: OUTPUT«a 43 b␤»
gfldex m: say "a { do $++ for 1..3 } b"; 23:14
camelia rakudo-moar 922afd: OUTPUT«a 0 1 2 b␤»
23:14 cooper_ joined
aod this code is executed at compile time or run time? 23:14
gfldex aod: see docs.perl6.org/language/quoting#In...lation:_qq 23:15
runtime
m: say "a { qx/wget www.google.com/ } b"; 23:16
camelia rakudo-moar 922afd: OUTPUT«qx, qqx is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub QX at src/RESTRICTED.setting line 11␤ in block <unit> at <tmp> line 1␤␤»
gfldex m: say "a { qx/wget -O- www.google.com/ } b"; # maybe better that way
camelia rakudo-moar 922afd: OUTPUT«qx, qqx is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub QX at src/RESTRICTED.setting line 11␤ in block <unit> at <tmp> line 1␤␤»
gfldex m: sleep 10; say now.Int; say "a { BEGIN now.Int } b"; 23:19
camelia rakudo-moar 922afd: OUTPUT«1474845591␤a 1474845581 b␤»
gfldex you can have it at compile time ofc, for many values of compile time
23:21 dayangkun joined
aod learning a lot. perl6 is mind blowing. Another question, why doesnt WHAT shows in ()^.methods 23:32
TimToady it's not really a method 23:33
23:33 dayangkun left, eliasr left 23:40 dayangkun joined
gfldex aod: it's (kind of) defined in Mu. Or better it would be defined in Mu, if Rakudo would have a magic boot to strap. 23:43
aod: see the following to understand what Mu is for docs.perl6.org/language/typesystem...erl_6_Type
23:46 pmurias left 23:49 dayangkun left 23:52 nadim left
dalek c: a38e81a | gfldex++ | doc/Language/typesystem.pod6:
end the sentence
23:52
c: 57234e6 | (Zoffix Znet)++ | doc/Type/Code.pod6:
Document Code.of()
23:59