»ö« 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.
geekosaur and yet people did 00:01
another example: @ in doublequoted strings was treated literally until perl 4; any script using literal @s needed to have escapes added. 00:03
*usually*, but not always, breakage was limited to major releases.
timotimo the cool thing is that you can just put @ into strings in perl6 now <3 00:21
unless you have html tags :P
AlexDaniel m: my @a = <hello world>; say “this is a @a test” 00:23
camelia this is a @a test
AlexDaniel m: my @a = <hello world>; say “this is a $@a test”
camelia this is a hello world test
timotimo m: my @a = <hello world>; say "this is a @a[] test"; 00:24
camelia this is a hello world test
AlexDaniel m: my @a = <hello world>; say “this is a $:: test” 00:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$' is not declared
at <tmp>:1
------> 3my @a = <hello world>; say “this is a 7⏏5$:: test”
AlexDaniel ehhh…
timotimo huh, what is \/ supposed to be in json?
apparently it's supposed to be /
oh, but i implemented that!
AlexDaniel m: say ($:) 00:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '&infix:<:>' is not declared
at <tmp>:1
------> 3say ($7⏏5:)
AlexDaniel camelia: huh, wouldn't it be weirder if it was declared? 00:29
m: no strict; say (++$b); say $b 00:32
camelia 1
1
AlexDaniel m: no strict; say (++$:);
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '&infix:<:>' is not declared
at <tmp>:1
------> 3no strict; say (++$7⏏5:);
IOninja m: sub infix:<:> {}; say ($:) 00:40
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling infix:<:>(Mu) will never work with declared signature ()
at <tmp>:1
------> 3sub infix:<:> {}; say ($7⏏5:)
IOninja m: sub infix:<:> {@_}; say ($:)
camelia [(Any)]
IOninja heh
ugexe i see why perl6 parser fails to install 01:03
github.com/drfor/perl6-Perl6-Parser
typoed their name 01:05
SmokeMachine [&any-op] should always be equal to the last value of [\&any-op]? 04:03
faraco m: say "mix"x5 if "cat" eq 'cat' 07:48
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say "mix"7⏏5x5 if "cat" eq 'cat'
expecting any of:
infix
infix stopper
postfix
statement end
stateme…
faraco m: say "mix" if "cat" eq 'cat' 07:49
camelia mix
faraco m: say "mix" X 5 if "cat" eq 'cat'
camelia ((mix 5))
KDr2_c Anyone knows why does the latest release of rakudo not work on JVM? 08:59
RabidGravy I wasn't aware that it wasn't working 09:15
KDr2_c I saw the release note said it is not working on JVM 09:27
geekosaur incompatible changes to unicode handliing, I think 09:39
it's been catching up the last few days, but that didn't make the release
nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2) dd X ; 10:21
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 => 1 ; my %h2 = b => 2; return %h1, %h27⏏5) dd X ;
expecting any of:
postfix
statement end
statement modifier
stat…
nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2) ; dd X ;
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 => 1 ; my %h2 = b => 2; return %h1, %h27⏏5) ; dd X ;
expecting any of:
postfix
statement end
statement modifier
st…
nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd X ;
camelia X
nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd X() ; 10:22
camelia X(Any)
geekosaur more namespace fun, I see 10:23
nadim m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} dd get_data() ; 10:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3=> 1 ; my %h2 = b => 2; return %h1, %h2}7⏏5 dd get_data() ;
expecting any of:
infix
infix sto…
10:25
nadim m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd get_data() ;
camelia ({:a(1)}, {:b(2)})
nadim m: sub XX {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd XX() ;
camelia ({:a(1)}, {:b(2)})
nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd X() ;
camelia X(Any)
nadim What is X()? it seems that I can't use that as a function name (I came for another problem but fun comes at unexpected times!) 10:27
geekosaur all exceptions are X::something
so X is taken as a namespace, and that's not being handled right here
nadim ah! thank you 10:28
geekosaur probably should rakudobug it, although I suspect it'll get merged with one of the existing namespace tickets
nadim m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd get_data() ; my (%h1, %h2) = get_data() ; dd %h1 ; dd %h2 ; 10:29
camelia ({:a(1)}, {:b(2)})
Hash %h1 = {:a(1), :b(2)}
Hash %h2 = {}
nadim %h1 slurps all the returned values, how do I make my (%h1, %h2) = ... non slurpy? 10:31
without changing %h1 to $h1 10:32
geekosaur I think you have to itemize the returns? 10:33
m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return $%h1, $%h2} ; dd get_data() ; my (%h1, %h2) = get_data() ; dd %h1 ; dd %h2 ;
camelia (${:a(1)}, ${:b(2)})
Hash %h1 = {"a\t1" => ${:b(2)}}
Hash %h2 = {}
geekosaur nope :/ 10:34
nadim :)
but the idea was good
geekosaur or I did it wrong which is not impossible since my body decided I didn't need sleep so I'm on >24 hours awake :/
nadim Bed!
unclechu hey guys, how do i get/set environment variable in perl6? 11:25
lizmat m: say %*ENV<PATH> 11:27
camelia /home/camelia/perl5/perlbrew/bin:/home/camelia/perl5/perlbrew/perls/perl-5.20.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
unclechu lizmat: thanks) 11:28
lizmat m: %*ENV<FOO> = 42; shell q/echo $FOO/ 11:29
camelia shell is disallowed in restricted setting
in sub restricted at src/RESTRICTED.setting line 1
in sub shell at src/RESTRICTED.setting line 15
in block <unit> at <tmp> line 1
unclechu pretty consistent along with stdout/err/in
lizmat yup
timotimo geekosaur: X() is a coercion type 11:35
m: dd X(Cool)
camelia X(Cool)
timotimo m: dd X(Any)
camelia X(Any)
timotimo m: dd X()
camelia X(Any)
unclechu how do i drop first element from immutable list? i could use `tail` but i'm supposed to specify length-1 value to do it, any simplier way to do it? 11:41
timotimo you can use @foobar[1..*] 11:42
unclechu timotimo: thanks, that works 11:44
timotimo no prob
lizmat m: my @a = ^10; .say for @a.skip(1) # unclechu 11:45
camelia 1
2
3
4
5
6
7
8
9
unclechu lizmat: thanks, a lot better) 11:46
lizmat m: my @a = ^10; .say for @a.skip # better
camelia 1
2
3
4
5
6
7
8
9
unclechu lizmat_:
lizmat afk for some more schlepping&
unclechu hmm.. it looks like it isn't working for immutable List
timotimo that's strange. it's an iterator-y method 11:47
unclechu `$ perl6 -e '%*ENV<PATH>.split(<:>).skip(1).print'`
`No such method 'skip' for invocant of type 'List' in block <unit> at -e line`
lizmat m: my $a = (0,1,2,3); .say for $a.skip # seems to work ok?
camelia 1
2
3
timotimo what version you at? 11:48
skip is a little new-ish
unclechu `This is Rakudo version 2017.01 built on MoarVM version 2017.01`
lizmat yeah, skip seems to be post 2017.01 11:49
unclechu lizmat: okay, will keep that in mind 11:50
lizmat looks like 8a6bfc68a87bed7c6c introduced it, which was Jan 21
"I've waited to push this until 11:51
after the 2017.01 release, so that we have about a month to revert it
should it be considered an addition we could do without" :-)
really afk& 11:52
gfldex spectesting is a slow business :-| 11:55
timotimo get more cores :) 11:58
nadim m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd get_data() ; my (%h1, %h2) = get_data() ; dd %h1 ; dd %h2 ; 13:06
camelia ({:a(1)}, {:b(2)})
Hash %h1 = {:a(1), :b(2)}
Hash %h2 = {}
nadim given the above, how do I get %h1 and %h2 set with what the sub sends back?
dalek on: 20f4bce | moritz++ | README (2 files):
README -> README.md

