»ö« 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 Cabanossi joined
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.
00:05 jeffythedragonsl left 00:07 hlafarge joined 00:17 Actualeyes joined 00:18 Guest27220 left 00:20 Ven joined, Ven left 00:21 hlafarge left
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:);
00:32 Actualeyes left
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
00:42 jjido joined 00:45 lukaramu_ left 00:46 Sound left 00:47 jjido left 00:53 AlexDaniel left 00:57 Cabanossi left 01:00 Cabanossi joined 01:02 aborazmeh joined, aborazmeh left, aborazmeh joined
ugexe i see why perl6 parser fails to install 01:03
github.com/drfor/perl6-Perl6-Parser
typoed their name 01:05
01:16 Actualeyes joined 01:21 sukrishn joined 01:22 nadim left 01:24 espadrine left 01:26 sukrishn left 01:34 bjz joined, MasterDukeMobile joined 01:36 jeffythedragonsl joined 01:40 jeffythedragonsl left 02:14 Cabanossi left 02:15 Cabanossi joined 02:18 ufobat joined 02:19 MasterDukeMobile left 02:21 ufobat left 02:22 adu joined 02:23 drrho joined 02:24 ufobat joined 02:29 TEttinger joined 02:41 aborazmeh left 02:42 Cabanossi left 02:45 ilbot3 left, Cabanossi joined 02:47 ilbot3 joined, ChanServ sets mode: +v ilbot3 02:48 sukrishn joined 02:58 sukrishn left 03:01 labster left 03:07 ufobat left 03:08 adu left 03:18 adu joined 03:34 noganex_ joined 03:36 noganex left 03:59 wamba joined 04:03 raiph left
SmokeMachine [&any-op] should always be equal to the last value of [\&any-op]? 04:03
04:14 adu left 04:23 labster joined 04:32 skids joined 04:34 labster left, labster joined 04:35 labster left, labster joined 04:40 labster left 04:41 labster joined 04:56 BenGoldberg left 04:57 Cabanossi left 04:59 Cabanossi joined 05:28 Cabanossi left 05:29 Cabanossi joined 05:38 agentzh left 06:38 rindolf joined 06:57 bjz left 07:22 r3m joined 07:24 domidumont joined 07:25 Sound joined, domidumont left, darutoko joined 07:29 sukrishn joined 07:30 faraco joined 07:38 bjz joined 07:41 nadim joined 07:45 rindolf left 07:48 jjido joined
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))
07:53 jjido left 08:13 setty1 joined 08:23 faraco left 08:28 rindolf joined 08:29 skids left 08:39 Sound left 08:49 jjido joined 08:52 RabidGravy joined 08:54 jjido left, KDr2_c joined
KDr2_c Anyone knows why does the latest release of rakudo not work on JVM? 08:59
09:02 Cabanossi left 09:05 Cabanossi joined 09:06 TEttinger left, domidumont joined 09:08 effbiai left 09:09 rindolf left 09:10 effbiai joined, effbiai left, effbiai joined, domidumont left 09:11 domidumont joined
RabidGravy I wasn't aware that it wasn't working 09:15
09:23 domidumont left 09:27 sukrishn left
KDr2_c I saw the release note said it is not working on JVM 09:27
09:28 domidumont joined 09:29 sukrishn joined 09:30 domidumont left 09:31 domidumont joined 09:35 agentzh joined 09:38 sena_kun joined
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
09:40 agentzh left 09:42 rindolf joined 09:48 n1ce left 09:49 n1ce joined 09:50 domidumont left 10:04 hlafarge joined 10:15 girafe left
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)
10:27 tokomer joined
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
10:27 bjz_ joined
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
10:28 bjz left
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!
10:50 Cabanossi left 10:53 Cabanossi joined 10:54 lukaramu joined 11:03 Ven joined 11:04 Ven is now known as Guest61044 11:05 labster left, jjido joined 11:11 jjido left 11:12 Guest61044 left 11:13 Ven_ joined 11:15 titsuki_ left 11:18 Ven_ left 11:22 sukrishn left
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)
11:37 Cabanossi left 11:39 Cabanossi joined 11:40 tokomer left
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
12:01 sukrishn joined, bjz_ left 12:10 bjz joined 12:19 hlafarge left 12:37 Cabanossi left 12:39 Cabanossi joined
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?
13:07 Cabanossi left 13:09 Cabanossi joined
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
13:13 espadrine joined
dalek on: 32c43c0 | moritz++ | README.md:
README: fix indention
13:13
13:17 bjz left
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 :)
13:35 lukaramu_ joined 13:37 agentzh joined 13:38 lukaramu left 13:41 faraco joined, agentzh left 13:57 KDr2_c left
IOninja gfldex │ spectesting is a slow business :-| 14:03
Are you using TEST_JOBS=8 or whatever many cores you have? 14:04
14:09 nhywyll joined 14:35 gdonald left, gdonald joined 14:39 EGD joined
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
14:59 AlexDaniel joined
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.
15:07 cibs left
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?
15:08 cibs joined
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
15:23 Cabanossi left 15:24 Cabanossi joined 15:26 nhywyll left 15:31 sena_kun left, ggoebel left 15:34 xinming left 15:35 xinming joined 15:38 mr-foobar left 15:44 ggoebel joined 15:49 sena_kun joined 15:50 zakharyas joined, domidumont joined 15:52 gdonald left, gdonald joined 16:00 Sound joined 16:01 jsoo joined 16:04 jsoo left 16:05 Tonik joined 16:06 cognominal left
Geth doc: e386d330cc | (Wenzel P. P. Peppmeyer)++ | doc/Language/mop.pod6
link to Metamodel::ClassHOW
16:13
16:22 BenGoldberg joined
moritz lol I blogged: perlgeek.de/blog-en/perl-6/2017-01...ython.html 16:30
16:30 dj_goku joined 16:33 cognominal joined 16:37 khw_ joined 16:47 titsuki joined
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 :)
16:51 faraco left
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
17:00 skids joined 17:04 BenGoldberg left
IOninja m: IO::Spec::Win32.is-absolute('/').say 17:31
camelia True
17:32 bartolin joined
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
17:32 sukrishn left 17:38 agentzh joined 17:43 agentzh left
moritz it seems is-absolute means "absolute inside a volume" on OSes that have volumes 17:44
17:45 kurahaupo__ joined
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
17:54 agentzh joined
IOninja same with &*chdir 17:54
17:56 kurahaupo__ is now known as kurahaupo 18:00 TEttinger joined 18:13 sena_kun left
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
18:22 Cabanossi left
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
18:24 Cabanossi joined
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
18:30 agentzh left
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
18:30 sukrishn joined
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
18:36 agentzh joined
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
18:43 Sound left
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
18:45 espadrine left
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
18:51 jonadab is now known as xumebed
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
18:53 Tonik left
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
19:05 zakharyas left 19:12 darutoko left 19:13 spebern joined 19:14 girafe joined
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 :|
19:31 agentzh left 19:34 espadrine joined 19:43 wamba left 19:45 agentzh joined
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
19:47 bjz joined
DrForr It needs parent and children anyway, so next and previous aren't an issue. 19:51
19:52 bjz_ joined, Cabanossi left, bjz left 19:54 Cabanossi joined 19:59 cibs left 20:00 sQuEE joined 20:01 cibs joined, zakharyas joined 20:30 _28_ria left 20:46 Sgeo left 20:48 Sgeo joined 20:52 Cabanossi left
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
20:54 Cabanossi joined 20:59 SCHAAP137 joined 21:03 bjz_ left
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 :)
21:17 zakharyas left 21:23 Cabanossi left 21:24 Cabanossi joined 21:26 EGD left 21:30 bjz joined 21:36 labster joined 21:39 bjz left 21:41 sukrishn left
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
21:47 xumebed is now known as jonadab, domidumont left
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
21:52 Cabanossi left 21:53 Sgeo left 21:54 aindilis left, Cabanossi joined, Sgeo joined
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
22:06 RabidGravy left, cpage_ joined
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/
22:18 gdonald left, gdonald joined
rindolf nadim: hi 22:26
22:29 Sgeo left
nadim rindolf: evening! 22:30
22:31 Sgeo joined
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
22:48 rindolf left 22:50 BenGoldberg joined, setty1 left 22:51 girafe left
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
23:10 sukrishn joined
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
23:16 labster left
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
23:23 labster joined
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
23:29 cpage_ left, spebern left
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
23:44 Sound joined 23:52 Cabanossi left 23:54 Cabanossi joined