»ö« 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:00
cyphase joined
00:01
[particle] joined
|
|||
tbrowder | timotimo: thanks, flat vs '|' is confusing | 00:02 | |
timotimo | mhm | 00:04 | |
timotimo goes to bed, or something | |||
cya! | |||
raiph | isn't flat vs | 00:06 | |
isn | |||
gah! | |||
tbrowder: isn't flat vs '|' just a case of a listop vs an unary (one item) prefix op? | 00:08 | ||
m: say flat (1,2),(3,4); say |(1,2),3,4 | 00:09 | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 2 3 4)1234» | ||
00:13
[particle] left
00:20
[particle] joined
|
|||
raiph | tbrowder: Forget my previous comment. Have you read the p6doc pages for `flat` and for prefix (routine) `|`? I just spent a while playing around with them and they worked for me as per the doc. | 00:21 | |
Perhaps they do something different in NQP? | 00:22 | ||
timotimo | yes, it's different in nqp, as it doesn't have "flat" | ||
raiph | Ah, well, a mention of `flat` would be confusing then I guess. :) | 00:23 | |
00:24
daxim left
00:28
[particle] left,
mcsnolte left
|
|||
raiph | tbrowder: So I guess what jnthn meant on slide 21 is *implicit* flattening | 00:30 | |
Xliff | ooh! Compiling with debug is USEFUL! | 00:31 | |
Well, now I know what is causing the SEGV, the problem is due to a bad attribute in a tree-like data structure. :( | 00:34 | ||
00:35
torbjorn_ left
00:36
torbjorn joined
00:40
[particle] joined
|
|||
ZoffixLappy | huggable, higher level async constructs :is: See this talk: is.gd/Perl6JW | 00:47 | |
huggable | ZoffixLappy, Added higher level async constructs as See this talk: is.gd/Perl6JW | ||
00:48
bjz joined
00:50
cpage_ left
00:51
cpage_ joined
00:57
dvinciguerra_ left
|
|||
ZoffixLappy | You can't buy video or slides from Damian 'cause it's his income basically :) | 01:02 | |
01:03
ZoffixLappy left,
Actualeyes joined
01:04
[particle] left,
Sgeo_ left
01:06
Sgeo joined
01:08
[particle] joined
01:12
sufrostico left
01:13
cdg left
01:14
cdg joined
01:17
[particle] left
01:18
kalkin-_ joined,
kalkin- left
01:20
jellisii joined,
cdg left
01:21
daxim joined
01:22
jellisii left
01:25
[particle] joined
|
|||
tbrowder | ref flat: Damian described the '|' as approximately an insertion operator which acts to flatten an array... | 01:30 | |
01:32
addison left
01:34
[particle] left
01:38
[particle] joined
|
|||
gfldex | m: my @a = 1,2,3,4,5; @a[2] = |<a b>; dd @a; my @b = @a.clone; dd @b; | 01:44 | |
camelia | rakudo-moar 5a4963: OUTPUT«Array @a = [1, 2, slip("a", "b"), 4, 5]Array @b = [1, 2, slip("a", "b"), 4, 5]» | ||
01:44
ilbot3 left
|
|||
gfldex | a slip is a List that is treated differently by a List iterator. If a List iterator encounters a Slip, it will decent into the Slip and return all it's values. It will then continue with the rest of the elements of the outer List. | 01:45 | |
01:47
ilbot3 joined
01:50
bjz_ joined
01:52
bjz left,
kid511 left
01:57
molaf left
02:09
molaf joined
02:10
Sgeo_ joined
02:12
Sgeo left,
noganex joined
02:13
Sgeo joined
02:15
Sgeo_ left,
[particle] left,
noganex_ left
02:17
Sgeo_ joined
02:18
Sgeo left
02:19
autarch joined
02:21
ssotka left
|
|||
Zoffix | jnthn, so Damian praised your work a lot during the talk today :) Got any learning materials to recommend? I'm currently half-through github.com/edumentab/rakudo-and-nq...ls-course/ what else would make me better able to hack on rakudo? | 02:25 | |
02:25
Guest42010 left
02:26
woodruffw joined,
woodruffw left,
woodruffw joined
02:32
rgrinberg joined
|
|||
Zoffix | We need to get more people from the West coast in here.... (so quiet in the evenings :P) | 02:40 | |
02:40
ShimmerFairy joined
|
|||
dalek | c: d38d74b | (Zoffix Znet)++ | html/.htaccess: Force a single subdomain for all server aliases. Closes #285 |
02:41 | |
02:42
[particle] joined
|
|||
Xliff | Zoffix: I yam every-coast | 02:42 | |
<- Night owl | 02:43 | ||
dalek | c: 7e455dc | (Zoffix Znet)++ | / (6 files): Normalize docs subdomain used in links |
02:46 | |
Xliff | \o/ # Fixed SEGV | 02:48 | |
dalek | c: 81da19c | (Zoffix Znet)++ | CONTRIBUTING.md: Make convenience links |
02:49 | |
c: 937d36e | (Zoffix Znet)++ | STYLEGUIDE.md: Add styleguide for absolute links to the docs site |
02:51 | ||
Zoffix | Xliff++ | ||
dalek | c: f216efe | (Zoffix Znet)++ | STYLEGUIDE.md: Fix typo |
02:52 | |
Xliff | Fixed test!! \(^O^)/ | 03:02 | |
Was worried, thar! | 03:03 | ||
Zoffix | Oh, another good item from the talk: Damian said this time next year there may be a Perl 6 book out :) | 03:14 | |
Xliff | Nice! | 03:15 | |
Aaannd..... I am out of the woods. | |||
Until I yam foolish and dive in again. | |||
(which will be soon.... yes....) | 03:16 | ||
Zoffix | Pic from Damian's talk. That link supposed to be a good material on concurrency by jnthn++ www.meetup.com/Toronto-Perl-Mongers...451584175/ | 03:22 | |
jdv79 | damian went that far north? why? | 03:23 | |
Zoffix | He loves us :) | ||
jdv79 | it just commonwealth love. its not real. | ||
Zoffix | :) | ||
03:24
Khisanth left
03:25
yanmc joined,
yanmc left,
yanmc joined
03:35
tadzik left
03:39
Khisanth joined,
huggable left
03:40
huggable joined
03:41
raiph left
|
|||
Xliff is now playing: A Tribe Called Quest - Scenario | 03:41 | ||
Here we go YO! Here we go YO! | 03:42 | ||
Xliff dances | |||
\m/...(>.<)…\m/ | 03:43 | ||
03:53
bjz_ left
|
|||
Xliff | m: sub f { fail "Blargh" }; try f; say $! if $! | 03:53 | |
camelia | rakudo-moar 5a4963: OUTPUT«Blargh in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
Xliff | m: sub f { die "Blargh" }; try f; say $! if $! | 03:54 | |
camelia | rakudo-moar 5a4963: OUTPUT«Blargh in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
Xliff | Now just need to figure out why xmlXPathCompile doesn't throw exceptions on bad expressions..... :p | 03:58 | |
04:05
tadzik joined
04:21
M-matthew joined,
M-Illandan joined
04:25
khw left
|
|||
Xliff is now playing: Incubus - Make Out Party | 04:30 | ||
04:32
bjz joined
04:40
molaf left,
ssotka joined
04:45
rgrinberg left
05:01
Cabanossi left
05:02
Cabanossi joined
05:13
[particle] left
05:34
bjz left
05:40
skids left
05:45
sortiz joined
05:49
mr-foobar left
05:50
mr-foobar joined,
cpage_ left
05:51
cosimo joined
06:06
jack_rabbit joined
06:08
CIAvash joined
06:15
jjido joined
06:17
araujo joined
06:19
jjido left,
[particle] joined
|
|||
Xliff | .tell FROGGS 08findnodes.t finished and all tests passing! Expect a PR, soon. | 06:22 | |
yoleaux | Xliff: I'll pass your message to FROGGS. | ||
06:22
jjido joined
06:24
domidumont joined
06:25
[particle] left
06:28
domidumont left
06:29
domidumont joined
|
|||
sortiz | \o #perl6 | 06:29 | |
06:30
firstdayonthejob joined
06:33
domidumont1 joined
06:37
domidumont left
06:42
firstdayonthejob left
06:45
_mg_ joined
07:03
ssotka left,
jjido left
07:04
_mg_ left
07:08
domidumont1 left
07:11
abraxxa joined
07:12
zakharyas joined
07:18
telex left,
domidumont joined
07:20
Woodi joined
07:21
telex joined
07:35
[particle] joined
07:37
sftp left
07:39
huggable left,
[particle] left
07:40
huggable joined
07:42
dogbert17 left
07:44
kerframil left
07:47
grassass left
07:50
RabidGravy joined
07:54
grondilu joined
|
|||
grondilu | junctions on sets are not quite what would be expected IMHO: | 07:54 | |
m: say set(<foo bar>).any | |||
camelia | rakudo-moar 5a4963: OUTPUT«any(foo => True, bar => True)» | ||
grondilu | we need to use .keys to do something meaningful | ||
m: say set(<foo bar>).keys.any | |||
camelia | rakudo-moar 5a4963: OUTPUT«any(foo, bar)» | ||
grondilu | it's a bit LTA, isn't it? | 07:55 | |
07:55
g4 joined
08:00
dakkar joined,
grassass joined
08:03
araujo_ joined
08:04
sftp joined
08:05
araujo left,
araujo_ left,
araujo_ joined
08:12
sftp left
08:16
pmurias joined
08:19
labster joined
08:20
_mg_ joined
08:24
darutoko joined
08:26
bjz joined
08:32
[particle] joined
|
|||
llfourn | grondilu: yeah that seems wrong to me | 08:32 | |
Roamer` | hm, well, to be fair, the documentation does hint at the fact that sets are more like hashes than lists - it mentions "keys" in the very first example and then says that they may be treated as hashes | 08:36 | |
but, yes, it did throw me for a loop, too, yesterday :) | |||
08:37
[particle] left
08:42
jkramer left
|
|||
abraxxa | why are there no 2016.05 and 2016.06 release announcements? | 08:42 | |
sortiz | 'cus only R* releases are public? | 08:44 | |
08:47
jkramer joined
|
|||
jkramer | Ahoy again. In method prototypes to prevent the user from calling a method with unknown parameters? Ie I have a "method foo() {...}" but calling $foo.foo(:meh(123)) doesn't throw an error | 08:50 | |
08:51
araujo_ left
08:55
sftp joined
08:57
[particle] joined
|
|||
sortiz | jkramer, In Perl6 all methods have in their signature an implicit *%_ for "Interface consistency" | 09:00 | |
So any named argument not explicitly declared ends in %_ | 09:01 | ||
09:03
tlvb| joined
|
|||
sortiz | (Unless the method declares an explicit *%foo) | 09:05 | |
09:09
mls_ joined
|
|||
jkramer | sortiz: Alright, thanks :) | 09:10 | |
09:16
mls_ is now known as mls
09:17
[particle] left
|
|||
gregf_ | m: sub foo(){ ... }; 10.map({ foo(a => $_) }) # throws an exception? | 09:18 | |
camelia | rakudo-moar 5a4963: OUTPUT«Unexpected named parameter 'a' passed in sub foo at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
gregf_ | oh and a map on an int o_O | ||
09:20
Actualeyes left
|
|||
sortiz | gregf_, What I said applies to methods, not to subroutines. | 09:22 | |
m: class Foo { method foo() {} }; say Foo.^methods[0].signature.perl; | |||
camelia | rakudo-moar 5a4963: OUTPUT«:(Foo $: *%_)» | ||
sortiz | m: sub foo() {}; say &foo.signature.perl; | ||
camelia | rakudo-moar 5a4963: OUTPUT«:()» | ||
09:22
Actualeyes joined
|
|||
gregf_ | ah - ok; sortiz++ | 09:24 | |
09:27
bjz left
09:28
TEttinger left
09:33
[particle] joined
09:38
labster left
09:47
[particle] left
09:58
fhorck_ left,
sortiz left
|
|||
jkramer | Is there a nice idiomatic way for finding differences between arrays? | 09:59 | |
I need to find the elements of @a that are not in @b and vice versa. Anything neater than grepping? | |||
gfldex | jkramer: see docs.perl6.org/language/setbagmix | 10:00 | |
timotimo | yeah, constructing sets | ||
jkramer | Perfect, thanks! | ||
gfldex | m: my @a = 1,2,3; my @b = 1,2,3; say so @a >>==<< @b; | 10:01 | |
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
timotimo | m: my @a = 1, 2, 3, 5; my @b = 1, 2, 3, 4; say @a Zcmp @b | 10:02 | |
camelia | rakudo-moar 5a4963: OUTPUT«(Same Same Same More)» | ||
gfldex | jkramer: depending on your problem hyper operators may be helpful too | ||
10:02
nowan joined
|
|||
timotimo | oh, with Z, it'll stop at the shorter list | 10:02 | |
whereas >>==<< will throw an exception if the lists aren't equal length | |||
stop at == ignore any differences after ... | 10:03 | ||
gregf_ | well jkramer wants the intersection i guess | 10:04 | |
timotimo | right | ||
gregf_ | so <1 3 4> intersect <1 2> would return 1 | ||
timotimo | well, that or the symmetric difference | ||
that'd be (&) | 10:05 | ||
gregf_ | m: <1 3 4> & <1 2> | ||
camelia | rakudo-moar 5a4963: OUTPUT«WARNINGS for <tmp>:Useless use of "&" in expression "<1 3 4> & <1 2>" in sink context (line 1)» | ||
timotimo | that's not (&), that's & | ||
m: say <1 3 4> (&) <1 2> | |||
camelia | rakudo-moar 5a4963: OUTPUT«set(1)» | ||
gregf_ | timotimo++ | ||
10:06
pmurias left
|
|||
gregf_ | m: <foo bar test baz>.grep({ <foo quux test hello>.grep(/$_/) }) # ugly and 2 loops :| | 10:06 | |
camelia | ( no output ) | ||
gregf_ | *missed a print* | 10:07 | |
10:09
[particle] joined,
rindolf joined
10:11
araujo joined
10:12
araujo left,
araujo joined,
araujo left,
araujo joined
|
|||
jkramer | Hmm, @x (-) @y seems to work, but also seems to return a hash. Am I missing something? | 10:13 | |
10:13
[particle] left
|
|||
jkramer | m: for <foo bar baz> (-) <foo bar qux> { say $_ } | 10:13 | |
camelia | rakudo-moar 5a4963: OUTPUT«baz => True» | ||
timotimo | it's not a hash, but iterating over a set behaves just like iterating over a hash | ||
it's associative, after all, not positional | |||
gfldex | m: dd <foo bar baz> (-) <foo bar qux>; | 10:14 | |
camelia | rakudo-moar 5a4963: OUTPUT«set("baz")» | ||
timotimo | you can of course iterate over its .keys | ||
gregf_ | m:say ( <foo bar baz> (-) <foo bar qux> ).^name | ||
m: say ( <foo bar baz> (-) <foo bar qux> ).^name | |||
camelia | rakudo-moar 5a4963: OUTPUT«Set» | ||
jkramer | Ah, alright, didn't know that about sets. Yep, .keys it is then. Thanks | ||
10:14
araujo left
10:15
araujo joined,
araujo left,
araujo joined,
araujo left,
[particle] joined
10:18
pmurias joined
10:21
kaare_ joined
10:23
Actualeyes left
10:25
Actualeyes joined
|
|||
pmurias | jnthn: I didn't have any significant problems implementing nqp::handlelexpayload etc. on the js backend | 10:35 | |
jnthn | pmurias: Cool \o/ | 10:36 | |
10:42
bjz joined
10:49
Actualeyes left
10:51
Actualeyes joined
|
|||
jnthn | Zoffix: Phew, glad Damian likes the concurrency stuff. :) Well, doing some of the exercises on that course would help a bit also, but there's not much for it beyond that than digging in to something and asking questions. :) | 10:53 | |
10:56
[particle] left
|
|||
Zoffix | cool | 11:00 | |
11:02
[particle] joined
11:08
yqt joined
11:10
_mg_ left
11:14
kid51 joined
11:16
[particle] left
11:22
[particle] joined
11:26
[particle] left
11:27
_mg_ joined
11:29
brrt joined
11:32
dvinciguerra_ joined,
brrt left
11:33
cognominal joined,
iH2O joined
11:34
[particle] joined,
rindolf left
11:39
huggable left
11:40
huggable joined
11:43
[particle] left
|
|||
jkramer | How can I turn an even-numbered Seq into a Hash without assigning it to a %hash variable? | 11:45 | |
11:45
kid51 left,
brrt joined
|
|||
jkramer | Ah, pairup maybe | 11:45 | |
Hmm no | 11:46 | ||
gregf_ | prolly calling .Hash? | 11:47 | |
11:47
kid51 joined
|
|||
gregf_ | m: say set(<foo bar baz>).Hash #? | 11:47 | |
camelia | rakudo-moar 5a4963: OUTPUT«{bar => True, baz => True, foo => True}» | ||
11:48
kid51 left,
zakharyas left
|
|||
jkramer | Ha, yeah maybe. That'd be too obvious though | 11:48 | |
timotimo | iirc pairup takes two elements at a time and returns a pair of the two | 11:49 | |
jkramer | Works \o/ | ||
gregf_ | m: say set(<foo bar baz>).keys.map( { $_ => 1 }).^name #or else | ||
camelia | rakudo-moar 5a4963: OUTPUT«Seq» | ||
gregf_ | m: say set(<foo bar baz>).keys.map( { $_ => 1 }) #or else | ||
camelia | rakudo-moar 5a4963: OUTPUT«(foo => 1 baz => 1 bar => 1)» | ||
11:50
zakharyas joined
|
|||
timotimo | um, he's asking for a Seq, not a Set :) | 11:50 | |
gregf_ | ah - my bad. *seeing double since morning - blames Java* | ||
11:53
brrt left
11:55
_mg_ left
|
|||
jkramer | When I have a method that expects some Routine as argument, can I define what the Routine's prototype should look like? Ie. take a Str and return and Int or whatever? | 11:55 | |
Signature is probably the better word | 11:56 | ||
Roamer` | hmm, that's actually a good question, I'd like to know, too :) | 11:57 | |
I guess one could check the signature of the parameter passed | 11:58 | ||
but that would be after the fact | |||
12:00
domidumont left
12:02
brrt joined,
[particle] joined
|
|||
BrokenRobot | jkramer: yes, just like you'd have a normal sub: sub (Str) {...} or you can do pointy blocks: -> Str { ... } | 12:03 | |
And yes, those are called Signatures | |||
12:04
dakkar left
12:05
Actualeyes left
|
|||
timotimo | important difference: the default type for a pointy block is Mu rather than Any | 12:06 | |
jkramer | Nice, thanks | ||
12:06
brrt left
12:07
Actualeyes joined
|
|||
BrokenRobot | m: -> $x {}(Mu) | 12:07 | |
camelia | ( no output ) | ||
BrokenRobot | timotimo++ TIL | ||
jkramer | BrokenRobot: Hmm, not sure if that's what I meant. I'd like to define the type of the sub in the signature of the method that expects the sub. Ie. method foo(sub (Str) $my-sub returns Int) or something like that | 12:08 | |
psch | m: sub f(&g:(Int $, Str $)) { say &g.signature }; f -> Int $, Str $ { }; try f -> Str $, Int $ { }; say $! if $! | 12:10 | |
camelia | rakudo-moar 5a4963: OUTPUT«(Int, Str)Constraint type check failed for parameter '&g' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
BrokenRobot | jkramer: ^ that's how :) psch++ | ||
jkramer | Awesome, thanks :) | ||
He, could've thought of the & sigil myself actually | |||
12:11
iH2O left
12:13
dakkar joined
12:15
mcsnolte joined
|
|||
llfourn | m: class A { has @.a; }; my @a = 1..3; my %args = %( :@a ); A.new(|%args).a.perl.say' # how to DWIM here? | 12:16 | |
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3rgs = %( :@a ); A.new(|%args).a.perl.say7⏏5' # how to DWIM here? expecting any of: infix infix stopper statement end …» | ||
llfourn | m: class A { has @.a; }; my @a = 1..3; my %args = %( :@a ); A.new(|%args).a.perl.say # how to DWIM here? | ||
camelia | rakudo-moar 5a4963: OUTPUT«[[1, 2, 3],]» | ||
llfourn | (I don't want an array of arrays) | ||
BrokenRobot | m: class A { has $.a; }; my @a = 1..3; my %args = :@a; A.new(|%args).a.perl.say; | 12:18 | |
camelia | rakudo-moar 5a4963: OUTPUT«[1, 2, 3]» | ||
llfourn | hmmm why does that work? | 12:19 | |
psch | m: class A { has @.a; }; my @a = 1..3; my %args = %( :a(|@a) ); A.new(|%args).a.eager.perl.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«[slip(1, 2, 3),]» | ||
psch | ...well, minus the eager | ||
i think that's somewhat insightful at least. the array Attribute container doesn't get flattened into | 12:20 | ||
s/slipped/flattened/ | |||
llfourn | m: my @arg = 1..3; my %a = :@arg; my %b = %( :@arg ); say %a.perl,%b.perl; | ||
camelia | rakudo-moar 5a4963: OUTPUT«{:arg($[1, 2, 3])}{:arg($[1, 2, 3])}» | ||
BrokenRobot | llfourn: you ask for singular, so the singular (Array) gets assigned to it. If you use @ sigil, you ask for itemS, so the Array becomes a single item in it... | 12:21 | |
jkramer | psch: Where can I find out more about this &f:(...) syntax? Google fails me :( | ||
BrokenRobot | That's my interpretation of it, at least. | ||
llfourn | (they look the same if im not mistaken) | ||
psch | jkramer: docs.perl6.org/syntax/Constraining...0Callables | ||
jkramer | Thanks! | ||
psch | jkramer: there really isn't more too it though. you just attach a signature to a Callable-sigiled Parameter and the arguments' Signature has to match it vOv | 12:22 | |
(where "attach" means "write next to the Parameter in the Signature" i suppose :) ) | |||
llfourn | BrokenRobot: also I did use the @ sigil? | ||
BrokenRobot | llfourn: yes, and I didn't. | 12:23 | |
I'm not sure what you're asking :/ | |||
jkramer | psch: Ah yes, I was hoping I could also define the return type, but the documentation suggests I can only constrain the parameter signature | ||
llfourn | BrokenRobot: yes you did? | ||
psch | jkramer: well, return type can be specified in a Signature as normal :) | ||
m: sub f(--> Int) { "foo" }; f() | |||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed for return value; expected Int but got Str ("foo") in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
llfourn | my %args = :@a; | ||
psch | llfourn: BrokenRobot is talking about the Attribute | ||
jkramer | "as normal" - I've never seen this before :D | ||
BrokenRobot | Yes | ||
m: sub foo (*%x) { dd %x }; my @arg = 1..3; my %a = :@arg; foo |%a | 12:24 | ||
camelia | rakudo-moar 5a4963: OUTPUT«{:arg($[1, 2, 3])}» | ||
llfourn | psch: ah I didn't catch that thanks | ||
jkramer | --> works, thanks a bunch :) Is this also documented somewhere? It seems like I'm always googling the wrong terms for this kind of stuff | 12:25 | |
BrokenRobot | I was gonna try to explain why the $ works and @ doesn't, but I'm not deciphering this super nested NQP call chain ^_^ github.com/rakudo/rakudo/blob/nom/...Mu.pm#L126 | ||
12:26
_mg_ joined
|
|||
BrokenRobot | (it gave us like a 4x speed boost though) | 12:26 | |
llfourn | m: class A { has @.a; }; my @a = 1..3; my %args = %( :@a ); my \cap-args = \( :@a ); A.new(|%args).a.perl.say; A.new(:@a).a.perl.say; A.new(|cap-args).a.perl.say; # expected these to be the same :S | 12:27 | |
camelia | rakudo-moar 5a4963: OUTPUT«[[1, 2, 3],][1, 2, 3][1, 2, 3]» | ||
12:27
[particle] left
|
|||
llfourn | so basically passing stuff to a hash itemizes stuff | 12:27 | |
BrokenRobot | Ah | ||
llfourn | even if you |slip flatten it, it doesn't come out the same | ||
timotimo | --> ought to be documented with the rest of signatures | 12:28 | |
cognominal | hi, why the REPL is started in strict mode ? | ||
how would I impose no strict from the command line | 12:29 | ||
BrokenRobot | What's a strict mode? :/ | ||
gregf_ | m: foo(Int $x, --> Int, Str $y){ 100; }; foo(1,"bar") | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in argument list; couldn't find final ')' at <tmp>:1------> 3foo(Int7⏏5 $x, --> Int, Str $y){ 100; }; foo(1,"ba expecting any of: infix infix …» | ||
12:29
Amnez777 left
|
|||
psch | BrokenRobot: normal mode, without 'no strict' :) | 12:29 | |
BrokenRobot | What's no strict? | 12:30 | |
psch | m: no strict; $x = 5; say $x | ||
camelia | rakudo-moar 5a4963: OUTPUT«5» | ||
BrokenRobot | .oO( why do we even have this.... ) |
||
psch | i don't recall if there's more restrictions we lift under 'no strict' | ||
12:30
Actualeyes left
|
|||
psch | hysterical raisins! | 12:30 | |
BrokenRobot | :) | ||
cognominal | yea, but no strict is lexical. That does not carry from one line of the REPL to the other | ||
BrokenRobot | cognominal: out of curiosity, why not just use the normal mode? | 12:32 | |
It's like asking for trouble: training yourself in writing deliberately broken code. | |||
12:32
[particle] joined
12:33
FROGGS joined
|
|||
perlpilot | Perl has always been happy to let users ask for rtouble | 12:33 | |
cognominal | this is just a convenience. When writing short code, declaring everything is a nuisance. | 12:34 | |
historically, Perl was used for very short programs and not having to declare variable was considered a feature | |||
psch | i guess you'd have to set $*STRICT to something falsey before initializing the hll compiler | 12:35 | |
cognominal | this changed overt time when Perl programs got bigger | ||
psch | we don't have an easy way to do that right now i think | ||
shouldn't be too hard to write a cl switch for though | |||
llfourn | m: my @a = 1..3; my \cap = \( :@a ); say (|cap) # so captures are empty when | outside of routine call? | ||
camelia | rakudo-moar 5a4963: OUTPUT«()» | ||
cognominal | there is not such this as right or wrong per se . There is context where things are right or wrong. | ||
BrokenRobot | llfourn: say is a routine call | 12:36 | |
llfourn | BrokenRobot: it's in ( ) so it's not part of it | ||
cognominal | psch: I tried to start with perl6 -m strict to no avail | ||
BrokenRobot | llfourn: ah, right | ||
m: my @a = 1..3; my \cap = \( :@a ); dd (|cap) | |||
camelia | rakudo-moar 5a4963: OUTPUT«slip()» | ||
cognominal | perl6 -M strict works fine though | ||
psch | cognominal: yes, as i said, we don't have anything that does it right now | ||
BrokenRobot | weird | ||
m: my @a = 1..3; my \cap = \( :@a ); dd cap | 12:37 | ||
camelia | rakudo-moar 5a4963: OUTPUT«\(:a([1, 2, 3]))» | ||
psch | | is prefix for .Slip, which is .list.Slip in Any | ||
m: my @a = 1..3; my \cap = \( @a, :@a ); dd (cap.Slip) | 12:38 | ||
camelia | rakudo-moar 5a4963: OUTPUT«slip([1, 2, 3],)» | ||
psch | not quite sure why that loses the named there, but that's all it loses | ||
llfourn | psch: ah that makes sense I guess, but yeah it I think the pairs should be there | ||
12:38
FROGGS left
|
|||
psch | m: say \(a => [1,2,3]).list | 12:39 | |
camelia | rakudo-moar 5a4963: OUTPUT«()» | ||
llfourn | m: my @a = 1..3; my \cap = \( :@a ); my $h = %( :@a ); cap.perl.say; %h.perl.say # the $ shows the difference between the two | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '%h' is not declared. Did you mean '$h'?at <tmp>:1------> 3 :@a ); my $h = %( :@a ); cap.perl.say; 7⏏5%h.perl.say # the $ shows the difference» | ||
psch | llfourn: actually, well, Capture.list gives you only the positionals | ||
llfourn | m: my @a = 1..3; my \cap = \( :@a ); my %h = %( :@a ); cap.perl.say; %h.perl.say # oops | ||
camelia | rakudo-moar 5a4963: OUTPUT«\(:a([1, 2, 3])){:a($[1, 2, 3])}» | ||
llfourn | psch: yeah but I think | should not do .list in this case. | 12:40 | |
because it doesn't do that in routine calls | |||
12:40
[particle] left
|
|||
psch | llfourn: but | in routine calls doesn't apply to Captures | 12:40 | |
llfourn | yes but I think they should try to do the same thing | 12:41 | |
psch | llfourn: i mean, yeah, i can see how slipping a Capture is weird, but i don't agree with the reason | ||
CIAvash | m: class A { has @.a; }; my @a = [1,2,3]; my %args; %args<a> := @a; A.new(|%args).a.perl.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«[1, 2, 3]» | ||
llfourn | fair enough | ||
CIAvash: interesting, so you can still get the array container inside the hash :) | 12:42 | ||
psch | m: class A { has @.a; submethod BUILD(:@a) { @!a = @a } }; my %args = a => [1,2,3]; dd A.new(|%args) | 12:43 | |
camelia | rakudo-moar 5a4963: OUTPUT«A.new(a => [1, 2, 3])» | ||
psch | or BUILD around it to not force weird stuff on your users :) | ||
12:44
rgrinberg joined
|
|||
CIAvash | I remember that being mentioned when I asked about a similar thing before. | 12:44 | |
llfourn | hmm now can you make the default container for a hash an array container...or does that even make sense? | 12:45 | |
psch | m: my %h of Array; say %h<foo>.VAR | ||
camelia | rakudo-moar 5a4963: OUTPUT«Array» | ||
12:45
[particle] joined
|
|||
psch | m: my %h; say %h<foo>.VAR | 12:46 | |
camelia | rakudo-moar 5a4963: OUTPUT«Any» | ||
llfourn | m: my %h of Array; my @a = 1..3; %h = :@a; say %h.perl | ||
camelia | rakudo-moar 5a4963: OUTPUT«(my Array % = :a($[1, 2, 3]))» | ||
llfourn | but still the $ there | ||
psch | well, yes, because it's an item | 12:47 | |
llfourn | I suppose my question is can you make non-itemized hash values | 12:48 | |
psch | i think that's conceptually impossible | ||
a Pair is always 1:1 | |||
llfourn | but I don't really think I fully grasp wha...yeah :) | ||
12:49
Actualeyes joined
|
|||
llfourn | m: my @a = 1..3; \( :@a ).perl.say; # but when you put them in captures they don't have the $ | 12:49 | |
camelia | rakudo-moar 5a4963: OUTPUT«\(:a([1, 2, 3]))» | ||
12:50
[particle] left
|
|||
llfourn | (and behave differently when flattened) | 12:50 | |
psch | m: my @a = 1..3; say \( :@a ).hash<a>.VAR | ||
camelia | rakudo-moar 5a4963: OUTPUT«[1 2 3]» | ||
psch | there's no container | ||
llfourn | ah | ||
right so can you make a hash where the values are not put into containers? | 12:51 | ||
(I mean without constructing each key with := ) | |||
moritz | it's called a Map | 12:52 | |
a hash is defined by having containerized elements, just like arrays | 12:53 | ||
to allow assignment | |||
llfourn | moritz: that's handy | ||
llfourn goes back to the original example | 12:54 | ||
m: class A { has @.a; }; my @a = 1..3; my %h := Map.new( (:@a) ); A.new(|%h).a.perl.say # yay! | 12:55 | ||
camelia | rakudo-moar 5a4963: OUTPUT«[1, 2, 3]» | ||
12:55
mcmillhj joined
|
|||
moritz | m: say chars [*] 1..100 | 12:55 | |
camelia | rakudo-moar 5a4963: OUTPUT«158» | ||
12:56
Actualeyes left
12:57
Actualeyes joined
13:04
[particle] joined
|
|||
llfourn | is there a junction friendly way of doing .WHAT so ("a"|"b").WHAT yields any(Str,Str)? | 13:05 | |
psch | "if you care about the values of a Junction you should be using a Set" i think the saying goes | 13:06 | |
13:06
Actualeyes left
|
|||
llfourn | psch: I don't care about the values in the junction | 13:06 | |
moritz | m: sub what($x) { $x.WHAT }; say what('a'|'b') | ||
camelia | rakudo-moar 5a4963: OUTPUT«any((Str), (Str))» | ||
llfourn | moritz: why does that work? | 13:07 | |
moritz | llfourn: because the default type of paramaters is Any, so calling what autothreads over the junction | 13:08 | |
llfourn | ahhh | ||
thanks :) | |||
13:10
tlvb left,
sufrostico joined
13:11
lizmat joined
13:13
zakharyas left
13:14
tlvb joined
13:15
zakharyas joined
|
|||
timotimo | also, .WHAT isn't a method invocation, but basically an nqp:: op called on the value | 13:15 | |
BrokenRobot | m: (*.WHAT.say)("a"|"b") | 13:19 | |
camelia | rakudo-moar 5a4963: OUTPUT«(Whatever)No such method 'CALL-ME' for invocant of type 'Bool' in block <unit> at <tmp> line 1» | ||
BrokenRobot | :/ how come? | ||
m: (*.uc.say)("a"|"b") | |||
camelia | rakudo-moar 5a4963: OUTPUT«any(A, B)» | ||
BrokenRobot | Ah, what timo said.. basically :) | ||
cognominal | I was wrong about 'no strict' carrying over subsequent lines int the REPL. It does because it is lexical | ||
dalek | c: de23b7c | (Zoffix Znet)++ | / (6 files): Use SASS |
13:23 | |
13:24
Actualeyes joined
13:27
sufrostico left
13:29
dj_goku left
|
|||
dalek | c: 83f00cf | (Zoffix Znet)++ | / (2 files): Make old style sheet sassy |
13:30 | |
13:32
dj_goku joined
|
|||
dalek | c: 534d9b8 | (Zoffix Znet)++ | app.pl: Indicate when we are done processing sass |
13:34 | |
BrokenRobot | Coding Perl 5 after Perl 6 is a nightmare. | ||
masak | I actually find it's not so bad | 13:35 | |
maybe you need to up your Perl 5 :P | |||
13:35
rindolf joined
|
|||
moritz | the transition is hard | 13:35 | |
BrokenRobot | Well, the transitionary period is a nightmare. | ||
Yeah. | |||
moritz | and giving up on some niceties is grating | ||
I so miss :$foo for foo => $foo when I do Perl 5 | 13:36 | ||
and expresive signatures | |||
(i miss :$foo in python as well) | |||
perlpilot | greetings | 13:37 | |
BrokenRobot | \o | ||
perlpilot | masak: Do you use Moops or other syntactic niceties in Perl 5? | 13:38 | |
moritz | Moops? Moose? | 13:39 | |
13:39
g4 left
|
|||
BrokenRobot | metacpan.org/pod/Moops | 13:39 | |
masak | perlpilot: I do use Moose when I can. | 13:40 | |
perlpilot: I haven't gone as far as using Moops. | |||
oh, I *miss* things when coding in Perl 5 | |||
llfourn | moritz: what does :$foo in python look like? | ||
masak | but I wouldn't call coding in it a nightmare. | ||
llfourn: `foo=foo`, I guess | 13:41 | ||
BrokenRobot | Heh, fair enough. It's just miss-erable :) | ||
llfourn | ah right. | ||
moritz | in python, I miss named-only parameters | 13:42 | |
(though I hear they are coming) | |||
perlpilot | masak: yeah, it's more like death by a thousand cuts kinda thing. It's all those little annoyances that grate on your brain because it's not Perl 6. :) | ||
mst | moritz: Function::Parameters ? | ||
lizmat waves, Really | 13:43 | ||
mst | Moo + Type::Tiny is sufficient for me for the moment | ||
perlpilot | lizmat: o/ | ||
mst | but my current code is going to fatpack back til 5.8 | ||
I'll be breaking out the shiny later | |||
13:44
Sgeo_ left
13:45
Amnez777 joined
13:46
[particle] left
|
|||
moritz | 5.8? teh horror | 13:46 | |
no // | |||
BrokenRobot shudders | 13:47 | ||
hoelzro | morning #perl6 | ||
BrokenRobot | morning | ||
13:47
[particle] joined
|
|||
perlpilot | morning hoelzro | 13:47 | |
hoelzro | o/ BrokenRobot, perlpilot | ||
I have a quick question about live vs on-demand supplies, I want to make sure I understand them properly | 13:48 | ||
gregf_ | those named args have been made available in ruby > 2.2.* | ||
13:48
Actualeyes left
|
|||
hoelzro | for live supplies, they generate values, and for each value, they send it to whomever is listening, yes? so if I tap it after an event, that tapper will not receive that event, correct? | 13:48 | |
13:49
yqt left
|
|||
hoelzro | for on-demand supplies, it's the exact same, only with the change that the very *first* tapper receives all of the events that have been emitted thus far, right? | 13:49 | |
perlpilot | hoelzro: I'm no expert, but that sounds correct to me. | ||
hoelzro | because the supply doesn't run until tapped, much like a unix FIFO? | ||
s/unix FIFO/process attached to a unix FIFO/ | 13:50 | ||
lizmat | hoelzro: too jetlagged at the moment to give a good answer to that | ||
hoelzro | =) | ||
13:51
Actualeyes joined
|
|||
gregf_ | s/2.2/2.1/ | 13:51 | |
jnthn | hoelzro: A live supply is like a TV broadcast. If you weren't watching stuff, it's gone and you missed it. It's a stateless stream of stuff. | 13:53 | |
BrokenRobot | hoelzro: I thought on-demand supplies all tappers get all values | ||
m: my $s = supply { emit $_ for ^5 }; $s.tap: *.say; $s.tap: *.say | 13:54 | ||
camelia | rakudo-moar 5a4963: OUTPUT«0123401234» | ||
BrokenRobot | m: my $s = supply { emit $_ for ^5 }; $s.tap: *.say; $s.tap: *.say; $s.tap: *.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«012340123401234» | ||
jnthn | hoelzro: An on-demand supply is like watching a video on Netflix or so. When you start watching it, you start getting frames. If somebody else starts watching it, they get their own stream of the frames. etc. | ||
And if you stop watching, that doesn't impact anyone else. | 13:55 | ||
hoelzro | jnthn: so as BrokenRobot suggests, once you tap an on-demand supply, you get the entire history? | ||
jnthn | No. | ||
You *start a new history*. | |||
Though there is no history in supplies really | |||
13:55
rindolf left
|
|||
hoelzro | oh, I figured as much | 13:55 | |
jnthn | There *is* a type of Supplier that buffers. | ||
13:56
[particle] left
|
|||
BrokenRobot | m: my $s = supply { for ^5 { say "generating $_; emit $_ } }; $s.tap: *.say; $s.tap: *.say; $s.tap: *.say | 13:56 | |
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in double quotes; couldn't find final '"' at <tmp>:1------> 3tap: *.say; $s.tap: *.say; $s.tap: *.say7⏏5<EOL> expecting any of: method arguments» | ||
BrokenRobot | m: my $s = supply { for ^5 { say "generating $_"; emit $_ } }; $s.tap: *.say; $s.tap: *.say; $s.tap: *.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«generating 00generating 11generating 22generating 33generating 44generating 00generating 11generating 22generating 33generating 44generating 00generating 11generating 22generatin…» | ||
BrokenRobot gets it now o/ | |||
jnthn++ | |||
jnthn | m: sub s() { supply { say 'here'; emit rand; } }; s.tap(*.say); s.tap(*.say) | ||
camelia | rakudo-moar 5a4963: OUTPUT«here0.533383130413306here0.177299685829522» | ||
BrokenRobot | :o | ||
jnthn | A supply block is run per tapping of an on-demand supply. | 13:57 | |
As illustrated above :) | |||
hoelzro | but those are two separate supplies, yes? | ||
jnthn | ah, maybe more clear then is: | ||
m: sub s() { supply { say 'here'; emit rand; } }; my $s = s(); $s.tap(*.say); $s.tap(*.say) | |||
camelia | rakudo-moar 5a4963: OUTPUT«here0.076437799520763here0.164639854251952» | ||
jnthn | It's each tapping that starts a new flow of values | ||
(With an on-demand supply) | 13:58 | ||
So you can think of a supply block as running per tapping, just as Netflix starts streaming a movie per person who starts watching it. | |||
perlpilot | I don't know what's in the docs right now, but that TV/netflix analogy sounds like it might be a good addition | ||
hoelzro | oooh I see | ||
BrokenRobot | +1 really good analogy | 13:59 | |
hoelzro | so supply { ... } is on-demand, and Supplier.new is live, yes? | ||
jnthn | Yes | ||
13:59
pmurias left
|
|||
jnthn | And note that things like Supply.interval is on-demand too; you're starting a distinct timer. | 14:00 | |
14:01
[particle] joined
|
|||
jnthn | (On each .tap) | 14:02 | |
14:03
girafe joined
|
|||
dalek | c: becddba | (Zoffix Znet)++ | doc/Language/concurrency.pod: Include TV broadcast/Netflix analogy for supplies jnthn++ |
14:03 | |
hoelzro | so it's kind of like an async gather/take | ||
14:03
dvinciguerra_ left
|
|||
dalek | c: 5f65feb | (Zoffix Znet)++ | doc/Language/concurrency.pod: Improve Netflix portion of the analogy |
14:04 | |
BrokenRobot coins "on-demand supplies and chill" phrase :) | 14:05 | ||
tough crowd :P | |||
llfourn coughs | 14:06 | ||
mst | stop humping the VM, dude, just cos it keeps saying 'moar' doesn't mean it's capable of consent | ||
llfourn coughs twice | |||
BrokenRobot | :) | 14:07 | |
14:07
pmurias joined,
dvinciguerra_ joined
|
|||
perlpilot | llfourn: you're supposed to turn your head in there somewhere | 14:07 | |
llfourn turns head | 14:08 | ||
14:08
acrussell joined,
skids joined
14:10
tharkun left
14:11
tharkun joined
14:13
[particle] left
14:14
[particle] joined,
Actualeyes left
14:18
ptolemarch joined,
freezerburnV joined
14:19
tharkun left,
tharkun joined
14:20
Bodger1234 joined,
molaf joined
|
|||
jkramer | I just wrote a potentially useful thing in P6. Since it's the first thing I've written in P6 that's not a dumb example I'd appreciate feedback regarding optimization/design etc. gist.github.com/jkramer/98e9ac48cb...14da847344 | 14:21 | |
It's a beanstalk client lib, doesn't support all commands yet and doesn't catch all potential beanstalk errors, but seems to be working. | 14:23 | ||
14:25
freezerburnV left,
vytas left
|
|||
psch | m: say "265.0.0.1" ~~ /^ (\d ** 1..3)**4 %% '.' <?{ 0 <= all(@0) < 256 }> $ /; | 14:25 | |
camelia | rakudo-moar 5a4963: OUTPUT«Nil» | ||
psch | m: say "127.0.0.1" ~~ /^ (\d ** 1..3)**4 %% '.' <?{ 0 <= all(@0) < 256 }> $ /; | 14:26 | |
camelia | rakudo-moar 5a4963: OUTPUT«「127.0.0.1」 0 => 「127」 0 => 「0」 0 => 「0」 0 => 「1」» | ||
psch | jkramer: i'd probably use something like that as the type for $.host | ||
BrokenRobot | jkramer: you can write :port($.port)) as :$.port | 14:27 | |
jkramer | psch: It's not necessarily an IP address | ||
pmurias just added a -Ofun option to nqp-js | 14:28 | ||
psch | oh, right | ||
yeah, that makes sense | |||
14:29
[particle] left
|
|||
jkramer | BrokenRobot: Thanks, didn't know that | 14:29 | |
psch | m: my $x where .so; | ||
camelia | ( no output ) | ||
psch | m: my $x where .so; $x = "" | ||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected <anon> but got Str ("") in block <unit> at <tmp> line 1» | ||
BrokenRobot | huh | ||
m: my $x where .so; $x = "dasd" | 14:30 | ||
camelia | ( no output ) | ||
BrokenRobot | $_ is available in where even without curlies? | ||
jkramer: the rest looks good to me | |||
If only too many parentheses :) | 14:31 | ||
jkramer | .so is just like using a Scalar in boolean context in P5? | ||
BrokenRobot | jkramer: yeah, basically | ||
jkramer | What does it stand for? :D | 14:32 | |
BrokenRobot | "so" is a low-precedence version of the reverse of "not" | ||
It's not an acronym. It's a play on "is so" "is not" | |||
jkramer | Ah, ok | ||
BrokenRobot | And in this case, it's a method-call version of it. | 14:33 | |
jnthn | m: say so not True | ||
camelia | rakudo-moar 5a4963: OUTPUT«False» | ||
jnthn | :) | ||
14:33
harmil joined
|
|||
BrokenRobot | docs.perl6.org/routine/so#class_Mu | 14:33 | |
14:33
Actualeyes joined
|
|||
jkramer | Is it actually necessary though? I mean if I say 'if $some-string {...', isn't it implicit? | 14:34 | |
BrokenRobot | jkramer: it's implicit, yes | ||
m: my $x where $_; $x = "" | |||
camelia | ( no output ) | ||
BrokenRobot | m: my $x where $_; $x = "ds" | ||
camelia | ( no output ) | ||
BrokenRobot | m: my $x where { $_ }; $x = "ds" | ||
camelia | ( no output ) | ||
CIAvash | BrokenRobot: irclog.perlgeek.de/perl6/2016-06-25#i_12734545 :) | ||
BrokenRobot | m: my $x where { $_ }; $x = "" | ||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected <anon> but got Str ("") in block <unit> at <tmp> line 1» | ||
BrokenRobot | CIAvash: it doesn't seem to though ^ | 14:35 | |
Rather... it does it partially? | |||
m: my $x where $_ eq "ds"; $x = "ds" | 14:36 | ||
camelia | ( no output ) | ||
BrokenRobot | wtf | ||
m: my $x where $_ eq "ds"; $x = "dsdsds" | |||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected <anon> but got Str ("dsdsds") in block <unit> at <tmp> line 1» | ||
BrokenRobot | Well, then I've no idea why my $x where $_; $x = "" doesn't complain | ||
m: my $x where dd $_; $x = "dsdsds" | 14:38 | ||
camelia | rakudo-moar 5a4963: OUTPUT«Str <element> = "dsdsds"Type check failed in assignment to $x; expected <anon> but got Str ("dsdsds") in block <unit> at <tmp> line 1» | ||
CIAvash | hmm | ||
harmil | @arnsholt or others involved in snake, my github.com/harmil/sixstrictor project (pure-Perl Python 2) as mentioned on reddit is about 80% of the way through with the parser. Actions will be a whole other ball of wax. I wonder if I should use your runtime and retro-extend it for Python 2? | 14:39 | |
14:41
Actualeyes left,
[particle] joined
|
|||
pmurias | harmil: hi, unifying efforts would be great | 14:42 | |
14:42
Actualeyes joined
|
|||
pmurias | harmil: keep in mind that snake is far from complete yet | 14:42 | |
harmil | I assumed. It seems to have come along further than previous efforts, though. | ||
14:43
kyclark joined
|
|||
pmurias | harmil: why python 2 instead of 3? | 14:43 | |
14:43
mcmillhj left
|
|||
harmil | Because the vast majority of Python code out there is Python 2, and it's not forward-compatible, so I'd like to have a library that parses the largest subset of code. Perl 6, IMHO, is as valid a migration path for Python 2 as Python 3... | 14:45 | |
14:45
_mg_ left
14:46
kyclark left
|
|||
CIAvash | m: my $x where ''; $x = ''; | 14:47 | |
camelia | ( no output ) | ||
CIAvash | m: my $x where {''}; $x = ''; | ||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected <anon> but got Str ("") in block <unit> at <tmp> line 1» | ||
BrokenRobot | m: my $x where False; $x = ''; | ||
camelia | rakudo-moar 5a4963: OUTPUT«Potential difficulties: Smartmatch against False always fails; if you mean to test the topic for truthiness, use :!so or *.not or !* instead at <tmp>:1 ------> 3my $x where 7⏏5False; $x = '';Type check failed in assignment to $x;…» | ||
BrokenRobot | m: say '' ~~ '' | ||
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
BrokenRobot | m: say '' ~~ 'dasdas' | ||
camelia | rakudo-moar 5a4963: OUTPUT«False» | ||
BrokenRobot | Ah, I see. | 14:48 | |
14:48
acrussell left
|
|||
pmurias | harmil: I have to get afk, will be back much later today and tommorow | 14:49 | |
CIAvash | m: my $x where {''}(); $x = ''; | ||
camelia | ( no output ) | ||
14:49
pmurias left
|
|||
BrokenRobot | m: {''} ~~ '' | 14:49 | |
camelia | rakudo-moar 5a4963: OUTPUT«Block object coerced to string (please use .gist or .perl to do that) in block <unit> at <tmp> line 1» | ||
BrokenRobot | So basically if it's Code, it calls it and passes the type if the return is true. If not, it smartmatches it and in that situation, $_ works even if it's '' | 14:51 | |
hmmm | |||
m: my $x where $_ eq "ds"; $x = "ds" | |||
camelia | ( no output ) | ||
BrokenRobot | m: my $x where $_ eq "dsdsds"; $x = "ds" | ||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected <anon> but got Str ("ds") in block <unit> at <tmp> line 1» | ||
BrokenRobot | And I guess here it magically makes a block? | ||
ETOOMAGICAL | 14:52 | ||
14:52
freezerburnV joined
|
|||
masak | a thunk, not a block | 14:52 | |
BrokenRobot | "Your search - site:docs.perl6.org thunk - did not match any documents. " :( | 14:54 | |
perlpilot gets the feeling that we'll eventually settle on being more explicit about the timing of certain things because otherwise you get "ETOOMAGICAL" | 14:55 | ||
BrokenRobot: en.wikipedia.org/wiki/Thunk | |||
BrokenRobot | That's actually a word :o | 14:56 | |
CIAvash | "A thunk is a piece of code that may not execute immediately, ..." design.perl6.org/S06.html#Subrouti...de_objects | 14:57 | |
BrokenRobot | Well, yeah, that's what I found annoying in Perl 5. You pop open a doc and there's a gazillion pages explaining all of the special cases. | 14:58 | |
Same reason I hate Russian. Every rule has exceptions :) | |||
mst | that's why english is so awesome, we don't really have rules in the first place | ||
you just sort of have to figure it out | 14:59 | ||
BrokenRobot | Yeah :) | ||
14:59
[particle] left
|
|||
perlpilot | And just when you think you have a handle on "the rules" ... we make up new ones on the spot and start using them. | 15:00 | |
harmil | pmurias: I'll be around. | 15:02 | |
hoelzro | english is weakly typed ;) | ||
mst | english is hopper.jpg typed | ||
harmil | perlpilot: keep in mind that English is as much about hiding information as revealing and illuminating it. | 15:03 | |
All natural languages are quickly repurposed to creating hidden channels available only to specific subcultures. It's what we apes do. | 15:04 | ||
perlpilot | harmil: Sure. And while it's fun to do that consciously, it often happens "en passant" without anyone realizing until afterwards. | 15:05 | |
15:06
TimToady joined
|
|||
dalek | c: ecad048 | (Wenzel P. P. Peppmeyer)++ | doc/Language/typesystem.pod: doc :$.attr shortcut in constructor calls |
15:06 | |
perlpilot | huh ... I thought that was already documented, but perhaps I'm still thinking of the synopses as documentation | 15:07 | |
15:07
Actualeyes left,
[particle] joined
|
|||
gfldex | perlpilot: a full text search of :$. did not bear fruit | 15:08 | |
Pod::To::BigPage++ :) | |||
15:09
Actualeyes joined
15:10
kyclark joined
15:12
kyclark left
15:13
lichtkind joined
15:14
sdo joined
15:15
sdo left
15:16
ZoffixMobile joined
15:18
freezerburnV left
|
|||
ZoffixMobile | gfldex, that'll work with $!foo too. And based on what $.foo actually is, I'm guessing it'd work for any method, not just an attribute. | 15:19 | |
ZoffixMobile wonders about :&foo | |||
gfldex | ZoffixMobile: you know where typesystem.pod is, right? :-> | ||
ZoffixMobile | m: sub foo { 'bar' }; my %h = :&foo; say %h | 15:20 | |
camelia | rakudo-moar 5a4963: OUTPUT«{foo => sub foo () { #`(Sub|63921304) ... }}» | ||
ZoffixMobile | gfldex, fair enough :) If I don't forget, I'll doc it :) | ||
m: sub foo { 'bar' }; my %h = :&foo(); say %h | 15:21 | ||
camelia | rakudo-moar 5a4963: OUTPUT«No such method 'CALL-ME' for invocant of type 'Pair' in block <unit> at <tmp> line 1» | ||
masak | m: my %h = :&say; say %h.perl | ||
camelia | rakudo-moar 5a4963: OUTPUT«{:say(sub say (| is raw) { #`(Sub|48386440) ... })}» | ||
15:23
ZoffixMobile left
|
|||
gfldex .oO( syntaxy-things.pod ) | 15:26 | ||
15:28
kurahaupo joined
15:30
_mg_ joined,
[particle] left
15:31
Sgeo_ joined
15:32
freezerburnV joined,
Actualeyes left
15:34
kyclark joined,
Actualeyes joined
|
|||
kyclark | Can someone help me understand this? pastie.org/10893089 | 15:36 | |
gfldex | kyclark: try &even | 15:37 | |
perlpilot | m: sub even ($x) { $x %% 2 }; say grep &even, [1..4]; | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)» | ||
kyclark | Ooo, that works! | ||
perlpilot | kyclark: even and even() are calls, &even is just a mention, which is what grep, map, etc. need | ||
gfldex | m: my $even = -> $x { $x %% 2 }; say grep $even, [1..4]; | 15:38 | |
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)» | ||
gfldex | m: my \even = -> $x { $x %% 2 }; say grep even, [1..4]; | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)» | ||
gfldex | nope :) | ||
15:39
huggable left
15:40
huggable joined
|
|||
gfldex | m: constant even = -> $x { $x %% 2 }; say grep even, [1..4]; | 15:40 | |
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)» | ||
perlpilot | kyclark: Take everything I said in the context of the code you provided. (since gfldex is being ornery :) | 15:41 | |
gregf_ | m: sub even ($x) { $x %% 2 }; say [1..4].grep(&even), grep &even, [1..4] # prefers the former :| | 15:43 | |
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)(2 4)» | ||
15:43
tharkun left
|
|||
gregf_ | m: class MyInt is Int { method even(){ self %% 2 } }; say [1..4].map({ MyInt.new($_) }).grep({.even}) | 15:46 | |
camelia | rakudo-moar 5a4963: OUTPUT«(2 4)» | ||
15:54
abraxxa left
|
|||
BrokenRobot | m: use MONKEY-TYPING; augment class Array { method evens { self.grep: * %% 2 } }; [1..10].evens.say | 15:56 | |
camelia | rakudo-moar 5a4963: OUTPUT«(2 4 6 8 10)» | ||
kyclark | How can I declare a MAIN sub that will work if given any number of arguments (e.g., 0 or more)? | 15:58 | |
BrokenRobot | m: ([2..10] but role { method evens { self.grep: * %% 2 } }).evens.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 4 6 8 10)» | ||
BrokenRobot | tehe | ||
pmichaud | good morning, #perl6 | ||
BrokenRobot | kyclark: make it slurpy: sub MAIN (*@args) { ... } | ||
gfldex | kyclark: sub MAIN(*@many){} | 15:59 | |
BrokenRobot | kyclark: make it slurpy: sub MAIN (*@args, *%named-args) { ... } # if you want to capture --named=args too | ||
15:59
mohae left
|
|||
BrokenRobot | pmichaud: \o | 15:59 | |
WeeChat-- # automatically changing \o to \o\ for no good reason | |||
pmichaud | it looks like "\o" to me. | 16:00 | |
16:01
ssotka joined
|
|||
BrokenRobot | m: &say.wrap: { put @_.grep: * %% 2 }; [2..10].say | 16:01 | |
camelia | rakudo-moar 5a4963: OUTPUT«2 4 6 8 10» | ||
BrokenRobot | pmichaud: yeah, I had to delete the extra "\" :) | ||
16:02
yqt joined
|
|||
kyclark | Can you tell what I'm trying to do with this? How can I make it work? ['a'..'z'].classify( /[aeiou]/ ) | 16:02 | |
BrokenRobot | m: ["a".."z"].classify( /[aeiou]/ ).say | 16:03 | |
camelia | rakudo-moar 5a4963: OUTPUT«Method '!cursor_start' not found for invocant of class 'Str' in block <unit> at <tmp> line 1» | ||
BrokenRobot | neat... | ||
m: ["a".."z"].classify( { /[aeiou]/ ?? 'vowels' !! 'consonants' ).say | 16:04 | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Missing blockat <tmp>:1------> 3{ /[aeiou]/ ?? 'vowels' !! 'consonants' 7⏏5).say expecting any of: statement end statement modifier statement modifier loop» | ||
BrokenRobot | Ah, wrong regex | 16:05 | |
m: ["a".."z"].classify( { /<[aeiou]>/ ?? "vowels" !! "consonants" }).say | |||
camelia | rakudo-moar 5a4963: OUTPUT«{consonants => [b c d f g h j k l m n p q r s t v w x y z], vowels => [a e i o u]}» | ||
BrokenRobot | m: &classify.signature.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«($test, + is raw, *%named)» | ||
BrokenRobot | Dunno aout the !cursor error | 16:06 | |
m: ["a".."z"].classify(rx/<[aeiou]>/).say | |||
camelia | rakudo-moar 5a4963: OUTPUT«Method '!cursor_start' not found for invocant of class 'Str' in block <unit> at <tmp> line 1» | ||
BrokenRobot | I guess it can only take Code | 16:07 | |
gfldex | m: my %h = ['a'..'z'].classify( { $^a ~~ <a e i o u>.any ?? "v" !! "c" } ); dd %h | ||
camelia | rakudo-moar 5a4963: OUTPUT«Hash %h = {:c($["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]), :v($["a", "e", "i", "o", "u"])}» | ||
kyclark | What about this (doesn't work)? [1..10].classify({$_ %% s ?? 'even' !! 'odd'}) | 16:09 | |
BrokenRobot | m: ["a".."z"].classify(* eq <a e i o u>.any).say | ||
camelia | rakudo-moar 5a4963: OUTPUT«P6opaque: no such attribute '$!reified' in type List when trying to get a value in block <unit> at <tmp> line 1» | ||
BrokenRobot | Damn. classify sure loves to spill the guts | ||
kyclark: what's "s"? | |||
kyclark | Oh, that might explain it. | ||
m: [1..10].classify({$_ %% 2 ?? 'even' !! 'odd'}) | 16:10 | ||
camelia | ( no output ) | ||
BrokenRobot | m: [1..10].classify({$_ %% s ?? 'even' !! 'odd'}) | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5===Null regex not allowedat <tmp>:1------> 3[1..10].classify({$_ %% s ?7⏏5? 'even' !! 'odd'})Malformed replacement part; couldn't find final ?at <tmp>:1------> 3].classify({$_ %% s ?? 'even' !! 'odd'})7⏏5<EOL>…» | ||
kyclark | m: [1..10].classify({$_ %% 2 ?? 'even' !! 'odd'}).say | ||
camelia | rakudo-moar 5a4963: OUTPUT«{even => [2 4 6 8 10], odd => [1 3 5 7 9]}» | ||
kyclark | woo-hoo! | ||
BrokenRobot | m: 'foo' ~~ s ?oo?ar? | ||
camelia | rakudo-moar 5a4963: OUTPUT«Cannot modify an immutable Str in block <unit> at <tmp> line 1» | ||
BrokenRobot | m: my $x = 'foo'; $x ~~ s ?oo?ar?; say $x | ||
camelia | rakudo-moar 5a4963: OUTPUT«far» | ||
BrokenRobot | ^ that's why the error was bad. | 16:11 | |
m: [1..10].classify(* %% 2).say | |||
camelia | rakudo-moar 5a4963: OUTPUT«{False => [1 3 5 7 9], True => [2 4 6 8 10]}» | ||
hoelzro | resuming my supply inquiry from earlier - Channel.Supply creates a live supply, right? | ||
kyclark | BrokenRobot, that is so...bad ass. | 16:12 | |
BrokenRobot | m: [1..10].classify(* %% 2).grep(*.key)[0].value.flat.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 4 6 8 10)» | ||
BrokenRobot | kyclark: it's basically equivalent to { $_ %% 2 } | 16:13 | |
WhateverCode | |||
kyclark | This was where I was trying to get: | ||
m: for @args.classify(* %% 2).values -> @n { say join(' + ', @n), ' = ', [+] @n; } | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@args' is not declaredat <tmp>:1------> 3for 7⏏5@args.classify(* %% 2).values -> @n { sa» | ||
kyclark | Oh, right, that won't work outside my script. | ||
BrokenRobot | :) | ||
kyclark | m: for [1..10].classify(* %% 2).values -> @n { say join(' + ', @n), ' = ', [+] @n; } | ||
camelia | rakudo-moar 5a4963: OUTPUT«2 + 4 + 6 + 8 + 10 = 301 + 3 + 5 + 7 + 9 = 25» | ||
gfldex | m: dd [1..10].classify(* %% 2) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(my Any %{Any} = Bool::False => $[1, 3, 5, 7, 9], Bool::True => $[2, 4, 6, 8, 10])» | ||
BrokenRobot | FWIW, camelia can take a URL to a gist | 16:14 | |
m: gist.github.com/zoffixznet/9e03fc4...ed2c1ebfd3 | |||
camelia | rakudo-moar 5a4963: OUTPUT«{False => [1 3 5 7 9], True => [2 4 6 8 10]}» | ||
kyclark | Mind. Blown. | ||
BrokenRobot | :D | ||
That's what we do... :) | |||
gfldex | m: dd [1..10].classify(* %% 2){True} | ||
camelia | rakudo-moar 5a4963: OUTPUT«Array <element> = $[2, 4, 6, 8, 10]» | ||
BrokenRobot | gfldex: neat! | 16:15 | |
16:15
_mg_ left
|
|||
jnthn | hoelzro: That's a little more interesting. In the sense that if you tap, then close, then tap again you might miss values in the middle, then yes. But if multiple things tap then they're effectively competing over the values. | 16:15 | |
hoelzro: That is so you can for ^4 { react { whenever $channel -> $value { } } } to have 4 workers that will compete for work from the channel. | 16:16 | ||
hoelzro: oops, start react ... :) | |||
hoelzro | yikes | ||
kyclark | gfldex, can you explain that last {True} bit? | ||
BrokenRobot | kyclark: it's a hash key lookup | ||
well, Map? | 16:17 | ||
kyclark | Oh, yes. | ||
jnthn | hoelzro: Which is actually rather fitting with channels in general, if you think about it, 'cus you can only receive a value once. | ||
BrokenRobot | m: my Map $x = True => 'blah'; say $x{True} | ||
camelia | rakudo-moar 5a4963: OUTPUT«Type check failed in assignment to $x; expected Map but got Pair (:True("blah")) in block <unit> at <tmp> line 1» | ||
hoelzro | ok, thanks jnthn; I've been looking into a lockup in integration/advent2013-day14.t, and I think the problem is in the impl of Channel.Supply | ||
mhmm, that makes sense | |||
BrokenRobot | m: my $x = Map.new: True => "blah"; say $x{True} | ||
camelia | rakudo-moar 5a4963: OUTPUT«Nil» | ||
jnthn | hoelzro: If you want a live supply from a channel, then obtain the supply precisely once and than .publish to get a live supply that many things can tap | ||
gfldex | kyclark: that's why I use dd to print the values. It also provides type information. | ||
BrokenRobot cues in of a dog in front of the computer | |||
jnthn | hoelzro: Which is how you go from on-demand to live in general, fwiw :) | 16:18 | |
hoelzro | ah =) | ||
BrokenRobot | m: my %h = True => "blah"; say %h{True} | ||
camelia | rakudo-moar 5a4963: OUTPUT«blah» | ||
BrokenRobot | :S | ||
m: my %h = True => "blah"; say %h<True> | |||
camelia | rakudo-moar 5a4963: OUTPUT«blah» | ||
BrokenRobot | What sorcery is this.... | ||
m: True.Str.say | 16:19 | ||
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
BrokenRobot | Ahh | ||
jnthn | BrokenRobot: Hashes have string keys and...that :) | ||
BrokenRobot | :) | ||
kyclark | I help teach Perl 5 to a metagenomics class, so I'm going through all my old assignments and trying to write them in Perl 6. It is simply amazing. | 16:20 | |
BrokenRobot | \o/ | ||
kyclark | Explain to me why both of these do what I want: | 16:23 | |
m: ['z'...'a'].sort.say | |||
camelia | rakudo-moar 5a4963: OUTPUT«(a b c d e f g h i j k l m n o p q r s t u v w x y z)» | ||
kyclark | m: [10...1].sort.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 2 3 4 5 6 7 8 9 10)» | ||
kyclark | How does it know to sort numerically? | ||
psch | m: say &infix:<cmp>.signature | ||
camelia | rakudo-moar 5a4963: OUTPUT«(Mu, Mu)» | ||
psch | m: say &infix:<cmp>.candidates.signature | 16:24 | |
camelia | rakudo-moar 5a4963: OUTPUT«Method 'signature' not found for invocant of class 'List' in block <unit> at <tmp> line 1» | ||
psch | m: say &infix:<cmp>.candidates>>.signature | ||
camelia | rakudo-moar 5a4963: OUTPUT«((\a, \b) (Real:D \a, \b) (\a, Real:D \b) (Real:D \a, Real:D \b) (Int:D \a, Int:D \b) (int $a, int $b) (Num:D \a, Num:D \b) (num $a, num $b) (Blob:D \a, Blob:D \b) (Str:D \a, Str:D \b --> Order:D) (str $a, str $b --> Order:D) (Range:D \a, Range:D \b --> Or…» | ||
BrokenRobot | kyclark: Perl 6 has types basically :) | ||
m: 'z'.^name.say; 10.^name.say | |||
camelia | rakudo-moar 5a4963: OUTPUT«StrInt» | ||
psch | m: say &infix:<cmp>.candidates[4,9]>>.signature | ||
camelia | rakudo-moar 5a4963: OUTPUT«((Int:D \a, Int:D \b) (Str:D \a, Str:D \b --> Order:D))» | ||
psch | that's the two important ones here i'd say | ||
BrokenRobot | So if you give cmp two Ints it'll sort numerically | ||
psch | m: say 1 cmp 2; say "a" cmp "b" | 16:25 | |
camelia | rakudo-moar 5a4963: OUTPUT«LessLess» | ||
psch | and sort uses cmp by default | ||
kyclark | Yes yes yes! | ||
BrokenRobot | :) | ||
psch | m: say ^10 .sort: { $^a cmp $^b * (-1 * $++ %% 2) } # /o\ | 16:26 | |
camelia | rakudo-moar 5a4963: OUTPUT«(0 7 8 1 9 4 3 6 2 5)» | ||
kyclark | If my students read in a bunch of numbers from a text file, though, will this break? | ||
psch | m: say <1>.WHAT | ||
camelia | rakudo-moar 5a4963: OUTPUT«(IntStr)» | ||
16:27
dogbert17 joined
|
|||
pmichaud | jnthn: /o | 16:27 | |
er | |||
jnthn: o/ | |||
jnthn | Hi, pmichaud o/ | ||
psch | hm, actually i think we don't get allomorphs from IO, do we? | ||
jnthn | pmichaud: Have fun at YAPC? :) | ||
pmichaud | jnthn: Yes, very much so. | ||
16:27
dakkar left
|
|||
pmichaud | jnthn: looking forward to the next event, whenever it might be. | 16:27 | |
perigrin did see pmichaud in the corner of his talk | |||
psch | m: say <1 11 12 20>.sort | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 11 12 20)» | ||
BrokenRobot | kyclark: you'd have to coerce them to Ints or some such | ||
psch | err, that didn't actually help | ||
perigrin | sadly I didn't have much more time to say hi. | ||
kyclark | m: <10 9 1 foo 4>.sort.say | 16:28 | |
psch | m: say <1 2 11 12 20>.sort | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 4 9 10 foo)» | ||
rakudo-moar 5a4963: OUTPUT«(1 2 11 12 20)» | |||
psch | m: say <1 2 11 12 20>>>.Str.sort | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 11 12 2 20)» | ||
psch | kyclark: looks like "if it uniformly looks like it's Int-y, do it Int-y" | ||
pmichaud | perigrin: yes, that was an enjoyable talk. | ||
perigrin | thank you :) | 16:29 | |
jnthn | pmichaud: Cool...well, probably not literally cool if it was in Florida, but... :) | ||
BrokenRobot | m: multi pass (Int $x) { say "Int" }; multi pass (Str $x) { say "Str" }; pass val(2, "2") | ||
camelia | rakudo-moar 5a4963: OUTPUT«Value of type Int uselessly passed to val() in block <unit> at <tmp> line 1Cannot resolve caller pass(List); none of these signatures match: (Int $x) (Str $x) in block <unit> at <tmp> line 1» | ||
kyclark | psch, what did you do there with the >>>? | ||
BrokenRobot | grr | ||
pmichaud | Actually Florida wasn't too bad, temperature wise. It's hotter here in Dallas right now. | ||
jnthn is finding the Prague summer more than warm enough | |||
psch | kyclark: >> is a hyper method op | ||
perigrin | jnthn: actually the AC here is quite strong, the hotel was a little chilly. | ||
jnthn | perigrin: heh, I'd probably have loved that :) | ||
BrokenRobot | kyclark: calls the given method on each item of the list | ||
psch | kyclark: it calls the method on the RHS on all elements of the list on the LHS (potentially out of sequence, but returns in order) | ||
jnthn is a winter kind of person :) | |||
16:29
dakkar joined
|
|||
pmichaud | and yes, the hotel had the typical American AC-freezing-interior-in-the-summer thing going on. :) | 16:30 | |
perigrin is a summer kind of person, but slightly less summer than Florida in June/July/August typically. | |||
16:30
stevieb9 left
|
|||
psch | kyclark: it's kind of like .map({$_.$method}), except that it doesn't guarantee in-order execution, only ordered return | 16:30 | |
16:30
jack_rabbit left
|
|||
kyclark | You keep stressing the out-of-order possibility, is it because it's possible to parallelize the operation? | 16:32 | |
psch | exactly. i'm not sure we do that yet though | ||
16:33
kalkin-_ is now known as kalkin-
|
|||
kyclark | OK, so what about something like this? | 16:33 | |
m: [1..10] >> { $_ * 2 }.say | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unsupported use of >> to do right shift; in Perl 6 please use +> or ~>at <tmp>:1------> 3[1..10] >>7⏏5 { $_ * 2 }.say» | ||
psch | kyclark: the single >> is a methodop, not an infix | 16:34 | |
kyclark | I think I've actually asked this here before, but I forget | ||
16:34
dakkar left
|
|||
psch | m: [1..10]>>.&({ $_ * 2 }).say | 16:34 | |
camelia | rakudo-moar 5a4963: OUTPUT«[2 4 6 8 10 12 14 16 18 20]» | ||
pyrimidine | kyclark: glad to see you back! | ||
kyclark | Thanks, pyrimidine. | 16:35 | |
This is easier, no? | |||
m: [1..10].map: * * 2.say | |||
camelia | rakudo-moar 5a4963: OUTPUT«2222222222» | ||
kyclark | Oh, hrm. | ||
m: [1..10].map: * * 2 | |||
camelia | ( no output ) | ||
tbrowder | Zoffix (or anyone): consider this gist <gist.github.com/tbrowder/b71479ca1...a02b2>, is my version of a proper parse for the pod 6 table test correct? | ||
pyrimidine | m: 2.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«2» | ||
psch | m: say map 1..10: * * 2 : | ||
kyclark | I get the right answer in my REPL | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 4 6 8 10 12 14 16 18 20)» | ||
kyclark | Yes, that's it. | 16:36 | |
psch | kyclark: TIMTOWTDI :) | ||
hoelzro | jnthn: does emit() (as in the one that goes in supply { ... }) cause a control exception? | ||
kyclark | BTW, this blows up my REPL: | 16:37 | |
m: [1..10].map: * ** 2.WHAT | |||
camelia | rakudo-moar 5a4963: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new? in block <unit> at <tmp> line 1» | ||
kyclark | I wanted to do something like this: | ||
m: [1..10].map: * ** 2.grep: * < 50 | |||
camelia | ( no output ) | ||
psch | m: [1..10].map: * ** (2.grep: * < 50) | 16:38 | |
camelia | ( no output ) | ||
psch | that's how it parses | ||
kyclark | this works: | ||
m: [1..10].grep: * < 5 | |||
camelia | ( no output ) | ||
kyclark | m: say [1..10].grep: * < 5 | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 2 3 4)» | ||
16:38
[particle] joined
|
|||
jnthn | hoelzro: Yes | 16:38 | |
hoelzro: done also | |||
kyclark | This works: | 16:39 | |
m: say grep * < 50, [1..10].map: * ** 2 | |||
camelia | rakudo-moar 5a4963: OUTPUT«(1 4 9 16 25 36 49)» | ||
hoelzro | ok, that may explain why the fix I tried last night didn't work =/ | ||
kyclark | And this works: | 16:40 | |
m: say grep * < 50, map * ** 2, [1..10] | |||
camelia | rakudo-moar 5a4963: OUTPUT«(1 4 9 16 25 36 49)» | ||
BrokenRobot | m: say grep * < 50, [1..10].map: *² | ||
camelia | rakudo-moar 5a4963: OUTPUT«Cannot resolve caller Numeric(Whatever: ); none of these signatures match: (Mu:U \v: *%_) in block <unit> at <tmp> line 1» | ||
kyclark | I'm intrigued by this idea I think I saw in a talk by Damien: | ||
m: say [1..10] ==> * ** 2 | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Sorry, do not know how to handle this case of a feed operator yet.at <tmp>:1------> 3say [1..10] ==> * ** 27⏏5<EOL>» | ||
BrokenRobot | awwww.. we didn't do superscripts for this case? | ||
16:41
harrison_ joined
|
|||
psch | m: say &postfix:<²> | 16:41 | |
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routine: postfix:<²> used at line 1. Did you mean 'postfix:<i>', 'postfix:<ⁿ>', 'postfix:<-->', 'postfix:<++>'?» | ||
psch | BrokenRobot: i think that's kind of like why .WHAT doesn't Whatever curry | 16:42 | |
BrokenRobot | It's not an op, it's done in grammer | ||
Ah t'bad | |||
japhb | OK, now I want to know what postfix:<ⁿ> does ... | ||
BrokenRobot | japhb: what'd you think? :) | 16:43 | |
psch | probably nothing, 'cause we don't have it? :) | ||
BrokenRobot | m: say 6² | ||
camelia | rakudo-moar 5a4963: OUTPUT«36» | ||
BrokenRobot | m: say 6²²²² | ||
camelia | rakudo-moar 5a4963: OUTPUT«1127400835818465130246515434079544622236496408864545313869983108525695859756300042859793699471701282603490303071099371257462530081270238260169633679684869958563124451130648728041498601762862967958374766976221542376477543005102834131170639418855873012778926…» | ||
psch | m: say &postfix:<ⁿ> | ||
camelia | rakudo-moar 5a4963: OUTPUT«sub postfix:<ⁿ> (Mu $, Mu $) { #`(Sub+{<anon|62317104>}|66693952) ... }» | ||
psch | ohh | ||
shows what i know! | |||
m: say 1ⁿ | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Confusedat <tmp>:1------> 3say 17⏏5ⁿ» | ||
japhb | Hmmm, looking at the grammer, it looks like it's a placeholder for the superscript notation | 16:44 | |
BrokenRobot | huh | ||
japhb | src/core/Numeric.pm:proto sub postfix:<ⁿ>(Mu $, Mu $) is pure { * } | ||
src/core/Numeric.pm:multi sub postfix:<ⁿ>(\a, \b) { a ** b } | |||
There it is in the setting | |||
BrokenRobot | It's in Numeric | 16:45 | |
japhb | yup | ||
psch | m: say (2, 2)ⁿ | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3say (2, 2)7⏏5ⁿ expecting any of: infix infix stopper postfix statement end statement modifier …» | ||
BrokenRobot | m: postfix<ⁿ>(2, 3).say | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routine: postfix used at line 1» | ||
BrokenRobot | m: &postfix<ⁿ>(2, 3).say | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routine: postfix used at line 1» | ||
BrokenRobot | m: postfix:<ⁿ>(2, 3).say | 16:46 | |
camelia | rakudo-moar 5a4963: OUTPUT«8» | ||
BrokenRobot has no idea how to give to args to a postfix op :S | |||
Well, other than the above | |||
psch | BrokenRobot++ | ||
japhb | Yep, I was right: | 16:47 | |
src/Perl6/Actions.nqp: method postfix:sym<ⁿ>($/) { | |||
src/Perl6/Actions.nqp: make QAST::Op.new(:op<call>, :name('&postfix:<ⁿ>'), $*W.add_constant('Int', 'int', $power)); | |||
hoelzro | jnthn: is it still the case that $lock.protect({ thing-that-causes-control-exception; }) will not unlock $lock after the control exception is fired? | ||
jnthn | hoelzro: I fear we still have that issues, yes. | ||
BrokenRobot | japhb: ahh | ||
16:48
harrison_ left
|
|||
hoelzro | ok | 16:48 | |
BrokenRobot | This has an unfortunate consequence tho: | 16:49 | |
m: say ²² | |||
camelia | rakudo-moar 5a4963: OUTPUT«4» | ||
BrokenRobot | m: say ²²² | ||
camelia | rakudo-moar 5a4963: OUTPUT«4194304» | ||
BrokenRobot | (it's already rakudobugged) | ||
16:51
[particle] left
16:53
kyclark left
16:55
mohae joined
16:56
[particle] joined
16:58
BrassLantern joined,
BrassLantern left,
BrassLantern joined
17:04
[particle] left,
kyclark joined
17:06
MilkmanDan is now known as MilkmanDan[Han]
|
|||
nine | jnthn: is the same true for return as that's also a control exception now? | 17:09 | |
jnthn | nine: It probably was true before if so. The *real* underlying problem is with LEAVE and some general reentrancy issues around phasers. | 17:11 | |
nine: The moment that's fixed, we use LEAVE to implement protoect and we're all sorted | |||
17:14
araujo joined
17:15
araujo left
|
|||
kyclark | Where are the docs on creating new operators? | 17:15 | |
gfldex | kyclark: docs.perl6.org/language/functions#..._Operators | 17:16 | |
kyclark | Thanks. | 17:19 | |
Is there a concept of "Nothing" in P6? | |||
gfldex | m: dd Nil | 17:20 | |
camelia | rakudo-moar 5a4963: OUTPUT«Nil» | ||
psch | m: my @a := 1, Empty, 2; say @a.perl | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1, 2)» | ||
gfldex .oO( undefined-things.pod ) | |||
17:22
tlvb left,
tlvb joined
|
|||
kyclark | How would you rate this? | 17:23 | |
17:23
fhorck joined
|
|||
kyclark | pastie.org/10893185 | 17:23 | |
m: pastie.org/10893185 | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Confusedat <tmp>:1------> 3http:7⏏5//pastie.org/10893185 expecting any of: colon pair» | ||
17:25
kyclark left
|
|||
psch ^A^Ks the half-finished response | 17:25 | ||
17:25
kyclark joined
|
|||
kyclark | Sorry, I blew up my window. So, I was asking about this: pastie.org/10893185 | 17:26 | |
psch is glad about ^Y | |||
[Coke] is in 21C weather right now. brisk but nice | |||
(compared to orlando or dallas. :) | |||
psch | kyclark: somewhat weird. you are using multis to distinguish between valid values, but you're still using an if in your "main" candidate to distinguish cases that could be solved by a multi | ||
17:26
[particle] joined
|
|||
kyclark | Can you suggest a Better Way? | 17:27 | |
Dang, have to retrieve kid. BRB. | |||
psch | m: multi postfix:<!>(1) { 1 }; multi postfix:<!>(Int $x where * > 1) { $x * ($x - 1) }; multi postfix:<!>($) { Nil }; say 5! | 17:28 | |
camelia | rakudo-moar 5a4963: OUTPUT«20» | ||
psch | m: multi postfix:<!>(1) { 1 }; multi postfix:<!>(Int $x where * > 1) { $x * ($x - 1) }; multi postfix:<!>($) { Nil }; say 2! | ||
camelia | rakudo-moar 5a4963: OUTPUT«2» | ||
17:29
mohae_ joined
|
|||
psch | m: multi postfix:<!>(1) { 1 }; multi postfix:<!>(Int $x where * > 1) { $x * ($x - 1) }; multi postfix:<!>($) { Nil }; ($_! // 'Nada').say for 5...0 # to be more faithful i suppose | 17:29 | |
camelia | rakudo-moar 5a4963: OUTPUT«2012621Nada» | ||
17:30
fhorck left
17:31
mohae left
|
|||
BrokenRobot | docs for custom operators you say? perl6.party/post/Anguish--Invisible...Data-Theft | 17:36 | |
XD | |||
17:37
kyclark left
17:39
kyclark joined
|
|||
BrokenRobot | psch: factorial of 0 is 1, isn't it? | 17:40 | |
17:40
_mg_ joined
|
|||
psch | BrokenRobot: i don't think kyclark was looking for factorial | 17:40 | |
BrokenRobot: unless i missed something | 17:41 | ||
BrokenRobot | Oh, never mind then. | ||
kyclark | I was doing factorial, yes. | ||
psch | pastie.org/10893185 no ! after the ($x - 1) :) | ||
BrokenRobot | m: sub postfix:<!>{ [*] 1..$^a }; ($_! // "Nada").say for 5...-1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«1202462111» | ||
psch | yeah, if it had been factorial that'd been my solution | ||
although not with placeholder but with Int >= 0 | 17:42 | ||
in a formal Signature | |||
BrokenRobot | m: multi postfix<!> ($ where < 0) { Nil }; multi postfix:<!>{ [*] 1..$^a }; ($_! // "Nada").say for 5...-1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Missing blockat <tmp>:1------> 3multi postfix7⏏5<!> ($ where < 0) { Nil }; multi postfix expecting any of: new name to be defined» | ||
BrokenRobot | blarg | ||
The [*] Empty being 1 is messing up the elegance lol | 17:43 | ||
psch | www.wolframalpha.com/input/?i=0! | ||
it doesn't? :P | |||
that we don't have a shorthand for 0^..^* is what's messing up the elegance imo | 17:44 | ||
BrokenRobot | Heh, well that yeah, but messes up for negatives | ||
17:45
yqt left
|
|||
BrokenRobot | wait a second... | 17:45 | |
17:48
setty1 joined
|
|||
BrokenRobot | m: sub postfix:<!> { ({[*] 1..$++} ... *)[$^a] // Nil }; ($_! // "Nada").say for 5...-1 | 17:50 | |
camelia | rakudo-moar 5a4963: OUTPUT«120246211Nada» | ||
17:51
kurahaupo left
|
|||
BrokenRobot | m: sub postfix:<!> {({[*] 1..$++}...*)[$^a]}; ($_! // "Nada").say for 5...-1 | 17:51 | |
camelia | rakudo-moar 5a4963: OUTPUT«120246211Nada» | ||
17:51
kurahaupo joined,
kurahaupo left,
zakharyas left
|
|||
BrokenRobot | .u ellipses | 17:52 | |
yoleaux | No characters found | ||
17:52
kurahaupo joined
|
|||
BrokenRobot | .u ellipsis | 17:52 | |
yoleaux | U+0EAF LAO ELLIPSIS [Lo] (ຯ) | ||
U+1801 MONGOLIAN ELLIPSIS [Po] (᠁) | |||
U+2026 HORIZONTAL ELLIPSIS [Po] (…) | |||
BrokenRobot | m: sub postfix:<!> {({[*] 1..$++}…*)[$^a]}; ($_! // "Nada").say for 5…-1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«120246211Nada» | ||
psch | i don't know if i would advocate for a factorial implementation that's O(n²) :P | ||
BrokenRobot | huggable: factorial :is: m: sub postfix:<!> {({[*] 1..$++}…*)[$^a]}; ($_! // "Nada").say for 5…-1 | ||
huggable | BrokenRobot, Added factorial as m: sub postfix:<!> {({[*] 1..$++}…*)[$^a]}; ($_! // "Nada").say for 5…-1 | ||
BrokenRobot | psch: the answer is always MOAR COARS :D | 17:53 | |
psch | but that's not even parallelizable /o\ | ||
psch ponders a hardware implementation of moarvm | |||
BrokenRobot | Oh right, I meant the answer is FASTAR COARS :D | 17:54 | |
17:56
_mg_ left,
labster joined
|
|||
kyclark | OK, so not to sound too Haskelly, but if Nil is basically Nothing, is there a Just (x)? | 17:57 | |
BrokenRobot | What's (x)? | ||
kyclark | I guess there's Int (x) | 17:58 | |
psch | that's this weird monad stuff, isn't it? | ||
kyclark | So a sum type (is that right?) where MyType = Nil | Int x | ||
17:58
FROGGS joined
|
|||
psch | m: subset MaybeInt where Int|Nil; # i guess? | 17:59 | |
camelia | ( no output ) | ||
kyclark | Maybe I need to think about this on my own some more. | ||
BrokenRobot | kyclark: what is this for? An Int can be undefined | ||
psch | i'm really not good at haskell | ||
also, assigning Nil into a container probably doesn't do quite do what you think | |||
BrokenRobot | m: my $x; say $x:defined ?? "Nope" !! "Nap"; | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$x:defined' is not declared. Did you mean any of these? &defined &undefineat <tmp>:1------> 3my $x; say 7⏏5$x:defined ?? "Nope" !! "Nap";» | ||
BrokenRobot | *sigh* | ||
m: my $x; say $x.defined ?? "Yup" !! "Nap"; | |||
camelia | rakudo-moar 5a4963: OUTPUT«Nap» | ||
BrokenRobot | m: my $x = 5; $x = Nil; say $x; my $y; say $y; | 18:00 | |
camelia | rakudo-moar 5a4963: OUTPUT«(Any)(Any)» | ||
psch | m: my $x is default(pi); $x = 10; $x.say; $x = Nil; $x.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«103.14159265358979» | ||
kyclark | pastie.org/10893219 I'm not sure where I'm going with this. Thinking about pattern matching, I guess. | 18:04 | |
gfldex | kyclark: if you want to indicate failure use Failure see: docs.perl6.org/type/Failure | ||
psch | fwiw, Nil only really comes up in failed matches if you're not returning it yourself | ||
or, well, IO too i suppose | 18:05 | ||
gfldex | kyclark: you may want to have a look at rosettacode.org/wiki/Sorting_algori...ort#Perl_6 | 18:07 | |
m: say [].defined; | 18:08 | ||
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
dalek | c: b655f6f | coke++ | .gitignore: ignore generated dir |
||
gfldex | matching on undefined values may not get you what you think it would | ||
dalek | c/coke/pod6: 0890707 | coke++ | / (574 files): Rename .pod files to .pod6 |
18:09 | |
18:15
rindolf joined
|
|||
pmichaud | afk # meeting | 18:15 | |
kyclark | I'm flailing here, but I'm curious to do something like: my %count; <a b b c>.map: $count{*}++ (e.g., count how many times each item in a list occurs) | 18:18 | |
BrokenRobot | kyclark: use a set | ||
psch | m: my %count = <a b b c>.Bag; say %count.perl | ||
camelia | rakudo-moar 5a4963: OUTPUT«{:a(1), :b(2), :c(1)}» | ||
BrokenRobot | or bag | ||
yup :) | 18:19 | ||
psch | set always has 1 as value | ||
or True, actually i think? | |||
BrokenRobot | Yeah, I realized the second I said it :) | ||
m: my %c = set <a b c c>; say %c | |||
camelia | rakudo-moar 5a4963: OUTPUT«{a => True, b => True, c => True}» | ||
18:19
diakopter left
|
|||
ilmari | m: <a b b c>.Set.perl.say | 18:20 | |
camelia | rakudo-moar 5a4963: OUTPUT«set("a","c","b")» | ||
BrokenRobot | huggable: Bag | ||
huggable | BrokenRobot, Immutable collection of distinct objects with integer weights: docs.perl6.org/type/Bag | ||
BrokenRobot | huggable: BagHash | ||
huggable | BrokenRobot, Mutable collection of distinct objects with integer weights: docs.perl6.org/type/BagHash | ||
kyclark | m: bag 'ksjdferuiqfdkasdoij'.comb.grep(/<[aeiou]>/) | 18:21 | |
camelia | ( no output ) | ||
kyclark | m: say bag 'ksjdferuiqfdkasdoij'.comb.grep(/<[aeiou]>/) | ||
camelia | rakudo-moar 5a4963: OUTPUT«bag(a, i(2), e, u, o)» | ||
kyclark | So cool, but: | ||
m: say 'ksjdferuiqfdkasdoij'.comb.grep(/<[aeiou]>/).bag | |||
camelia | rakudo-moar 5a4963: OUTPUT«Method 'bag' not found for invocant of class 'Seq' in block <unit> at <tmp> line 1» | ||
BrokenRobot | m: "foobarber".comb.Bag.hash.say | ||
camelia | rakudo-moar 5a4963: OUTPUT«{a => 1, b => 2, e => 1, f => 1, o => 2, r => 2}» | ||
BrokenRobot | m: say 'ksjdferuiqfdkasdoij'.comb.grep(/<[aeiou]>/).list.bag | ||
camelia | rakudo-moar 5a4963: OUTPUT«Method 'bag' not found for invocant of class 'List' in block <unit> at <tmp> line 1» | ||
kyclark | That's exactly what I wanted | ||
BrokenRobot | orly | ||
Oh, capital Bag | 18:22 | ||
m: say 'ksjdferuiqfdkasdoij'.comb.grep(/<[aeiou]>/).Bag | |||
camelia | rakudo-moar 5a4963: OUTPUT«bag(a, i(2), e, u, o)» | ||
kyclark | How can I know when to use Capital or not? | ||
Oddly, ".hash" and ".Hash" both work. | |||
18:22
mcmillhj joined
|
|||
psch | if it's a method named after a type it's probably capitalized | 18:22 | |
BrokenRobot | kyclark: it's pretty much always capital. I think the're just a few cases where lowercase variants are available | ||
And I think capitals always will work | |||
kyclark | Good to know. Also, ".list" and ".List" are both good | 18:23 | |
BrokenRobot | .list and .hash are the only two I know OTTOMH | ||
perlpilot | I think .item .hash and .list are the only lower-case variants. | ||
(but I guess there's no Item type so ... what BrokenRobot said :) | 18:24 | ||
hobbs | m: multi foo (Any:U) { say "undefined." }; multi foo (Any:D) { say "defined." }; foo(Any()); my Int $x; foo($x); $x = 42; foo($x) | ||
camelia | rakudo-moar 5a4963: OUTPUT«undefined.undefined.defined.» | ||
hobbs | kyclark: maybe that enlightens you a little on your pattern matching question? | ||
BrokenRobot | hobbs++ | 18:25 | |
kyclark | Wow, gonna take me a bit to soak that in. | ||
So it's like "Type:Adjective"? | |||
What other ways can that be used? MOAR EXAMPLES. | 18:26 | ||
BrokenRobot | kyclark: :D :U and :_ (which means either of the first two) | ||
They're called Smileys or something | |||
perlpilot | m: sub foo(Int:X) { } | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Invalid type smiley 'X' used in type nameat <tmp>:1------> 3sub foo(Int:X7⏏5) { }» | ||
hobbs | right, Int contains the potential to be defined or undefined, but Int:D and Int:U restrict to one or the other | 18:27 | |
:D gets more mileage, as you might expect | |||
perlpilot | Though, given the limited number of type smileys, you'd think this would be one of those instances where it could given you some suggestions | ||
BrokenRobot | That's why it's so happy :) | 18:28 | |
Yeah | |||
m: class Foo:version<> {} | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5===Cannot use adverb version on a type name (only 'ver' and 'auth' are understood)at <tmp>:1------> 3class Foo:version<>7⏏5 {} expecting any of: generic roleOther potential difficulties: Pair with <> r…» | ||
BrokenRobot | ^ as in here | ||
18:34
acrussell joined
18:37
daxim left
|
|||
BrokenRobot just got a raise | 18:39 | ||
\o/ | |||
kyclark | Does Perl6 have __DATA__? | ||
BrokenRobot | kyclark: don't think so, though I don't know much Perl 6 | 18:40 | |
kyclark | Well, I guess I could try it first. | ||
BrokenRobot | kyclark: oh, I think you could make it with Pod tho | ||
kyclark | Sounds legit. | ||
BrokenRobot | 'cause all the pod is now a proper object and stuff | ||
DrForr_ | =finish might be something to look for. | ||
kyclark | OK, so this is just sick: $file.IO.lines ==> grep * !~~ /^\>/ ==> my @lines; | ||
perlpilot | kyclark: it's =begin data now (it that's implemented) | ||
18:40
daxim joined
|
|||
kyclark | THAT WORKS! | 18:40 | |
BrokenRobot | sweet | 18:41 | |
kyclark | So the next step is I want to "comb" the lines and shove them into a Bag | ||
perlpilot | kyclark: also, here-docs can be as useful as data section | ||
DrForr_ | Oh, yeah, =finish is the __END__ equivalent. | ||
kyclark | Something like: $file.IO.lines ==> grep * !~~ /^\>/ ==> map: .comb ==> my Bag %count; | ||
BrokenRobot | do it :D | ||
I need to learn the feeds :/ Damian was showing them yesteday and they looked totally mind blowing. | 18:42 | ||
kyclark | It says "Confused" | ||
moritz | feeds are mostly not really implemented | ||
BrokenRobot | moritz: that's too bad | 18:43 | |
DrForr_ | ==> and <== were working somewhat in the demos he was doing at YAPC. | ||
BrokenRobot | I hope when they *are* implemented, there'll be a nice Unicode char for them :) ==> is too many chars | 18:44 | |
DrForr_ | There are plenty of arrows around :) | ||
BrokenRobot | There are plenty of stars too, but we still don't have non-Texas WhateverStar :) | 18:45 | |
moritz | iirc feeds are supposed to be a potentially concurrent feature | ||
BrokenRobot | Yeah | ||
18:45
pmurias joined
|
|||
BrokenRobot | m: sub term:<★> { * }; say ^10 .grep: ★ %% 2 | 18:47 | |
camelia | rakudo-moar 5a4963: OUTPUT«Cannot resolve caller Real(Whatever: ); none of these signatures match: (Mu:U \v: *%_) in block <unit> at <tmp> line 1» | ||
BrokenRobot | Well, that was too much to hope for, eh | ||
moritz | somehow I've never internalized HyperWhatever and/or found a good use case for it | 18:49 | |
18:49
brrt joined
|
|||
perlpilot | moritz: you and me both | 18:50 | |
BrokenRobot | me too | ||
kyclark | Can you merge Bags? | ||
Combine them? | 18:51 | ||
timotimo | sure | ||
with (+) should work | |||
BrokenRobot | m: my $bag1 = <a b c>.Bag; my $bag2 = <z y x>.Bag; say $bag1 (+) $bag2 | ||
camelia | rakudo-moar 5a4963: OUTPUT«bag(a, c, b, x, y, z)» | ||
moritz would have expected .push, much like Hash.push | |||
BrokenRobot | m: my $bag1 = <a b c>.Bag; my $bag2 = <z y x>.Bag; say $bag1 ⊎ $bag2 | ||
camelia | rakudo-moar 5a4963: OUTPUT«bag(a, c, b, x, y, z)» | ||
moritz | oh wait, is Bag a value type? | 18:52 | |
BrokenRobot | m: my $bag1 = <a b c>.Bag; my $bag2 = <z y x>.Bag; say $bag1.puhs: $bag2 | ||
camelia | rakudo-moar 5a4963: OUTPUT«Method 'puhs' not found for invocant of class 'Bag' in block <unit> at <tmp> line 1» | ||
BrokenRobot | m: my $bag1 = <a b c>.Bag; my $bag2 = <z y x>.Bag; say $bag1.push: $bag2 | ||
camelia | rakudo-moar 5a4963: OUTPUT«Cannot resolve caller push(Bag: Bag); none of these signatures match: (Any:U \SELF: |values is raw) in block <unit> at <tmp> line 1» | ||
moritz | m: my $bag1 = <a b c>.Bag; my $bag2 = <z a b>; say $bag1 (+) $bag2 | ||
camelia | rakudo-moar 5a4963: OUTPUT«bag(a(2), c, b(2), z)» | ||
perlpilot | Bags are immutable | ||
moritz | ok | ||
TimToady | BagHash is mutable | ||
moritz | then the operator is more sensible | ||
BrokenRobot | m: my $bag1 = <a b c>.BagHash; my $bag2 = <z y x>.BagHash; say $bag1.push: $bag2 | 18:53 | |
camelia | rakudo-moar 5a4963: OUTPUT«Cannot resolve caller push(BagHash: BagHash); none of these signatures match: (Any:U \SELF: |values is raw) in block <unit> at <tmp> line 1» | ||
TimToady | m: my $bag1 = <a b c>.BagHash; $bag1<b>++; say $bag1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c, b(2))» | ||
18:54
BrassLantern left
|
|||
BrokenRobot | m: my $bag1 = <a b c>.BagHash; $bag1<b c>++; say $bag1 | 18:56 | |
camelia | rakudo-moar 5a4963: OUTPUT«Cannot resolve caller postfix:<++>(List); none of these signatures match: (Mu:D $a is rw) (Mu:U $a is rw) (Int:D $a is rw) (int $a is rw) (Bool:U $a is rw) (Bool:D $a is rw) (Num:D $a is rw) (Num:U $a is rw)…» | ||
BrokenRobot | tsk trsk | 18:57 | |
perlpilot | you needed more >> | ||
BrokenRobot | Needs moar DWIMM | ||
m: my $bag1 = <a b c>.BagHash; $bag1<b c>>>.&postfix:<++>; say $bag1 | |||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c(2), b(2))» | ||
moritz | m: my $bag1 = <a b c>.BagHash; $bag1<b c>>>++; say $bag1 | 18:58 | |
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c(2), b(2))» | ||
BrokenRobot | :o | ||
perlpilot | Welcome to Perl 6 ;) | 18:59 | |
BrokenRobot | :) | ||
perlpilot | you can put some . in there if it makes you feel better ... | ||
m: my $bag1 = <a b c>.BagHash; $bag1<b c>.>>++; say $bag1 | |||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c(2), b(2))» | ||
perlpilot | m: my $bag1 = <a b c>.BagHash; $bag1<b c>.>>.++; say $bag1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c(2), b(2))» | ||
moritz | or use the non-texas version of >> | ||
moritz is currently keyboard-challenged (no compose key configured) | 19:00 | ||
BrokenRobot | m: my $bag1 = <a b c>.BagHash; $bag1<b c>»++; say $bag1 | ||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(a, c(2), b(2))» | ||
kyclark | My particular exercise is for genomics students to count the GC content of a DNA file. It's easy so far to go line-by-line in a file and get a Bag for each: | 19:01 | |
moritz | I should patch irssi to accept vim digraphs in the input box | ||
perlpilot | moritz: If you've got vim, you don't need a compose key :) | ||
kyclark | m: say 'CACCAATTATGGTGTATGA'.comb.Bag | ||
camelia | rakudo-moar 5a4963: OUTPUT«bag(C(3), G(4), T(6), A(6))» | ||
BrokenRobot | :) | ||
kyclark | But now I want to add that to a counter. Maybe just a regular hash? | ||
BrokenRobot | kyclark: see examples just above :) | 19:02 | |
m: my $dna = say 'CACCAATTATGGTGTATGA'.comb.Bag; $dna<T> += 2; say $dna | |||
camelia | rakudo-moar 5a4963: OUTPUT«bag(C(3), G(4), T(6), A(6))Type Bool does not support associative indexing. in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
BrokenRobot | m: my $dna = 'CACCAATTATGGTGTATGA'.comb.BagHash; $dna<T> += 2; say $dna | ||
camelia | rakudo-moar 5a4963: OUTPUT«BagHash.new(C(3), G(4), T(8), A(6))» | ||
19:02
jjido joined
|
|||
moritz | I'm somwhat disappointed that those examples don't involve 'GATTACA' | 19:03 | |
perlpilot | heh | ||
BrokenRobot | that's such a good movie ♥ | ||
Wait.. is that why it's called Gattaca? | |||
perlpilot | ding! | ||
BrokenRobot | hah :D | 19:04 | |
moritz | I'm pretty sure it's no coincidence that it's spelled by those four letters :-) | ||
mst cackles | |||
BrokenRobot: took me years to get it too | |||
BrokenRobot | :) | ||
hoelzro | jjj | 19:06 | |
geekosaur tends to notice that anymore | |||
kyclark | This is the best I can manage so far: pastie.org/10893253 | ||
Sorry, just repasted with example data. In a FASTA format, the sequence headers are noted with ">" at the beginning of a line | 19:07 | ||
geekosaur | it helps that half the cancer-genome organizations make sure their initials are in that set, so I see them every other day or so while perusing the medical news on sciencedaily... | ||
kyclark | Earlier I'd mentioned that this works: $file.IO.lines ==> grep * !~~ /^\>/ ==> my @lines; | ||
I feel like I ought to manage a purely functional one-liner that would screen out headers, ".comb" the lines, and create a Bag | 19:08 | ||
perlpilot | kyclark: Maybe you could write a FASTA parser module for others to use :) | ||
kyclark | I'd started on that road, but the BioPerl folks already made a P6 parser | ||
It's very niiice. | 19:09 | ||
BrokenRobot | kyclark: my take on it: gist.github.com/zoffixznet/118ee58...87ffc328ab | 19:13 | |
kyclark | Yep, that's it. | 19:14 | |
BrokenRobot | I guess second grep can just be .grep('G'|'C') | ||
kyclark | That new regex is confusing to me. | ||
moritz | you could also do something fancy like: | ||
BrokenRobot | kyclark: {!/^\>/} is a code block that's basically { $_ !~~ /^\>/ } | 19:15 | |
kyclark | When the feeders completely work, that will be amazing. | ||
moritz | my $bag = [(+)] $file.IO.lines.grep(none(/^'>'/)).map(*.comb.Bag); | ||
BrokenRobot | With the snorgasbord of methods, I still SAGN for negative grep | 19:16 | |
.ngrep: /foo/ <=> .grep: { !/foo/ } | |||
Or may be not :) | |||
moritz | m: my $bag = bag(<a b c d a b a c a d a b>); say $b<a b>:p | 19:17 | |
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$b' is not declaredat <tmp>:1------> 3g = bag(<a b c d a b a c a d a b>); say 7⏏5$b<a b>:p» | ||
moritz | m: my $bag = bag(<a b c d a b a c a d a b>); say $bag<a b>:p | ||
camelia | rakudo-moar 5a4963: OUTPUT«(a => 5 b => 3)» | ||
kyclark | moritz nailed it too. Now I need to read up on "none" | ||
moritz | kyclark: hint: it's a Junction | 19:18 | |
BrokenRobot | huggable: Junction | ||
huggable | BrokenRobot, Logical superposition of values: docs.perl6.org/type/Junction | ||
BrokenRobot | I also have slides: tpm2016.zoffix.com/#/30 (press Right key for two more) | 19:19 | |
kyclark | $file.IO.lines.grep({!/^\>/})>>.comb.flat.Bag works too | 19:21 | |
BrokenRobot | $file.IO.lines.grep({!/^\>/}).joib.comb.Bag | 19:22 | |
*join | |||
kyclark | $file.IO.lines.grep({!/^\>/}).map(*.comb).flat.Bag | ||
BrokenRobot | kyclark: » is autothreaded tho :) | ||
kyclark | Mmmm, parallelization | 19:23 | |
BrokenRobot | kyclark: yeah.. NIY but will be | ||
kyclark | Map is not, won't be? | ||
BrokenRobot | won't be | ||
awwaiid | .race.map is though :) | ||
BrokenRobot | No point | ||
and ».&({ codes }) | |||
kyclark | Feeders will be, too, right? | ||
BrokenRobot | Right | ||
19:23
Actualeyes left
|
|||
BrokenRobot | And Junctions too | 19:24 | |
awwaiid | you can use .race now, btw | ||
BrokenRobot | FSVO use :) | ||
awwaiid | well. last I knew | ||
BrokenRobot | Tho jnthn++ will be fixing it soon, IIRC | ||
awwaiid | ah. I think I got it to work in some cases | ||
kyclark | What is "race"? Docs? | ||
$file.IO.lines.grep({!/^\>/}).race | |||
HyperSeq.new | |||
BrokenRobot | kyclark: search for "race" | ||
kyclark: "hyper" is related to it | 19:25 | ||
awwaiid | docs.perl6.org/routine/race -- @list.race returns a fancy thing that runs in parallel | ||
BrokenRobot | I also have slides :) tpm2016.zoffix.com/#/26 | ||
awwaiid | jnthn.net/papers/2015-yapcasia-concurrency.pdf | ||
ya | 19:26 | ||
BrokenRobot: oh are you Zoffix now? | |||
BrokenRobot | m: sleep 1 for ^4 .race: :batch; say now - INIT now; | ||
camelia | rakudo-moar 5a4963: OUTPUT«1.00596108» | ||
awwaiid | I guess I should just assume everyone is Zoffix going forward | ||
BrokenRobot | kyclark: ^ four 1-second sleeps run in just 1 second | ||
DrForr_ | WE ARE ALL ZOFFIX. | 19:27 | |
kyclark | Uh, OK. I need to read. | ||
awwaiid | because you're supposed to be sleep()/$work? | 19:28 | |
BrokenRobot | :D | ||
awwaiid | heh | ||
geekosaur | of course now you need a new identity... | 19:29 | |
DrForr_ | n/ick AlanSmithee | ||
BrokenRobot | Haha :) | ||
moritz | nah, his wife thinks he is having an affair, and his affair thinks he is with his wife, and he wants to to keep up the illusion to both :-) | ||
19:30
Bodger1234 left
19:31
wamba left
|
|||
mst | long standing traditional approach for mathematicians | 19:32 | |
dogbert17 | o/ #perl6 | ||
DrForr_ | Assume a spherical mistress. | ||
mst | I don't tend to do it that way, it would deprive the two women of the option to go on a date with each other instead and plot against me | ||
BrokenRobot | AlanSmithee? For movies too | ||
Oh the wife thing | |||
dogbert17 | how many people have installed CSS::Sass? It doesn't work for me :( | 19:33 | |
BrokenRobot | dogbert17: \o | ||
Oh :( | |||
dogbert17: what's the error? | |||
dogbert17: you *are* talking about the Perl 5 module, right? | |||
19:33
zakharyas joined
|
|||
dogbert17 | BrokenRobot: Error: Can't load '/root/.cpanm/work/1467139323.24978/CSS-Sass-3.3.4/blib/arch/auto/CSS/Sass/Sass.so' for module CSS::Sass: /root/.cpanm/work/1467139323.24978/CSS-Sass-3.3.4/blib/arch/auto/CSS/Sass/Sass.so: undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE at /usr/lib/perl/5.18/DynaLoader.pm line 184. | 19:33 | |
tried to install with cpanm | 19:34 | ||
BrokenRobot | dogbert17: why is it in /root though :/ Did you install Mojolicious the same way? | ||
dogbert17 | BrokenRobot: yes | 19:35 | |
19:35
addison joined
|
|||
dogbert17 | became desperate :) | 19:35 | |
BrokenRobot | 1 sec | ||
dogbert17: let's move to #perl, 'cause I've no idea why that error exists :) | 19:36 | ||
dogbert17 | ok | ||
19:39
vendethiel joined,
huggable left
19:40
huggable joined,
khw joined,
hankache joined
19:41
darutoko left
|
|||
moritz | seems to be related to using the wrong linker (gcc instead of g++ or something like that) | 19:41 | |
hankache | hello #perl6 | 19:42 | |
moritz | \o hankache | ||
hankache | hiya moritz | ||
moritz: I am trying the vps from OVH | 19:43 | ||
just did rakudobrew build moar on a fresh ubuntu server and got the following error when lauching the REPL: | 19:44 | ||
Couldn't load Rakudo REPL.pm: MVMContext representation does not support elems | |||
any ideas what this is? | 19:45 | ||
hoelzro | hankache: it's a recent breakage | 19:46 | |
due to 5a4963f | |||
it has something to do with pseudo stashes and a change to iterators, afaict | 19:47 | ||
dalek | c: 4cca4f5 | (Zoffix Znet)++ | / (2 files): Make SASS processor optional to avoid extra deps |
||
hankache | hoelzro ah no worries then. I feared it has something to do with the config | 19:48 | |
BrokenRobot | dogbert17: try that ^ | 19:49 | |
dogbert17 | BrokenRobot: you're fast :) | ||
BrokenRobot | That's what she... oh wait | ||
moritz | hankache: try to build the last release | 19:50 | |
BrokenRobot | dogbert17: does it work? I need to relocate; just want to make sure you're set before I depart :) | ||
hankache | moritz will do | ||
d^_^b | is it possible to use promises and run/shell? where each run/shell will create a promise and be done independently | 19:51 | |
BrokenRobot | d^_^b: I think that's what Proc::Async is for | ||
d^_^b: docs.perl6.org/type/Proc::Async | |||
dogbert17 | BrokenRobot: perhaps I have messed up my system ... but the following shows up | ||
Mojolicious version 6.66 required--this is only version 6.58 at app.pl line 4. | |||
19:51
kyclark left
|
|||
BrokenRobot | dogbert17: 1 sec | 19:51 | |
dalek | c: f5eebe0 | (Zoffix Znet)++ | app.pl: Reduce Mojolicious prereq |
19:52 | |
BrokenRobot | dogbert17: try that | ||
cpanm -vn Mojolicious::Plugin::AssetPack | |||
d^_^b | BrokenRobot: good call | 19:53 | |
BrokenRobot | d^_^b: this is my script that restarts huggable. You'd just make many of them: gist.github.com/zoffixznet/01c5201...84524ddd3c | ||
s/them/Proc::Asyncs/; | |||
for all your commands | 19:54 | ||
dogbert17 | BrokenRobot: it starts :) | ||
BrokenRobot | great | ||
That'll be $150 in support fees plus tax :) | |||
dogbert17 | BrokenRobot++ | ||
BrokenRobot & | |||
dogbert17 | BrokenRobet: what do you think about gist.github.com/dogbert17/ad42869f...022b40d57c | 19:55 | |
19:56
jjido_ joined
|
|||
BrokenRobot | dogbert17: no idea about that topic :) | 19:56 | |
19:56
jjido left
19:57
kyclark joined
|
|||
dogbert17 | BrokenRobot: maybe I should ask sexy-coder-girl instead :) | 19:57 | |
BrokenRobot | She doesn't know either :) | ||
dogbert17 | moritz might know if he's around | 19:58 | |
btw, have any books ever been released about Mojolicious? | 19:59 | ||
moritz | dogbert17: I don't think app_lifetime => False means that the process exit waits for the stread | ||
hum | 20:00 | ||
but that's what it says in the docs for new() | |||
dogbert17 | moritz: that's worrying since I more or less stole that text from the Thread.new method | ||
everyone is so fast on the keyboard :) | |||
moritz | m: Tread.new(code => { sleep 42 }).run() | ||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: Tread used at line 1. Did you mean 'Thread'?» | ||
moritz | m: Thread.new(code => { sleep 42 }).run() | ||
jnthn | app_lifetime => False should mean the VM doesn't exit until it has joined the thread. | ||
20:01
acrussell left
|
|||
jnthn | Note that all thread pool threads are app_lifetime => True | 20:01 | |
camelia | rakudo-moar 5a4963: OUTPUT«(timeout)» | ||
moritz | m: Thread.new(code => { sleep 42 }, :app_lifetime).run() | ||
camelia | ( no output ) | ||
moritz | jnthn: oh, that explains a lot | ||
dogbert17: ok, then the docs are fine | |||
dogbert17 | jnthn: default when creating a Thread seems to be False | ||
moritz | right | 20:02 | |
it's just that the thread pool always passes :app_lifetime | |||
jnthn | dogbert17: Yes, matches my recollection of how I did it | ||
dogbert17 | moritz and jnthn: thx for the wisdom | 20:03 | |
I'll commit then | |||
jnthn | The thread pool is a higher level construct used to schedule stuff, and generally something should always be waiting on that stuff (if it cares) to either get its result or at the very least process its errors. | ||
dogbert17 | agreed | 20:04 | |
d^_^b | BrokenRobot: cant look mobile. got it working will check it out later. thanks | 20:06 | |
dogbert17 | while I have your attention, there are two thread methods that seem to do the same thing, i.e. finish and join. Any reason why? | ||
20:06
jjido_ left,
jjido joined
|
|||
jnthn | dogbert17: Probably because I called it .join because that's what the thing is called everywhere else, and somebody was like "omg I'm SO confused with joining an array!!1!" and so we ended up with finish also. | 20:07 | |
In hindsight I should be less diplomatic about API design sometimes. :P | 20:08 | ||
20:08
dvinciguerra_ left
|
|||
jnthn | Or less democratic, at least :) | 20:09 | |
dalek | c: cd72a4c | (Jan-Olof Hendig)++ | doc/Type/Thread.pod: Added docs for Thread.app_lifetime. moritz++ jnthn++ zoffix++ |
||
dogbert17 | jnthn: interesting, maybe I should doc join as well then | 20:10 | |
jnthn | dogbert17: Yeah, you can. Though `join` is what anyone used to programming with low-level threads will already expect, tbh. | ||
dogbert17 | jnthn: the more docs the merrier :) | 20:11 | |
jnthn | Oh, I'm not saying don't doc it, just that in my mind its existence is more justified than .finish :) | ||
(We'll keep both for the long haul, I've no doubt.) | 20:12 | ||
dogbert17 | jnthn: I'll add it later tonight :) | ||
jnthn | dogbert17++ | 20:15 | |
20:19
itaipu joined
20:22
ChoHag left
20:23
kyclark left
20:26
grondilu left,
rgrinberg left
20:30
_mg_ joined,
setty1 left,
hankache left
20:31
daxim left
20:33
CIAvash left,
kyclark joined,
pmurias left
20:34
daxim joined
20:35
jjido left
20:37
jjido joined
20:39
yqt joined
20:40
molaf left
|
|||
Xliff | m: my $a = 1; say qq<a = $a>; | 20:43 | |
camelia | rakudo-moar 5a4963: OUTPUT«a = 1» | ||
kyclark | Is there any better way to do this (sort a list by the lengths of the members)? | ||
m: say <the a doggie cat an>.sort({$^a.chars <=> $^b.chars}) | |||
camelia | rakudo-moar 5a4963: OUTPUT«(a an the cat doggie)» | ||
hoelzro | kyclark: you can do @a.sort(*.chars) | ||
kyclark | Yes, OK -- but why? :-) | 20:44 | |
hoelzro | if you give sort a unary function, it applies the function to the elements and uses the results for comparisons | ||
kyclark | "sort" needs a sub, so exactly how is "*.chars" used? | ||
hoelzro | *.chars is a sub | 20:45 | |
perlpilot | *.chars is a unary sub | ||
hoelzro | Whatever (*) is amazing | ||
kyclark | so it automatically applies that to $^a and $^b? | ||
perlpilot | hoelzro: until it's confusing ;) | ||
kyclark: something like that. (There's no $^a and $^b, just a single $_) | |||
hoelzro | *.chars is sort for -> $a { $a.chars } | 20:46 | |
s/sort/short/ | |||
perlpilot | sort(*.chars) is ... what hoelzro said | ||
20:47
itaipu left
20:48
colomon left,
itaipu joined
20:49
zakharyas left
|
|||
kyclark | Is there a built-in or de facto Pod::Usage-type thingie? | 20:49 | |
perlpilot | There's not one for Pod that I know of, but rakudo can make a usage from the signature(s) of your MAIN | 20:50 | |
20:52
brrt left
|
|||
kyclark | "If &by accepts only one argument, the list elements are sorted according to by($a) cmp by($b) . The return values of &by are cached, so that &by is only called once per list element." | 20:52 | |
Got it! | |||
perlpilot | kyclark: Are you familiar with the Schwartzian Transform? | 20:53 | |
kyclark | Yes. | ||
perlpilot | kyclark: another way to think of it is that it automatically does that for you | ||
kyclark | Yes, that's great. Thanks. | ||
As for the MAIN, how could I describe that I want at least two arguments? | 20:54 | ||
That is, in the generated usage statement? | |||
E.g., for a sorting program. | |||
20:54
jjido left
|
|||
kyclark | sub MAIN (@args where @args.elems >= 2) { | 20:55 | |
FROGGS | m: sub MAIN($foo, $bar) { } | ||
yoleaux | 06:22Z <Xliff> FROGGS: 08findnodes.t finished and all tests passing! Expect a PR, soon. | ||
camelia | rakudo-moar 5a4963: OUTPUT«Usage: <tmp> <foo> <bar> » | ||
FROGGS | m: sub MAIN($a, $b, *@more) { } | 20:56 | |
camelia | rakudo-moar 5a4963: OUTPUT«Usage: <tmp> <a> <b> [<more> ...] » | ||
FROGGS | <tmp> is the program name here | ||
20:56
jjido joined
|
|||
kyclark | Yes, sweet. | 20:57 | |
perlpilot | m: sub MAIN( [$a, $b, *@_] ) { } # curious | ||
camelia | rakudo-moar 5a4963: OUTPUT«Usage: <tmp> <Positional> » | ||
20:58
TEttinger joined
|
|||
kyclark | perlpilot, what is it you're describing in the signature? | 20:59 | |
FROGGS | it unpacks to to the stuff in [ ] | 21:00 | |
kyclark | How would you access what you described as *@_? | ||
FROGGS | m: sub MAIN(*@more [$foo, $bar, *@_]) { say @_ }; MAIN 1, 2, 3, 4 | ||
camelia | rakudo-moar 5a4963: OUTPUT«[3 4]Usage: <tmp> [<more> ...] » | ||
FROGGS | m: sub MAIN(*@more [$foo, $bar, *@_]) { say @_ }; MAIN 1 | 21:01 | |
camelia | rakudo-moar 5a4963: OUTPUT«Too few positionals passed; expected at least 2 arguments but got only 1 in sub-signature of parameter @more in sub MAIN at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
FROGGS | the error message explains pretty well what [] is there | ||
I love it :o) | |||
kyclark | Yes! That rocks. | ||
21:02
_mg_ left
|
|||
FROGGS | gnight | 21:03 | |
21:03
FROGGS left
|
|||
Xliff | First time hes been here in days and I miss him by ----><----- | 21:05 | |
21:06
jjido left,
rgrinberg joined,
jjido joined
|
|||
Xliff | There is definitely an endless loop issue related to type checking in rakudo that might be exposed by NativeCall | 21:07 | |
However for the life of me I can't golf a concise use case. I just run into it when working on p6-XML-LibXML | |||
If anyone is interested in seeing it, you can check out github.com/Xliff/p6-XML-LibXML.git and switch to the 08elements branch. Then "perl6 -Ilib t/06leements.t" | 21:11 | ||
21:13
jjido left
21:14
kyclark left
21:15
jjido joined
21:16
kyclark joined,
tlvb left,
tlvb joined
21:17
kyclark left
21:18
kyclark joined
|
|||
Zoffix | moritz, I saw you on the road today: i.imgur.com/0x6Hv9l.jpg | 21:20 | |
:P | |||
perlpilot | There's a "moritz" car dealership near here. I see cars with his name on them all the time. | 21:21 | |
21:22
tlvb left
21:23
tlvb joined,
tlvb left
|
|||
Xliff | Brickyard Way, Zoffix? | 21:24 | |
21:24
mcmillhj left
|
|||
Zoffix | Yeah... it's a way... to um... the brickyard :P | 21:25 | |
Xliff | It's on the street sign in your photo! :P | 21:28 | |
Xliff is now playing: Jonny L - Further | |||
\m/...(>.<)…\m/ | 21:29 | ||
Zoffix | Never heard of 'im :) | ||
And the "revolution will not be televised"... that I "got" last time was because Bernie Sanders supporters use it not because of some song or whatver it was :) | 21:30 | ||
Though it's nice to hear a song with a real solo for a change youtu.be/lJuSZ6c1HYg?t=3m47s | 21:31 | ||
Xliff | LOL! | ||
Zoffix | They don't make them like they used to anymore :) | ||
Xliff | I was referring to the latter of course. | ||
Zoffix | :) | ||
Xliff | Nice to know Sanders supporters know enough about history to "lift" from it. | ||
Zoffix | :) | 21:32 | |
21:32
ptolemarch left
|
|||
perlpilot | Zoffix: is this where the picture was taken (roughly) ? www.google.com/maps/place/Brickyar...79.7802226 | 21:32 | |
Xliff | Zoffix: In case you wanna hear what I referenced earlier www.youtube.com/watch?v=utLprz9vJ9...eadRecords | 21:33 | |
perlpilot | If so ... I'm having trouble finding that brickyard ;) | ||
21:33
nic__ joined
|
|||
nebg | hello everyone... i'm using vim and gvim as editor for vim... i would like to know if there is some automcompletion feature or what do you use to write perl ? since i installed perl-support as plugin and it's ok but doesn't have autocompletion feature for methods in a package... and i tried perl omnicompletion... but it just doesn't work... can somebody help me or give me some suggestions about it ? | 21:33 | |
21:33
nic__ is now known as nicq20
|
|||
Xliff | ROFLMAP perlpilot. | 21:33 | |
Look at the street sign. | |||
Zoffix | perlpilot, yeah that's the place and no there's no brickyard. A school on one end and retirement home on the other | ||
Xliff | It's like...right in front of you when you open that photo. | ||
Zoffix | perlpilot, dammit! you exposed my lie! :D | 21:34 | |
Xliff | \m/...(>.<)...\m/ | ||
Zoffix | perlpilot, did you find that spot because you knew I lived in Brampton (or Canada) already or using just the pic alone? | ||
perlpilot | nebg: you probably want something like github.com/thoughtstream/Damian-Co...-Vim-Setup | ||
Zoffix: pic alone and some educated guessing. | 21:35 | ||
nicq20 | nbeg: Personally, I use Atom. Has some good Perl6 modules for it. | ||
oops. | 21:36 | ||
perlpilot | Zoffix: plus with google maps it took me like 30 seconds to find a vantage point where I could go "yep, that looks like the place" | ||
Xliff | perlpilot: Here... try this one. www.google.com/maps/@43.7008734,-7...312!8i6656 | ||
Zoffix | :) | ||
scary | |||
nicq20 | nebg: Personally, I use Atom. Has some good Perl6 modules for it. atom.io | ||
21:39
kid51 joined
|
|||
perlpilot | Zoffix: what made me even try was I accidentally clicked on the picture and it zoomed in and then I was musing over the mythical "enhance" function you always see in TV and movies and then I thought ... "how hard would it be to find this location using just google maps and what's in the image" | 21:40 | |
Plus there weren't an onerus number of "Brickyard Way"s in google maps :) | 21:41 | ||
Xliff | LOL! | ||
perlpilot | (of course, I checked the EXIF data first to see if would be that easy ;) | 21:42 | |
nebg: also, there's this talk from the recent perl conference: www.youtube.com/watch?v=9u6O0dLuqhI | 21:45 | ||
nicq20: maybe you should look at that talk too :) | |||
21:45
jjido left
21:46
jjido_ joined
|
|||
perlpilot is totally scatter-brained right now .... must be time to go home | 21:46 | ||
nebg | why people on perl5 channel is so arrogant while here it is so nice ? | ||
Xliff | Ah EXIF. People tag their photos and assume that such data won't be used against them. :/ | ||
nebg | just a joke obviously | ||
perlpilot | nebg: which part? | 21:47 | |
nebg | the first one :) | 21:48 | |
but not too much a joke :) | |||
21:48
firstdayonthejob joined
|
|||
perlpilot | nebg: well, it's more true than not, so it's hard to tell. | 21:48 | |
hobbs | in that it's rude and not funny :) | ||
nebg | hobbs, perlpilot yeah it's true... so even you noticed that right ? | 21:49 | |
i was thinking i was the only one | |||
kyclark | Help me understand this: | ||
grep 'c', <a b c d c> | |||
m: say grep 'c', <a b c d c> | |||
camelia | rakudo-moar 5a4963: OUTPUT«(c c)» | ||
kyclark | m: say grep True, (True, False, False) | ||
camelia | rakudo-moar 5a4963: OUTPUT«Potential difficulties: Smartmatch against True always matches; if you mean to test the topic for truthiness, use :so or *.so or ?* instead at <tmp>:1 ------> 3say grep7⏏5 True, (True, False, False)Cannot use Bool as Matcher with…» | ||
kyclark | Actually, my REPL blows up | ||
perlpilot | nebg: you'll note that I (among others) are also on #perl. I'm not any different on this channel than on the other (at least I don't think I am. It's hard to self assess sometimes) | 21:50 | |
kyclark | m: say grep {False}, (True, False) | ||
camelia | rakudo-moar 5a4963: OUTPUT«()» | ||
nebg | perlpilot, i don't know that's my impression... | ||
they don't take it easy... | 21:51 | ||
perlpilot | nebg: so you may just be noticing that there's a greater quantity of arrogant people or nice people. #perl has been around far longer and so has had far more time to collect many different people | ||
nebg: maybe #perl6 just isn't "popular enough" to garner enough arrogant people. I don't know. | |||
nebg | perlpilot, yeah it my be :) XD | ||
hobbs | or maybe, making that kind of judgment after 2 minutes is an insanely bad idea. :) | 21:52 | |
perlpilot | nebg: #perl6 does encourage niceness though. And I like to think that we're biasing the community that way a little bit. Only time will tell. | ||
geekosaur | perlpilot, if it were just number of people, #haskell wouldn't be one of the nicest channels on freenode | ||
you don't just need people, you need a sense of community and a consensus on how that community should be encouraged to behave | 21:53 | ||
perlpilot | geekosaur: Larry founded the Perl 5 community too. I don't think he was "more arrogant" or something in the past to cause that community to be harsher than this one. | 21:54 | |
geekosaur: yes, I know it's not all his fault :) | |||
21:54
jjido_ left,
sufrostico joined
|
|||
nebg | perlpilot, yes... perl5 anytime i ask something... it's like risking a ban... always people flaming me... and telling me to read the doc... the fact is that i'm a noob and many times i just need a small advice and can't understand the doc... it seems they don't contemple noobs | 21:55 | |
21:55
jjido joined
21:56
DarthGandalf left
|
|||
gfldex | kyclark: see github.com/rakudo/rakudo/blob/nom/...ds.pm#L690 | 21:56 | |
21:57
DarthGandalf joined,
rindolf left
|
|||
perlpilot | geekosaur: I think there's a tendency for people with big brains to lean towards egoism and pedanticism and harshness and it takes real concerted effort to keep things from heading that direction. Maybe #perl6 has had more effort in that regard. (#haskell too) | 21:58 | |
21:58
lichtkind left
|
|||
gfldex | m: my &m = my method ::(Any:D){ dd %_ }; m(42, a=>1); | 21:59 | |
camelia | rakudo-moar 5a4963: OUTPUT«{:a(1)}» | ||
perlpilot | now I *know* it's time for me to go home. :-) | ||
gfldex | we don | ||
we don't doc %_ :( | |||
kyclark | gfldex, so I can't grep for a Bool? | ||
21:59
skids left
|
|||
perlpilot | Everybody: have an awesome rest of your day and week! | 21:59 | |
perlpilot *poof* | |||
22:00
perlpilot left
|
|||
gfldex | kyclark: not on the buildin types | 22:00 | |
kyclark | This doesn't work, either, but is it closer? | 22:02 | |
m: grep * == True, (True, False, False) | |||
camelia | ( no output ) | ||
gfldex | m: sub s { dd @_ }; s(1,2,3); | ||
camelia | rakudo-moar 5a4963: OUTPUT«[1, 2, 3]» | ||
gfldex | i don't think we doc that either | ||
m: dd( grep * == True, (True, False, False) ) | |||
camelia | rakudo-moar 5a4963: OUTPUT«(Bool::True,).Seq» | ||
kyclark | Here's what I'm trying. Given two strings, find the characters that are different. | 22:03 | |
22:03
RabidGravy left,
firstdayonthejob left
|
|||
kyclark | m: my $a = "foo"; my $b = "bar"; my @pairs = $a.comb.list Zeq $b.comb.list; | 22:03 | |
camelia | ( no output ) | ||
kyclark | m: my $a = "foo"; my $b = "bar"; my @pairs = $a.comb.list Zeq $b.comb.list; say @pairs; | ||
camelia | rakudo-moar 5a4963: OUTPUT«[False False False]» | ||
kyclark | Sorry... | 22:04 | |
m: my $a = "foo"; my $b = "boo"; my @pairs = $a.comb.list Zeq $b.comb.list; say @pairs; | |||
camelia | rakudo-moar 5a4963: OUTPUT«[False True True]» | ||
gfldex | m: my $s1 = "hello world"; my $s2 = "hello camelia"; dd $s1.comb (-) $s2.comb; | ||
camelia | rakudo-moar 5a4963: OUTPUT«set("r","w","d")» | ||
kyclark | In my case, I'm looking to teach students to find SNPs (single nucleotide polymorphisms), so knowing the position is important, not just the number of mismatches. | 22:05 | |
22:05
firstdayonthejob joined
|
|||
gfldex | so you are looking for substrings that differ? | 22:05 | |
Xliff | "Read the docs" is not an polite answer for people who want to learn something, anymore | ||
Especially if it is accompanied by fire. | 22:06 | ||
Roamer` | gfldex, no, kyclark is looking for the exact positions where the character in that position in the first string is not the same as the character in that position in the second one | ||
gfldex, so "foo" and "boo" would report differences only in position 0 | |||
kyclark | In my @pairs, I can see the positions that mismatch (False). First I'd like to count how many False's there are. | ||
Xliff | Many times the quality, quantity or both of the docs may make specific answers hard to find. | ||
gfldex | so you want the index (as in Integer) where they differ? | ||
kyclark | BTW, "Zeq" is wicked pissa. | 22:07 | |
Knowing the positions of the False values would be perfect. | |||
It's common to show alignments of one sequence above another and symbols showing same/diff in between. | 22:08 | ||
So first I might ask students to identify how many SNPs are found between two sequences. Then perhaps print seq1, symbols showing matches, and seq2. | 22:09 | ||
Hence the idea for "grep False, @pairs | |||
Roamer` | m: my $a = "foo"; my $b = "boo"; my @pairs = $a.comb.list Zeq $b.comb.list; say @pairs; my @pairpairs = @pairs Z ^Inf; say @pairpairs.grep(*[0] == False).map(*[1]) | 22:10 | |
camelia | rakudo-moar 5a4963: OUTPUT«[False True True](0)» | ||
Roamer` | oof, okay, sorry | ||
m: my $a = "foo"; my $b = "boo"; my @pairs = $a.comb.list Zeq $b.comb.list; my @pairpairs = @pairs Z ^Inf; say @pairpairs.grep(*[0] == False).map(*[1]) | |||
camelia | rakudo-moar 5a4963: OUTPUT«(0)» | ||
Roamer` | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb.list Zeq $b.comb.list; my @pairpairs = @pairs Z ^Inf; say @pairpairs.grep(*[0] == False).map(*[1]) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 3)» | ||
kyclark | In Haskell, I do this: filter (==True) [True, False,True] | ||
jnthn | kyclark: I'm only half reading, but did yo use grep with :k ? | ||
Roamer` | kyclark, does this work for you? | ||
kyclark | jnthn, what is :k? | 22:11 | |
jnthn | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*[0], :k) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 3)» | ||
22:11
rgrinberg left
|
|||
jnthn | kyclark: Short for "keys" | 22:12 | |
Xliff | jnth++ # Faster than me again | ||
jnthn | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*[0], :kv) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 False 3 False)» | ||
jnthn | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*[0], :kp) | ||
camelia | rakudo-moar 5a4963: OUTPUT«Unexpected adverb 'kp' passed to grep on @pairs in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
jnthn | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*[0], :p) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(1 => False 3 => False)» | ||
jnthn | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*[0], :v) | ||
camelia | rakudo-moar 5a4963: OUTPUT«(False False)» | ||
Xliff | For arrays :k == index | ||
jnthn | :v is the default (give me the matched values) | ||
And :k means give me the keys (indices) that matched | 22:13 | ||
kv is a list of the two alternating, and p is pairs | |||
Note that it's a pun on slice adverbs | |||
gfldex | m: my $s1 = "hello world"; my $s2 = "hello camelia"; my Str $target; for $s1.comb Z, $s2.comb -> [$l, $r] { $target ~= $l eq $r ?? $l !! $l.uc }; say $target | ||
camelia | rakudo-moar 5a4963: OUTPUT«hello WORLD» | ||
jnthn | m: my @a = 1..10; my @b = 2, 5, 1; say @a[@b]:p | ||
camelia | rakudo-moar 5a4963: OUTPUT«(2 => 3 5 => 6 1 => 2)» | ||
jnthn | For example | 22:14 | |
Roamer` | I guess it'll take me some *more* time to appreciate all the ways in which Perl 6 extends the idioms I'm so used to in Perl 5 :) | 22:17 | |
kyclark | jnthn, that's quite interesting. I've been sitting here thinking. I can't figure out the first arg to grep !*[0] | ||
gfldex | m: my $s1 = "hello world"; my $s2 = "hello camelia"; my Str $target; for $s1.comb Z, $s2.comb -> [$l, $r] { $target ~= $l eq $r ?? " " !! $r }; say ($s1, $target, $s2).join("\n"), | 22:18 | |
camelia | rakudo-moar 5a4963: OUTPUT«hello world camelhello camelia» | ||
kyclark | Roamer`, yours worked, but it's a hella lotta work. I can't imagine teaching that to beginner biologist hackers. | ||
Roamer` | kyclark, it's the "whatever" thing - anything that accepts a block of code with a single argument (grep, map, sometimes sort), also accepts an expression that has * (pronounced "whatever") where you would otherwise place the argument | 22:19 | |
gfldex | grep !*[0], same as (nearly) grep({not $_[0]}, | ||
Roamer` | kyclark, so grep(!*[0]) is equivalent to my grep(*[0] == False) is equivalent to grep { $_[0] == False } | ||
kyclark | But why treat the "thing" as an array? | 22:20 | |
Roamer` | ah, now that's a good question :) | 22:21 | |
m: use v6.c; my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep(!*, :k) | |||
camelia | rakudo-moar 5a4963: OUTPUT«(1 3)» | ||
Roamer` | just !* also works :) | ||
gfldex | m: my $a = "foox"; my $b = "feon"; my @pairs = $a.comb Zeq $b.comb; say @pairs.grep({dd $_ }, :kv) | 22:22 | |
camelia | rakudo-moar 5a4963: OUTPUT«Bool @pairs = Bool::TrueBool @pairs = Bool::FalseBool @pairs = Bool::TrueBool @pairs = Bool::False()» | ||
22:22
itaipu left
|
|||
Roamer` | so, yeah, the elements of the @pairs array are actually *not* pairs, they are booleans | 22:23 | |
aka ints | |||
so why does grep(!*[0]) work? | |||
kyclark | Yes, I should have chosen a better name | ||
m: my @pairs = (False, True, True); say @pairs.grep(!*) | 22:24 | ||
camelia | rakudo-moar 5a4963: OUTPUT«(False)» | ||
kyclark | m: my @pairs = (False, True, True); say grep !*, @pairs | ||
camelia | rakudo-moar 5a4963: OUTPUT«(False)» | ||
gfldex | m: say True[0] | ||
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
22:24
itaipu joined
|
|||
kyclark | Oh, hmm, the 2nd one doesn't work for me at home | 22:24 | |
gfldex | Bools are not Ints | ||
kyclark | m: True{False} | 22:26 | |
camelia | rakudo-moar 5a4963: OUTPUT«Type Bool does not support associative indexing. in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
gfldex | it's an enum that is declared very early in the settings | ||
kyclark | That blows up my REPL, BTW | ||
gfldex | they implement the role Enumeration (that we don't got doced yet) | 22:27 | |
Roamer` | yeah, well, I know that bools are enums, so enums are... what... something weird that has a pair aspect? | ||
okay, that's interesting | |||
...will it stay that way? :) or has it not been documented because it may actually change? :) | |||
gfldex | github.com/rakudo/rakudo/blob/nom/...eration.pm | 22:29 | |
i need to check roast | |||
there are no spectests for the role, so I wont add them to the docs | 22:30 | ||
22:30
Peter_R joined
|
|||
Roamer` | nice... so yesterday I was forcibly remined that a set is more like a hash than a list, today I learned that an enum is secretly a pair... it seems that this type system has turtl... err, types all the way down :) | 22:31 | |
(which is certainly not a bad thing) | |||
gfldex, yeah, keeping it as an implementation detail makes sense | |||
gfldex | to come back to why [0] works on enums. Pretty much all types got Any in their inheritance chain and as such can be turned into a list. | ||
actually there should be spec tests | 22:32 | ||
if you want to type check if you got an enum you need to match against Enumeration | 22:33 | ||
m: say True ~~ Enumeration, Bool ~~ Enumeration | |||
camelia | rakudo-moar 5a4963: OUTPUT«FalseFalse» | ||
gfldex | that might actually be a bug | ||
m: my enum E <:a(1) b>; say E ~~ Enumeration | 22:34 | ||
camelia | rakudo-moar 5a4963: OUTPUT«False» | ||
gfldex | that's an introspection hole (in my eyes) | 22:35 | |
dalek | c: 6b34606 | (Jan-Olof Hendig)++ | doc/Type/Thread.pod: Added docs for Thread.join |
||
kyclark | So, this works: | 22:37 | |
m: my $a = "foo"; my $b = "boo"; my @match = $a.comb Zeq $b.comb; my @bad = grep * == False, @match; say @bad; | |||
camelia | rakudo-moar 5a4963: OUTPUT«[False]» | ||
kyclark | How did I miss this before? | ||
Roamer` | kyclark, I thought you were also interested in the positions... | 22:39 | |
kyclark | That, too | ||
Roamer` | that's why I didn't suggest it back then | ||
(and also I wasn't looking in this window back when you asked camelia about grep True, I rejoined later) | |||
gfldex | m: my $s1 = "hello world"; my $s2 = "hello camelia"; my Str $target; for $s1.comb Z, $s2.comb -> [$l, $r] { $target ~= $l eq $r ?? " " !! $r }; say ($s1, $target, $s2).join("\n"); | ||
camelia | rakudo-moar 5a4963: OUTPUT«hello world camelhello camelia» | ||
gfldex | i'm pretty sure that is what you want | 22:40 | |
Roamer` | ah, that's nifty | 22:41 | |
22:41
nicq20 left
|
|||
kyclark | pastie.org/10893466 This basically does what I want. | 22:43 | |
Just repasted with sample in/output | 22:44 | ||
22:44
jjido left,
ZoffixLappy joined
|
|||
ZoffixLappy waves from the Damian Conway's talk :} | 22:45 | ||
gfldex | you may want to replace `say` with `put` | ||
kyclark | What is the difference? | ||
gfldex | say will truncate long outputs | 22:46 | |
kyclark | Now why would it do that? | 22:47 | |
22:47
jjido joined
|
|||
gfldex | say was cool before dd | 22:47 | |
ZoffixLappy | <gfldex> Bools are not Ints | ||
m: say True ~~ Int # they actually are an Int enum | |||
camelia | rakudo-moar 5a4963: OUTPUT«True» | ||
ZoffixLappy | kyclark, say is output for humans to read stuff. For more exact tool use put. say calls "gist" method :) | 22:49 | |
m: class Foo { method gist { "just brief stuff" }; method Str { "details" } }; say, put given Foo.new | |||
camelia | rakudo-moar 5a4963: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unsupported use of bare "say"; in Perl 6 please use .say if you meant $_, or use an explicit invocant or argument, or use &say to refer to the function as a nounat <tmp>:1------> 3tuff" }; method Str …» | ||
kyclark | OK, I thought "say" was just "print" + NL | ||
ZoffixLappy | m: class Foo { method gist { "just brief stuff" }; method Str { "details" } }; .say, .put given Foo.new | 22:50 | |
camelia | rakudo-moar 5a4963: OUTPUT«just brief stuffdetails» | ||
gfldex | .say is nice if you don't want log/debug output fill up your harddisk/screen | ||
ZoffixLappy | kyclark, only in Perl 5 :) | ||
Roamer` | kyclark, just for the record, if you only need @bad for the count, you could do something weird like say @matches.grep(* == False).iterator.count-only | ||
ZoffixLappy | welll. and other langs that do that I guess :) | ||
Roamer` | m: my @matches = (True, True, False, True, False); say @matches.grep(!*).iterator.count-only; | ||
camelia | rakudo-moar 5a4963: OUTPUT«Method 'count-only' not found for invocant of class '<anon|158132656>' in block <unit> at <tmp> line 1» | ||
ZoffixLappy | docs.perl6.org/routine/say | ||
Roamer` | m: use v6.c; my @matches = (True, True, False, True, False); say @matches.grep(!*).iterator.count-only; | 22:51 | |
camelia | rakudo-moar 5a4963: OUTPUT«Method 'count-only' not found for invocant of class '<anon|158132656>' in block <unit> at <tmp> line 1» | ||
Roamer` | err, what? it works for me here in 2016.06... | ||
22:51
addison left
|
|||
ZoffixLappy | Roamer`, there were changes with that recently :) | 22:51 | |
Roamer`, IIRC we're awaiting a change in MoarVM for that to work again | 22:52 | ||
kyclark | Roamer`, that is great to know. Thanks. | ||
gfldex | there was a bug that made .count-only go away, but may come back soon | ||
kyclark | Thanks for your patience and help! Laters. | 22:55 | |
22:55
kyclark left
22:56
kyclark joined,
kyclark left,
jack_rabbit joined
|
|||
gfldex | m: sub s { dd @_ }; dd &s.signature | 22:56 | |
camelia | rakudo-moar 5a4963: OUTPUT«:(*@_)» | ||
gfldex | m: sub s { dd @_, %_ }; dd &s.signature | 22:57 | |
camelia | rakudo-moar 5a4963: OUTPUT«:(*@_, *%_)» | ||
gfldex | now that's just cheating! | ||
Roamer` | :) | ||
jnthn | gfldex: It's actually been designed that way in S06 for donkeys years, iirc :) | 22:59 | |
Roamer` | okay, I'm off for the night... thanks for the patience and the insights from me, too! | ||
dalek | c: 43ac722 | (Zoffix Znet)++ | doc/Language/typesystem.pod: Improve :$attr shortcut docs |
||
ZoffixLappy | That's it. I've now made a commit to Perl 6 while at a Perl 6 talk :) | ||
ZoffixLappy is hardcore ^_^ | |||
gfldex | you are very commited to Perl 6 | 23:00 | |
ZoffixLappy | Well, I'm not playing with the full deck, but not yet committed :P | ||
23:01
jjido left
|
|||
ZoffixLappy | That commit isn't perfect though. The shortcut works with hashes too. I'm unsure what's the best place to document that stuff. | 23:01 | |
m: my $foo = 'foo'; my %h = :$foo; | 23:02 | ||
camelia | ( no output ) | ||
ZoffixLappy | m: my $foo = 'foo'; my %h = :$foo; say %h | ||
camelia | rakudo-moar 5a4963: OUTPUT«{foo => foo}» | ||
23:02
jjido joined
23:05
sortiz joined
|
|||
ZoffixLappy | damn. big crowd up in here :) | 23:05 | |
Yey Perl 6 \o/ | |||
sortiz | \o #perl6 | 23:06 | |
ZoffixLappy | \o | ||
23:06
itaipu left
|
|||
dalek | c: 5a75e16 | (Wenzel P. P. Peppmeyer)++ | doc/Language/functions.pod: doc automatic signatures for @_ and %_ |
23:08 | |
23:09
jjido left
23:10
firstdayonthejob left,
girafe left,
jjido joined
23:12
addison joined
23:13
cdg joined
23:21
labster left
23:22
skids joined
|
|||
ZoffixLappy | m: sub infix:<😸> { $^a ~ $^b }; say 'foo' 😸 'bar' 😸 'mer' | 23:23 | |
camelia | rakudo-moar 5a4963: OUTPUT«foobarmer» | ||
ZoffixLappy | Damian wanted this to be the concat op :) | ||
timotimo | is that some fancy unicode character? my terminal doesn't how it | 23:27 | |
23:28
mcsnolte left
|
|||
ZoffixLappy | .u 😸 | 23:28 | |
yoleaux | U+1F638 GRINNING CAT FACE WITH SMILING EYES [So] (😸) | ||
ZoffixLappy | Well, he just said "cat emoji" so I'm guessing there :P | ||
timotimo | oh! | 23:29 | |
fantastic | 23:30 | ||
23:33
tbrowder left
|
|||
ZoffixLappy | m: my %h = :foo; sub bar (%h) { say %h; %h<foo> = 42; say %h }; bar %h; say %h | 23:38 | |
camelia | rakudo-moar 5a4963: OUTPUT«{foo => True}{foo => 42}{foo => 42}» | ||
ZoffixLappy | This is pretty LTA :( | ||
"this" being ability to mutate the contents | 23:39 | ||
23:39
huggable left
23:40
huggable joined,
addison left
|
|||
ZoffixLappy | m: my @h = :foo; sub bar (@h) { say @h; @h[0] = 42; say @h }; bar @h; say @h | 23:40 | |
camelia | rakudo-moar 5a4963: OUTPUT«[foo => True][42][42]» | ||
gfldex | m: my %h = :foo; sub bar (%h is copy) { say %h; %h<foo> = 42; say %h }; bar %h; say %h | ||
camelia | rakudo-moar 5a4963: OUTPUT«{foo => True}{foo => 42}{foo => True}» | ||
gfldex | m: my %h = :foo; sub bar (%h is readonly) { say %h; %h<foo> = 42; say %h }; bar %h; say %h | 23:41 | |
camelia | rakudo-moar 5a4963: OUTPUT«{foo => True}{foo => 42}{foo => 42}» | ||
ZoffixLappy | bisect: my @h = :foo; sub bar (@h) { say @h; @h[0] = 42; say @h }; bar @h; say @h | 23:46 | |
bisectable | ZoffixLappy: on both starting points the exit code is 0 and the output is identical as well | ||
sortiz | Your are passing mutable containers by reference, no? | 23:48 | |
ZoffixLappy | No idea... Damian just said params are immutable and I recalled they weren't in this way, so I was wondering if it were a bug | 23:49 | |
gfldex | m: my %h = :foo; sub bar (%h is readonly) { say %h; %h = (); say %h }; bar %h; say %h | ||
camelia | rakudo-moar 5a4963: OUTPUT«{foo => True}{}{}» | ||
gfldex | what exactly is readonly in this example? | 23:50 | |
ZoffixLappy | no idea | ||
gfldex | so either the trait should complain or the hash should become readonly | ||
23:53
tbrowder joined
|
|||
tbrowder | please consider rakudo PR: github.com/rakudo/rakudo/pull/805 | 23:54 | |
sortiz | 'is readonly' in a subroutine parameter is a NOP, 'cus is the default, so do not change the container semantic. | 23:57 |