also remove mention of ufo. Closes #28
13:13
yoleaux 26 Feb 2017 04:25Z <AlexDaniel> dalek: ahoi, please update that repo to use geth instead: Change the webhook to geth.perl6.party/?chan=#perl6-dev (or #moarvm for moarvm), Content-type: application/json and "Send me everything."
14 Mar 2017 19:15Z <IOninja> dalek: you're a deficient bot
dalek on: 32c43c0 | moritz++ | README.md:
README: fix indention
13:13
gfldex m: sub get_data {my %h1 = a => 1; my %h2 = b => 2; return %h1, %h2}; my (@ (%h1, %h2) ) = get_data(); dd %h1; dd %h2; 13:22
camelia Mu
Mu
gfldex nadim: ^^^ that should work (in my eyes) but doesnt. You may have stepped on a bug. 13:23
moritz m: sub get_data {my %h1 = a => 1; my %h2 = b => 2; return %h1, %h2; my (@ (%h1, %h2) ) := get_data(); dd %h1; dd %h2; 13:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Redeclaration of symbol '%h1'
at <tmp>:1
------> 3h2 = b => 2; return %h1, %h2; my (@ (%h17⏏5, %h2) ) := get_data(); dd %h1; dd %h2;
expecting any of:
shape declaration
moritz m: sub get_data {my %h1 = a => 1; my %h2 = b => 2; return %h1, %h2}; my (@ (%h1, %h2) ) := get_data(); dd %h1; dd %h2; 13:30
camelia Type check failed in binding to '<anon>'; expected Positional but got Hash (${:a(1)})
in block <unit> at <tmp> line 1
moritz m: sub get_data {my %h1 = a => 1; my %h2 = b => 2; return %h1, %h2}; my (%h1, %h2) := get_data(); dd %h1; dd %h2;
camelia Hash %h1 = {:a(1)}
Hash %h2 = {:b(2)}
gfldex i take that back :)
IOninja gfldex │ spectesting is a slow business :-| 14:03
Are you using TEST_JOBS=8 or whatever many cores you have? 14:04
gfldex IOninja: i didn't but will 14:41
IOninja Wonder why we don't default to something saner than 1.... for that env var... 14:51
RabidGravy concludes that implementing an EventSource client using its own HTTP client is a mugs game and moves on 14:53
AlexDaniel .tell dalek ahoi, please update that repo to use geth instead: Change the webhook to geth.perl6.party/?chan=#perl6-dev (or #moarvm for moarvm), Content-type: application/json and "Send me everything." 14:59
yoleaux AlexDaniel: I'll pass your message to dalek.
AlexDaniel moritz: did you already change github.com/moritz/json to use Geth or not yet? 15:00
moritz AlexDaniel: it seem I didn't 15:02
huggable: geth? 15:03
huggable moritz, nothing found
nadim moritz: thanks, you too gfldex. I have been away long time, I have to re-learn everything it seems. 15:04
jdv79 moritz: it wasn't about configurability. it was ability.
moritz though I wonder if we want push notifications from perl6/json
at all in here
jdv79 json spec allows non-unicode bytes and ::Tiny doesn't 15:05
moritz jdv79: for a ::Tiny module, I just want one way to do it
jdv79 so then ::Tiny will be a partial impl of the spec?
moritz JSON::Tiny encodes strings in a spec compliant way, and one is enough
timotimo do you have to put a ? at the end?
huggable: geth
huggable timotimo, nothing found
timotimo OK
huggable: dalek
huggable timotimo, nothing found
timotimo huggable: dalek?
huggable timotimo, nothing found
timotimo fair enough
moritz just like the specs allow whitespace between tokens; either JSON::Tiny emits space there or it doesn't; there won't be any options to support both 15:06
jdv79 moritz: oh, right. that's another ticket i'm remembering.
timotimo to be fair, json::fast has a "pretty" option that you can turn on or off 15:07
moritz though I welcome anybody to put such features into a "JSON" module, or into JSON::Fast, or any other than ::Tiny modules
jdv79 that's not what i was talkking about. this ticket was about encoding unicode or not
moritz jdv79: I understand
jdv79 i meant timotimo on that last one
timotimo oh!
jdv79 cool. i think i woke up and wasted enough of everyone's time in misremembering 15:08
thanks!
timotimo huh ... what did i miss?
moritz timotimo: github.com/moritz/json/issues/27 15:08
timotimo oh, does json::tiny turn all unicode characters into escape sequences? 15:09
er i mean 15:10
all non-ascii unicode character
moritz I think so, yes 15:13
timotimo didn't know that
faraco o/ 15:22
Geth doc: e386d330cc | (Wenzel P. P. Peppmeyer)++ | doc/Language/mop.pod6
link to Metamodel::ClassHOW
16:13
moritz lol I blogged: perlgeek.de/blog-en/perl-6/2017-01...ython.html 16:30
AlexDaniel bisect: say qw|! @ # $ % ^ & * \| < > | eqv '! @ # $ % ^ & * | < >'.words 16:50
bisectable6 AlexDaniel, Bisecting by output (old=2015.12 new=fbe7ace) because on both starting points the exit code is 0
AlexDaniel, bisect log: gist.github.com/43c1626229a204c085...6d3573118f
AlexDaniel, (2017-03-01) github.com/rakudo/rakudo/commit/f9...6d700335de
IOninja moritz: FWIW syntax highlighting would make those examples more palatable :)
IOninja m: dd WHAT qw<x>; dd WHAT 'x'.words 16:51
camelia Str
Seq
IOninja m: dd WHAT qw<x y>; dd WHAT 'x'.words
camelia List
Seq
moritz IOninja: the ebook version has syntax hilighting :-)
IOninja just sayin' :)
moritz IOninja: appreciated
AlexDaniel IOninja: yeah, it's just that we have a broken example in our docs. See this: github.com/perl6/doc/issues/1252 16:56
Geth doc: 29f13e6f39 | (Zoffix Znet)++ | doc/Language/quoting.pod6
Fix broken example

