»ö« 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.
Geth doc: f71865883d | (Will "Coke" Coleda)++ | 2 files
fix typo

toggled means both set & unset; don't need to negate it.
00:06
doc: cfea1b40a7 | (Will "Coke" Coleda)++ | doc/Language/terms.pod6
This isn't Perl
synopsebot Link: doc.perl6.org/language/terms
timotimo We're not in Perl anymore.
syntaxman I'm using zef to install Jupyter::Kernel, but it fails saying that Net::ZMQ can't find the libzmq.so.5 library... which is in /usr/local/lib 04:24
My firm belief is that asking dumb questions in public will make the answer pop into your brain. 04:31
.
ldconfig saves the day.
geekosaur rubber duck debugging saves the day again :p 04:53
shinobi-cl hi all. How should a bidimensional array handle .elems? I think it should return a pair of (number of columns, number of rows). 06:11
moritz or it could return the number of rows 06:16
and @a[0].elems returns the number of columns
or the other way round, depending on whether your array is row-major or column-major 06:17
or .elems could return $rows * $columns, and you have separate methods for accessing those individually
shinobi-cl i think i will use your last suggestion. Thanks! :) 06:24
shinobi-cl can i use AT-POS with something different that a Int? Like a Pair? my $cell = $myobj[('A', 1)] ? 06:32
I thikn that associative makes more sense, i just want to know if it is pssible :) 06:34
moritz should be possible, yes
you can look in rakudo's file src/core/array_slice.pm to see what kind of stuff is supported 06:35
you can certainly pass an Iterable to .[] 06:36
shinobi-cl Thank you very much, moritz++ 06:37
lizmat clickbaits p6weekly.wordpress.com/2018/01/15/...blue-note/ 09:24
DrForr is baited. 09:30
El_Che DrForr: I have some timesharing opportunities you'd be interested in 10:05
DrForr Oh dear.
Oh, got it. Sorry, I'm still a little stiff from a bad night's sleep. 10:10
moritz
.oO( would you like to multi task with me? ) :D
10:12
DrForr Let's not go there at the moment :) 10:13
I'll be OK by FOSDEM, I just need to remember to stretch. 10:15
scimon lizmat++ on the weekly :) 10:19
Geth doc/fluca1978-backtracking: 10 commits pushed by (Luca Ferrari)++
review: github.com/perl6/doc/compare/00000...869e2eecaa
11:02
jnthn m: my @a[2;4]; say @a.elems; say @a.shape 11:04
camelia 2
(2 4)
jnthn That's what Perl 6 does with the built-in multi-dimensional arrays, fwiw :) 11:05
(Referring to question in backlog)
m: my @a[2;4]; say [*] @a.shape
camelia 8
jnthn And the other thing is easy too :)
Altreus is that the volume 11:09
m: my @a[2;5;4]; say [*] @a.shape;
camelia 40
Altreus :o
Altreus flexes repl
timotimo m: my @a[2;4] = (1, 2, 3, 4; 9, 9, 9, 9)
camelia ( no output )
timotimo m: my @a[2;4] = (1, 2, 3, 4; 9, 9, 9, 9); say @a.elems; .say for @a
camelia 2
1
2
3
4
9
9
9
9
timotimo i'm not very happy with the difference in what .elems gives and what you get in a for loop :\ 11:10
Altreus surely .elems is going to be 2
timotimo yeah, it gave 2 11:11
then iterated over 8 elements :)
Altreus oh 11:12
one would have expected more []s
I'm mildly confused by the various ways I can use (), [], and ; 11:14
jnthn .elems is made to give the first dimension so that we can make @a[*-1;*-1] style things work
timotimo ah, hm 11:14
jnthn (In the future, they won't yet)
Altreus So it seems like a shaped array is a bit WIP right now 11:15
is there a document on how it's supposed to work? I'm interested 11:16
It seems a little bit surprising because you don't know you've got a shaped array when you start iterating
jnthn Partial views of multi-dim arrays were deferred to a future language version; doing them efficiently needs some careful work. 11:18
But the "iterate the leaves" behavior was settled
I think S09 is the best place to look for info on the full set of speculated features 11:19
Altreus I guess you can always just have a multidimensional array without p6 knowing its shape
jnthn If you don't declare a shape, you just have an array of arrays 11:20
Which is fine
The storage strategy will be different then 11:21
When a shape is provided then a single blob of memory is used for all the data
Altreus that makes sense 11:22
hopefully not a sploit ;)
jnthn No, it enforces the dimensions 11:25
timotimo if you want the sploit, you use CArray 11:27
travis-ci Doc build passed. Luca Ferrari 'Add backtracking term to the glossary. 11:28
travis-ci.org/perl6/doc/builds/329414192 github.com/perl6/doc/compare/7d480...9e2eecaab0
Geth doc: fluca1978++ created pull request #1733:
Fluca1978 backtracking
11:34
pmurias rt.perl.org/Public/Bug/Display.html?id=125682 - this ticket can still be reproduced on rakudo.moar just with a longer year 11:51
jkramer Is there a List/Array method that takes a matcher, removes all matching elements from array and returns them? I thought I've seen something like that but can't remember 12:21
yoleaux 13 Jan 2018 04:14Z <Zoffix> jkramer: the `where` on variable thing makes sense to me and contrary to what was suggested in the channel earlier, I don't think it's a bug. The difference lies in that when you use a `where` in a parameter, it concerns a single transaction: binding a value to parameter. When you use `where` with attribute/variable, however, it checks the *values* whenever they're modified. It'd be weird if doing
13 Jan 2018 04:15Z <Zoffix> jkramer: @foo[42] = 1337 would invoke `where` callable with the entire array instead of just the value we're interested in
timotimo jkramer: depending on how exactly you want it to behave, your best bet is probably @list .= grep(none(your-matcher)); 12:22
m: my @a = ^100; @a .= grep(none(*.is-prime)); say @a
camelia [0 1 4 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 38 39 40 42 44 45 46 48 49 50 51 52 54 55 56 57 58 60 62 63 64 65 66 68 69 70 72 74 75 76 77 78 80 81 82 84 85 86 87 88 90 91 92 93 94 95 96 98 99]
geekosaur comb? 12:24
timotimo oh, wait, you want the removed bits returned
you can get that with classify/categorize 12:25
if you're okay with the array having holes afterwards, you can do slicing
jkramer timotimo: But does it return the other elements? I basically want to partition a list into two groups based on the matcher. .classify and categorize are ok, but getting a hash back is a bit of a hassle sometimes when I just want to lists 12:25
moritz m: say (1..5).classify(*.is-prime) 12:26
camelia {False => [1 4], True => [2 3 5]}
jkramer Basically Haskell's groupBy :)
timotimo m: say (1..10).classify(*.is-prime)<True False>.perl
camelia (Any, Any)
timotimo oops, has to be objects
m: say (1..10).classify(*.is-prime){True, False}.perl
camelia ($[2, 3, 5, 7], $[1, 4, 6, 8, 9, 10])
timotimo there you get two lists ;)
jkramer Hmm I guess that'll do :D
Thanks
timotimo YW
moritz m: my (:True(@primes), :False(@non-primes)) := (1..10).classify(*.is-prime); say @non-primes.perl 12:27
camelia [1, 4, 6, 8, 9, 10]
timotimo that's a lot wordier, but also rather a bit prettier
perlawhi1l m: (1..10).classify(*.is-prime).values 12:30
camelia ( no output )
perlawhi1l m: say (1..10).classify(*.is-prime).values
camelia ([2 3 5 7] [1 4 6 8 9 10])
timotimo perlawhi1l: it isn't guaranteed what order True and False will hash in
bisectable6: :{True => 1, False => 2}.values.say 12:31
bisectable6 timotimo, Bisecting by output (old=2015.12 new=cf15435) because on both starting points the exit code is 0
timotimo no, not the right bot
bisectable6 timotimo, bisect log: gist.github.com/aee7d6186ecf0bb2b6...016193d066
timotimo, (2017-02-22) github.com/rakudo/rakudo/commit/1c...24e4d0d5d3
timotimo committable6: releases :{True => 1, False => 2}.values.say
committable6 timotimo, ¦2015.12,2016.01.1,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,2016.10,2016.11,2016.12,2017.01,2017.02: «(1 2)␤» ¦2017.03,2017.04.3,2017.05,2017.06,2017.07,2017.08,2017.09,2017.10,2017.11,2017.12,HEAD(cf15435): «(2 1)␤»
timotimo regardless of what this says! don't rely on it 12:32
AlexDaniel committable6: all :{True => 1, False => 2}.values.say 12:33
committable6 AlexDaniel, gist.github.com/d0993097c22c7c90b2...ab26eeb0aa
AlexDaniel ↑ that's a better picture :) 12:34
ah no
same
AlexDaniel is blind
perlawhi1l There was a big change a few months back... if I recall, a new JIT for Moar. approximately when was that 13:16
(or hey, if you have the exact commit, i won't complain)
AlexDaniel well, the rakudo commit is right there 13:21
timotimo 2017.10 13:39
perlawhi1l: ^- that's the release of moarvm that merged it
jkramer m: my (@a, @b) = (^5, 2..3, 7..9).classify(so * (&) (3..4)){True, False}; say @a.perl; say @b.perl; 13:41
camelia [[^5, 2..3], [7..9,]]
[]
jkramer How do I make the False-result go into @b? 13:42
perlawhi1l timotimo: thanks
jkramer m: my (@a, @b) = |(^5, 2..3, 7..9).classify(so * (&) (3..4)){True, False}; say @a.perl; say @b.perl;
camelia [[^5, 2..3], [7..9,]]
[]
timotimo jkramer: you're gonna need := instead of =
jkramer m: my (@a, @b) := |(^5, 2..3, 7..9).classify(so * (&) (3..4)){True, False}; say @a.perl; say @b.perl; 13:42
camelia [^5, 2..3]
[7..9,]
13:42
jkramer Oh nice, thanks :)
timotimo m: my (@a, @b) := (^5, 2..3, 7..9).classify(so * (&) (3..4)){True, False}; say @a.perl; say @b.perl; 13:44
camelia [^5, 2..3]
[7..9,]
timotimo no need for the prefix:<|> either
scimon So you can't have private multi methods. Is that a "We'd like to but not implemented it" or a "Not going to happen" thing? And if it's the second case can someone give me a rationale?
jkramer m: my (@a, @b) := |(^5, 2..3, 7..9).classify(so * (&) (10..11)){True, False}; say @a.perl; say @b.perl; 13:46
camelia Type check failed in binding to parameter '@a'; expected Positional but got Any (Any)
in block <unit> at <tmp> line 1
jkramer How can I prevent that?
Oh whatever I'll just use the hash then, this is too much hassle now :) 13:47
jnthn scimon: I don't see any reason why we can't have it, it's just figuring out a good way to implement it
scimon That's cool. :)
timotimo oh, if it doesn't have any results in one of them?
m: my (@a, @b) := {a => (1, 2, 3)}<a b> 13:48
camelia Type check failed in binding to parameter '@b'; expected Positional but got Any (Any)
in block <unit> at <tmp> line 1
timotimo m: my ($a, $b) := {a => (1, 2, 3)}<a b>; say $a; say $b 13:49
camelia (1 2 3)
(Any)
timotimo m: my ($a, $b) := {b => (1, 2, 3)}<a b>; say $a; say $b
camelia (Any)
(1 2 3)
timotimo m: my ($a, $b) := {c => (1, 2, 3)}<a b>; say $a; say $b
camelia (Any)
(Any)
timotimo m: my (@a, @b) := {a => (1, 2, 3)}<a b>.>>.list; say @a.perl; say @b.perl
camelia (1, 2, 3)
(Any,)
timotimo no, that doesn't help
m: my (@a, @b) := {a => (1, 2, 3)}<a b> >>//>> Empty; say @a.perl; say @b.perl
camelia Too few positionals passed to '<unit>'; expected 2 arguments but got 0
in block <unit> at <tmp> line 1
timotimo nope.
jkramer Is there some syntax sugar to make this a bit nicer/shorter? .reduce({ ($^a.min min $^b.min)..^($^a.max max $^b.max) }) 13:58
(2..4, 1..3, 3..6).reduce({ ($^a.min min $^b.min)..^($^a.max max $^b.max) })
m: (2..4, 1..3, 3..6).reduce({ ($^a.min min $^b.min)..^($^a.max max $^b.max) }).say
camelia 1..^6
jnthn m: say (2..4, 1..3, 3..6).reduce(&minmax) 14:03
camelia 1..6
jnthn That's pretty close, I think
jkramer Uhmm ok I'll have to figure out how/why that works first :D I looked into minmax but couldn't see how it's useful for reduce 14:04
jnthn I don't know without looking either ;) 14:05
timotimo m: say 2..4 minmax 9..100
camelia 2..100
timotimo m: say 2..4 minmax 1..100
camelia 1..100
timotimo i suppose minmax is defined on two ranges, too
m: say 2..4 minmax 50
camelia 2..50
timotimo m: say 2..4 minmax 0
camelia 0..4
jkramer Ohh so minmax is an operator, I was just looking the method Range.minmax
timotimo heh. 14:06
jkramer Isn't the minmax operator documented anywhere? It's mentioned on docs.perl6.org/language/operators in the precendence table, but with no explanation 14:17
scimon So the more I play with multi methods the more I love there awesomeness. 14:21
wamba m: with "ab" { say  m/ [ <?after a> (.*)] $ /; say m:P5/(?=a)(.*)$/} 14:22
camelia 「b」
0 => 「b」
「ab」
0 => 「ab」
AlexDaniel m: say 5 minmax 8 minmax 3 14:41
camelia 3..8
AlexDaniel cool
perlawhi1l m: say [minmax] 5, 8, 3, 2, 7 14:43
camelia 2..8
AlexDaniel jkramer: github.com/perl6/doc/issues/1734
perlawhi1l if you actually want the min and max values for assignment, you can also use the 'bounds' (or 'int-bounds') methods 14:47
m: my ($min, $max) = ( [minmax] 5, 8, 3, 2, 7).bounds; say $min; say $max;
camelia 2
8
AlexDaniel m: say minmax 5, 8, 3, 2, 7 14:55
camelia 2..8
[Coke] m: Promise.in(4).then: { say 'yawn' } 15:13
camelia ( no output )
[Coke] m: await Promise.in(4).then: { say 'yawn' }
camelia yawn
timotimo the process shuts down before the promise gets resolved
[Coke] Yes, I wasn't reporting a bug, just correcting my typo. 15:19
timotimo OK
scimon So, how polished do people thing a module should be before release? 15:29
*think* 15:30
lizmat it should have some documentation and some tests that don't fail ? 15:31
lizmat
.oO( release early, release often )
15:31
El_Che scimon: if you plan to change the API dramatically, state it in the doc
scimon Oh yeah. Definitely. 15:32
El_Che scimon: you can use version numbers for that 15:32
scimon In this case it's a bare bones of what I'd like it to do but it's enough I can start using it in tests for other modules. So I figure I can share it. It might be helpful.
Righto. It's on it's way. 15:35
jkramer AlexDaniel: Thanks! 15:39
That reminds me that I wanted to report a bug a few days ago but I don't remember what it was
buggable New CPAN upload: Test-HTTP-Server-0.1.0.tar.gz by SCIMON cpan.metacpan.org/authors/id/S/SC/...1.0.tar.gz 15:42
lizmat jkramer: maybe a memory problem :-) 15:44
lizmat has that all the time :-( 15:47
moritz try to get another gig of RAM, maybe? :-)
jkramer Ok I remember now. Where would I report a bug regarding class attributes? In rakudo I guess? 15:48
moritz yes
Geth doc: 3157e72c19 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Rat.pod6
Fix Rat parametarization

  (even tho rakudo doesn't yet implement it as a native type, it's
better than a type that doesn't exist)
  github.com/rakudo/rakudo/commit/cf15435575
  github.com/rakudo/rakudo/commit/6977680bd9
15:55
synopsebot Link: doc.perl6.org/type/Rat
Zoffix jkramer: did you see my robot message to you? 15:56
jkramer Zoffix: No, what should I look for? :) 15:58
Zoffix jkramer: I don't think it's a bug. What behaviour for `has @.foo where …` do you expect when `Foo.foo[0] = 42;` is performed? The where executed with the entire Array?
jkramer: irclog.perlgeek.de/perl6/2018-01-16#i_15695964
m: -> @a where +* { @a = (); dd @a}([1,]) 15:59
camelia []
Zoffix If anything, ^ that is a bug because the `where` is lost, but I think that ship has sailed...
jkramer Ah ok. Hmm I still think it's weird/wrong. You could still use the where to check on every element if that's what you really want to do, but if this is the default there's no way to check on things like array length etc. 16:00
jkramer I also wouldn't expect @foo[42] = 1337 to cause a constraint check on @foo but on @foo[42], but isn't that what subtyping with Array[Int] etc is for? 16:02
Zoffix m: my @a where { dd $_; True } := [<a b c>] 16:05
camelia Type check failed in binding; expected Positional[<anon>] but got Array ($["a", "b", "c"])
in block <unit> at <tmp> line 1
Zoffix m: my $a where { dd $_; True } := [<a b c>]
camelia ["a", "b", "c"]
Zoffix jkramer: ok, file away then :) github.com/rakudo/rakudo/issues/new
jkramer github.com/rakudo/rakudo/issues/1414 16:12
comborico1611 Hello
Zoffix \o 16:13
timotimo do we have a nice little factoid for how to begin a slang on camelia?
Zoffix How about: "Don't do it, because there's no official interface" 16:14
:)
huggable: slang
huggable Zoffix, mouq.github.io/slangs.html Make an op that chains right (uses unsupported feature: slangs): BEGIN { $?LANG.refine_slang('MAIN', role { token infix:sym«smaller» { <sym> <O('prec', 'm=', 'assoc', 'left', 'dba', 'chaining', 'iffy', 1, 'diffy', 1, 'pasttype', 'chain')> } } )}; sub infix:<smaller> { $^a < $^b }; say 1 smaller 2 smaller 3
timotimo aaw 16:18
we'll have something some day i guess 16:19
Zoffix I wonder what that'd look like... Would we just freeze pieces of the grammar? To be modifieable only under the same conditions as routines/methods? 16:20
timotimo BEGIN { $?LANG.refine_slang('MAIN', role { token ws { <_ws> | "like" ","? } }); }; sub like, hi() { say like, "how are you" }; like hi() 16:21
m: BEGIN { $?LANG.refine_slang('MAIN', role { token ws { <_ws> | "like" ","? } }); }; sub like, hi() { say like, "how are you" }; like hi()
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 { <_ws> | "like" ","? } }); }; sub like7⏏5, hi() { say like, "how are you" }; like
expecting any of:
new name to be defined
timotimo m: BEGIN { $?LANG.refine_slang('MAIN', role { token ws { <_ws> | "like" ","? } }); }; { sub like, hi() { say like, "how are you" }; like hi() }
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 <_ws> | "like" ","? } }); }; { sub like7⏏5, hi() { say like, "how are you" }; like
expecting any of:
new name to be defined
timotimo :(
Zoffix You can't modify ws that easily
timotimo oh, i'd have to match whitespace around it, too
m: BEGIN { $?LANG.refine_slang('MAIN', role { token ws { <_ws> | <_ws> "like" ","? <_ws> } }); }; { sub like, hi() { say like, "how are you" }; like hi() } 16:22
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3s> "like" ","? <_ws> } }); }; { sub like7⏏5, hi() { say like, "how are you" }; like
expecting any of:
new name to be defined
timotimo :(
Abid help 16:53
timotimo what a brief existence abid had 16:58
geekosaur abid them adieu >.>
TEttinger is there any way to do that "like, " slang using comments instead of ws? 17:31
timotimo should be 17:38
i was too lazy to investigate any further
Zoffix TEttinger: comments are part of ws. You also can't override ws/comments in mainline. perl6advent.wordpress.com/2017/12/01/#ho-ho-ho 18:01
TimToady m: my ($a, $b) := (^5, 2..3, 7..9).classify(so * (&) (10..11)){True, False}; say $a.perl; say $b.perl; 18:17
camelia Any
$[^5, 2..3, 7..9]
TimToady jkramer: ^^^
Zoffix TimToady: FWIW there's expert opinion wanted. RE: why `@foo where …` applies to the entire array in params, but to individual elements in variables: github.com/rakudo/rakudo/issues/14...-358021893 18:20
TimToady someone probably just implemented the one as an anonymous subset, so it distributes like a subset type 18:25
we should probably make them consistent
Zoffix Noted. 18:29
TimToady otoh, binding is for the whole array, and most varaiables are constructed piecemeal by individual assignments that each have to be checked, so the situations aren't equivalent 18:31
lizmat m: sub a(@a[3]) { }; dd &a.signature # this feels wrong 18:32
camelia :(@a[3] where { ... })
TimToady if you checked the whole array every time you assigned, that would be a lot of overhead
going the other way, how would you then write a constraint on the whole binding? 18:33
so maybe it would be a foolish consistency...
Zoffix m: subset Foo where { dd "[$_]"; $_ ne "z" }; -> Foo @a { @a[1] = "z"}(Array[Foo].new: <a b c>) 18:35
El_Che "Perl 6: foolishly consistent" is not that bad
camelia "[a]"
"[b]"
"[c]"
"[a b c]"
"[z]"
Type check failed in assignment to ; expected Foo but got Str ("z")
in block <unit> at <tmp> line 1
El_Che :)
Zoffix I think I see a consistent path here.
`my @foo where …` and `:(@foo where …)` typecheck the binding to Positional + where. And `my Foo @foo` and `:(Foo @foo …)` typecheck the elements on STORE 18:36
TimToady or we could always distribute on @, but require $ binding to check entire array 18:36
that would still be potentially incompatible, so something for .d boundary 18:37
Zoffix so `my @foo where … = …` wouldn't even invoke the where
Oh wait yeah it would 18:38
TimToady well, it could, since there's =
Zoffix `my @foo where * !~~ Array = 42` would type-check blow up, while `my @foo where * !~~ List = 42` would work.
Zoffix Oh wait the second too would blow up 'cause it's Array is a List :) 18:39
But the point is the default container would be checked against the where
TimToady no, we'd make it consistent by applying the where to each element, not the whole thing
Zoffix In the parameters?
That'd have a huge amount of fallout :o 18:40
TimToady which is why we'd have to do it on the .d boundary, like I said
Zoffix -1 on that. It'd be removing a feature. 18:41
We even use it in core: github.com/rakudo/rakudo/blob/mast...oc.pm#L228 18:42
TimToady arguably, there are few wheres on variables, so one could do it the other way with less fallout, but that would tend to violate people's expectations when they assign individual elements instead
but if we did it that way, at least we could point people to the subtype to get a where that applies individually 18:43
s/subtype/subset/
Zoffix Yeah, +1 on that and we'd keep a way to get typecheck on the whole array if you want it
when binding, like in params
TimToady okay, I'm happier with that 18:44
Zoffix \o/
buggable New CPAN upload: P5tie-0.0.4.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.4.tar.gz 19:02
rightfold
.oO(Fibonacci numbers are like Merkle trees)
20:29
TEttinger rightfold: have you heard of fibonacci heaps? 20:30
en.wikipedia.org/wiki/Fibonacci_heap
buggable New CPAN upload: P5tie-0.0.5.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.5.tar.gz 21:02
New CPAN upload: Tie-Array-0.0.1.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.1.tar.gz