Fixes #1252
16:58
AlexDaniel ah, okay
IOninja m: IO::Spec::Win32.is-absolute('/').say 17:31
camelia True
IOninja How come this is absolute (and there are tests for it)? It's absolute only to the current drive and `chdir` to another drive will make this path point to a different location. 17:32
moritz it seems is-absolute means "absolute inside a volume" on OSes that have volumes 17:44
IOninja But why? 17:45
Or rather, why would someone want to know the value of `.is-absolute`. To me, it'd mean I can bust up its CWD anyway I want and still get the same object referenced. the "only inside volume" qualifier makes it useless for that purpose on Windows 17:47
And calling `.absolute` on it makes it prepend the drive, which is an odd thing to do considering `.is-absolute` told me the original was already absolute. 17:50
moritz agreed, it's weird 17:51
though iirc windows has a working directory per volume, no?
(which means I have no idea what chdir() actually does)
IOninja C:\Users\zoffi>perl6 -e "my $p = '/'.IO; $p.Str.IO.dir[0].say; chdir 'E:/'; $p.Str.IO.dir[0].say" 17:53
"C:\$Recycle.Bin".IO
"E:\$RECYCLE.BIN".IO
IOninja same with &*chdir 17:54
bolangi paranoidd: I've requested action from github about supporting Edit on pages located in subdirectories. 18:17
Ooops, sorry, wrong channel.
mst bolangi: neat nonetheless. good luck. 18:19
DrForr Would an iterator that let me do something like 'for $.lookahead(2) -> [ $current, $next, $really-next ] { }' that lets you destructure an argument be considered violating the principle of least surprise? 18:20
mst I quite like the idea 18:21
except I'd call it $.with-lookahead(2) I think
took me a moment to understand it
DrForr Yeah, I can see that. It's just returning an iterator for special needs. 18:22
DrForr I should be able to do this with .rotor(3 => -2), but that does @x.elems - 2 iterations. 18:23
bolangi mst: Thanks and greetings! 18:24
mst I don't honestly understand rotor 18:24
DrForr Oh, I get the idea. It just doesn't *quite* work for me. 18:25
ugexe I generally use rotor as a natatime 18:26
timotimo DrForr: i think you want :partial?
or is that not enough?
DrForr timotimo: That will terminate when the list is exhausted. My .with-lookahead() terminates when $current receives the last element of the list, which is *slightly* different. 18:27
(a b | b c | c d ) # .rotor(2 => -1, :partial) 18:28
(a b | b c | c d | d (Any) ) # what I want.
timotimo ah
i could see an extension to :partial 18:29
DrForr Yeah, I'm thinking about that too. :exhaust would let the iterator run until almost every element of the rotor'ed list is (Any). 18:30
DrForr I could certainly do this with a loop over .rotor() and a final call(s) if the list's length isn't exactly divisible by the rotor's length. 18:32
AlexDaniel DrForr: oh, so you want this
m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y?) { say “$x ↔ {$y // ‘bla’}” }
camelia a ↔ b
b ↔ c
c ↔ d
d ↔ bla
IOninja m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y = 'blah') { say “$x ↔ $y” }
camelia a ↔ b
b ↔ c
c ↔ d
d ↔ blah
AlexDaniel m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y = Any) { say “$x ↔ $y” } 18:33
camelia a ↔ b
b ↔ c
c ↔ d
Use of uninitialized value $y of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
in block at <tmp> line 1
d ↔
AlexDaniel oops… well, yes
IOninja++, didn't think about this
DrForr Aha, didn't think that optional variables were allowed in that position. 18:34
IOninja m: dd 'abcd'.comb.rotor(2 => -1, :partial).map: {.[^2]}
camelia (("a", "b"), ("b", "c"), ("c", "d"), ("d", Nil)).Seq
DrForr Excellent, I think I prefer the -> ( $x, $y? ) notation. 18:35
IOninja DrForr: everything is allowed. It's just a signature like any other
DrForr It does mean a few more test cases, I have to have lists with lengths where $x % 3 == {0,1,2}. 18:36
AlexDaniel m: <a b c d>.rotor(2 => -1, :partial).map: &xxx; multi sub xxx(@ ($a, $b)) { say “Two: $a $b” }; multi sub xxx($a) { say “A-ha! Only one: $a” } 18:39
camelia Two: a b
Two: b c
Two: c d
A-ha! Only one: d
AlexDaniel DrForr: or maybe even something like this?
m: .say for <a b c d>.rotor(2 => -1, :partial).map: &xxx; multi sub xxx(@ ($a, $b)) { “Two: $a $b” }; multi sub xxx($a) { “A-ha! Only one: $a” } 18:40
camelia Two: a b
Two: b c
Two: c d
A-ha! Only one: d
AlexDaniel though maybe the second case needs unpacking too
ah, you don't need @ there
m: .say for <a b c d>.rotor(2 => -1, :partial).map: &xxx; multi sub xxx(($a, $b)) { “Two: $a $b” }; multi sub xxx(($a)) { “A-ha! Only one: $a” } 18:41
camelia Two: a b
Two: b c
Two: c d
A-ha! Only one: d
AlexDaniel yea
DrForr Well, actually having two iteration methods there is what I want to avoid. If I wanted to do that, I could just use the regular iterator and do a last pass after the loop. I want to avoid doing stuff outside the loop. 18:42
AlexDaniel I don't like .map to be called for side effects only :S
DrForr And I could do this as a method as well, to be sure. Probably more portable too, but people are going to be reading this code (as at least one person has done to figure out how the iterator worked) and I want to keep "fancy stuff" out. $x? is already fancy enough for my tastes :) 18:43
AlexDaniel m: for <a b c d>.rotor(2 => -1, :partial) { &xxx(@_) }; multi sub xxx(($a, $b)) { say “Two: $a $b” }; multi sub xxx($a) { say “A-ha! Only one: $a” }
camelia Two: a b
Two: b c
Two: c d
A-ha! Only one: d
AlexDaniel m: for <a b c d>.rotor(2 => -1, :partial) { &xxx(@_) }; multi sub xxx(($a, $b)) { say “Two: $a $b” }; multi sub xxx(($a)) { say “A-ha! Only one: $a” } 18:44
camelia Two: a b
Two: b c
Two: c d
A-ha! Only one: d
DrForr At least this way I've only got the one loop to deal with. It works, at least so far. 18:45
ugexe DrForr: the PR I sent to perl6 parser allows it to be installed by zef. But feel free to close the PR and just make the change yourself (source-url typo `drfor` and should end in .git) 18:49
DrForr I think I merged it about an hour ago, actually. 18:50
DrForr The other thing is that I can always look at $node.previous and $node.next, but I'm also not sure if I want to keep those methods around. 18:52
DrForr I think I may end up doing $x.with-lookaside(1) -> [ $previous, $current, $next ] { .. } which I could sort of emulate with (Any,@x) # but then.. hey, (Any,@x,Any).rotor(3 => -1) # ... 18:59
Well, .flat.rotor... but it's almost there. 19:02
AlexDaniel m: .say for <a b c d e f>.rotor(2 => -1, 1, :partial) 19:17
camelia (a b)
(b)
(c d)
(d)
(e f)
(f)
AlexDaniel m: .say for <a b c d e f>.rotor(2 => 0, 1, :partial)
camelia (a b)
(c)
(d e)
(f)
AlexDaniel m: .say for <a b c d e f>.rotor(2 => -2, 1, :partial)
camelia (a b)
(a b c d e f)
AlexDaniel why?
c: 2016.12 .say for <a b c d e f>.rotor(2 => -2, 1, :partial) 19:19
committable6 AlexDaniel, ¦2016.12: «(a b)␤(a)␤(b c)␤(b)␤(c d)␤(c)␤(d e)␤(d)␤(e f)␤(e)␤(f)»
AlexDaniel :|
DrForr Eeh, I've already got .next and .previous and I'll probably want to augment those, I'll just use those accessors. 19:46
DrForr It needs parent and children anyway, so next and previous aren't an issue. 19:51
spebern is there a nice way in native call to have an array of structs? 20:53
yoleaux 13 Mar 2017 08:32Z <DrForr> spebern: Sadly I have not had the time. Or rather, if I'm being honest, I've been focused on the perltidy/perl-parser stuff. I have something at home that's halfway rewritten to post-GLR where I've brute-forced the grammar actions to do what I want, but it's incomplete.
13 Mar 2017 08:32Z <DrForr> spebern: And thank you *very* much for your enthusiasm for the project, it's really refreshing.
spebern not an array of pointer to structs
IOninja hm, weird. Can't repro this any more on 2017.02 Rakudo :/ twitter.com/zoffix/status/838775119170383874 21:07
the too many file handles
IOninja tries on 9da6de4 21:10
lizmat IOninja: .IO.lines will read in all lines of the file before returning the Seq 21:12
AlexDaniel IOninja: what's in the input file?
lizmat and so is able to close the handle 21:13
IOninja lizmat: on HEAD. I'm trying earlier commits.
AlexDaniel: same as in the original
AlexDaniel IOninja: which is? I wanted to try bisecting it
ah
I'm blind
nevermind
IOninja echo -e 'a\nb\nc' > lines
lizmat IOninja: before 0083c4ff25584a133 it will exhaust 21:14
IOninja I tried on 2017.02. But I think the later .iterator changes affected or something...
Yeah, works on 9da6de4 21:15
AlexDaniel: so never mind :)
Voldenet m: my @x := gather { take "test" }; say @a.shift 21:45
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@a' is not declared
at <tmp>:1
------> 3my @x := gather { take "test" }; say 7⏏5@a.shift
Voldenet m: my @x := gather { take "test" }; say @x.shift
camelia Type check failed in binding; expected Positional but got Seq (("test",).Seq)
in block <unit> at <tmp> line 1
IOninja You can't shift a Seq even if it were Positional. 21:46
Voldenet oh
Voldenet I wanted to try writing some coroutines using some 5-years old perl6advent article, no wonder it's not the same ;P 21:47
IOninja m: my @x = lazy gather { take "test"; say 'meows'; take 'test2'; say "w00t" }; while @x { say @x.shift; say "♥"; } 22:02
camelia test

meows
test2

w00t
nadim I rememeber, but am probably wrong, reading about creating a hash, or was it a capture, this way: $a =1 ; my &h = { :$s } or something like it, eg create the key from the variable name and get the value in the same shot. Am I dreaming?, was it for something else? 22:05
IOninja nadim: you got it right. 22:07
huggable: colonpair
huggable IOninja, nothing found
IOninja huggable: colonpairs
huggable IOninja, All the shortcuts of colonpairs: twitter.com/zoffix/status/839807414211854337
IOninja nadim: ^
nadim: oh wait, that's not it. 22:08
:) but it is a shortcut
m: :$*foo, :$foo, :$!foo, :$.foo, :&foo, :@foo, :%foo all work IIRC
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$foo' is not declared
at <tmp>:1
------> 3:$*foo, :7⏏5$foo, :$!foo, :$.foo, :&foo, :@foo, :%fo
IOninja s/m://
and :%.foo and :@.foo 22:09
nadim it worked like I though, but I must admit that I don't understgand what you are talking about now :) 22:10
IOninja and :%!foo and :@!foo
nadim what are those?
IOninja All of these are variables/accessors/attributes
And they all work as shortcuts
nadim documented somewhere? 22:11
IOninja shrugs 22:12
probably
m: dd class Foo { has $.a1 = 'a1'; has @.a2 = ['a2']; has %.a3 = :3a; has &.a4 = {;}; method foo { my $a5 = 'a5'; my @a6 = ['a6']; my %a7 = :7a; sub a8 {}; [%( :$!a1, :@.a2, :%.a3, :&.a4), %( :$!a1, :@.a2, :%.a3, :&.a4), %(:$a5, :@a6, :%a7, :&a8) ] } }.new.foo 22:14
camelia [{:a1("a1"), :a2($["a2"]), :a3(${:a(3)}), :a4(-> ;; $_? is raw { #`(Block|60494216) ... })}, {:a1("a1"), :a2($["a2"]), :a3(${:a(3)}), :a4(-> ;; $_? is raw { #`(Block|60494216) ... })}, {:a5("a5"), :a6($["a6"]), :a7(${:a(7)}), :a8(sub a8 () { #`(Sub|64713…
IOninja m: my $*foo = 'foo'; dd %(:$?FILE, :$*foo) 22:16
camelia Hash % = {:FILE("<tmp>"), :foo("foo")}
IOninja I think that covers everything \o/
rindolf nadim: hi 22:26
nadim rindolf: evening! 22:30
nadim what does one use in capture to not capture? Mu? Any? undef? 22:31
lizmat | 22:32
?
sub a(|) { }
rindolf nadim: how are you?
nadim rindolf: looking into p6 again 22:36
rindolf nadim: ah, nice 22:37
nadim finxing Data::Dump::Tree and commenting the examples 22:38
lizmat: I call a set of methods, the methods take three arguments. one of the methods doesn't care about one of the argument, I want to not unpack it. IE: multy sub sorter(HAsh $h, do_not_care, Int $i) 22:40
I could just write $dont_care but it's ugly
lizmat m: sub a($a,$,$b) { dd $a,$b }; a 1,2,3 22:41
camelia Int $a = 1
Int $b = 3
lizmat just $ will do
nadim nice but doesn't that put it in the default $ 22:42
IE, does it unpack it? I want to ignore it altogether, if possible
IOninja nadim: what's "default $"? The $ is anonymous. You can't get to it. Seems as good as ignoring 22:43
nadim probably, I just wondered if there was a way to simply skip its unpacking. not that it would make a big difference. I am not for optimization for the sake of it but if it costs nothing ... 22:48
lizmat nadim: naming it $ will allow an optimizer to skip the unpacking in the future 23:00
you only need to indicate that you don't need it: making it anonymous should be enough for you as a user :-)
nadim great 23:06
IOninja Wondering, how come a slurped file uses almost 5x RAM than the size of the file itself? 23:12
Some of my measurements: twitter.com/zoffix/status/843600777457340416 23:13
geekosaur expansion of mostly 1-byte characters to codepoints?
plus, probably overhead for synthetic grapheme codepoints
AlexDaniel doesn't sound so bad actually!
geekosaur it could be doing what Haskell's String type does :) 23:14
IOninja I see.
AlexDaniel IOninja: just as an idea, what happens if you read it as binary file?
:bin and you'll get a Buf 23:15
geekosaur (linked lists of codepoints. overhead roughly 48 bytes per character with 64 bit words)
IOninja AlexDaniel: uuuh.... in bin mode I'm hitting some sort of a bug due to my test being a sparsefile, I'm guessing.
$ perl6 -e 'dd "file".IO.slurp(:bin)'
Out of range: attempted to read 1000000000 bytes from filehandle
AlexDaniel geekosaur: yea, 4-byte overhead is very little… could be better of course but still 23:16
IOninja: :|
IOninja Here's the code for the bench if you want to play with it: gist.github.com/zoffixznet/77219bc...32e0d898bc
geekosaur that sounds like a libuv safety net being hit, maybe
IOninja edits out the bug-creating `(:bin)` from that paste 23:17
AlexDaniel hmmm maybe if I close firefox I'll be able to run it :)
ah, but the picture doesn't change that much when you increase the file size 23:19
IOninja Yeah, doesn't change at all. The last one is smaller only 'cause part of it is in the swap
AlexDaniel but still, with :bin it's only about 2x 23:21
maybe LTA, but can't call that horrible 23:22
lizmat IOninja: perhaps line 465 in IO::Path needs to be changed from: 23:27
$res := nqp::readfh($PIO,buf8.new,$size)
to
actually, not a one line change
the idea would be to presize the buf8 to the known number of elems 23:28
$res := nqp::readfh($PIO,nqp::setelems(buf8.new,$size),$size) # perhaps this is enough ?
not sure whether nqp::readfh needs an empty buffer, or can take a buffer of the right size 23:29
lizmat AlexDaniel: if nqp::readfh can take a presized buf, then maybe it will only take 1x the amount of memory 23:30
lizmat is tired and goes to bed
IOninja To avoid the bin crash on sparsefile? It FILETEST-S reports it's proper size tho 23:39
not sure what spooky file that other branch is talking about... 23:40
Ah 23:42
Well, I never read from that buf 23:43