Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-03-19

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 Cabanossi joined #perl6
00:01 geekosaur and yet people did
00:03 geekosaur another example: @ in doublequoted strings was treated literally until perl 4; any script using literal @s needed to have escapes added.
00:03 geekosaur *usually*, but not always, breakage was limited to major releases.
00:07 hlafarge joined #perl6
00:17 Actualeyes joined #perl6
00:20 Ven joined #perl6
00:21 timotimo the cool thing is that you can just put @ into strings in perl6 now <3
00:21 timotimo unless you have html tags :P
00:23 AlexDaniel m: my @a = <hello world>; say “this is a @a test”
00:23 camelia rakudo-moar bfbe42: OUTPUT: «this is a @a test␤»
00:23 AlexDaniel m: my @a = <hello world>; say “this is a $@a test”
00:23 camelia rakudo-moar bfbe42: OUTPUT: «this is a hello world test␤»
00:24 timotimo m: my @a = <hello world>; say "this is a @a[] test";
00:24 camelia rakudo-moar bfbe42: OUTPUT: «this is a hello world test␤»
00:26 AlexDaniel m: my @a = <hello world>; say “this is a $:: test”
00:26 camelia rakudo-moar bfbe42: OUTPUT: «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”␤»
00:26 AlexDaniel ehhh…
00:26 timotimo huh, what is \/ supposed to be in json?
00:26 timotimo apparently it's supposed to be /
00:26 timotimo oh, but i implemented that!
00:27 AlexDaniel m: say ($:)
00:27 camelia rakudo-moar bfbe42: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '&infix:<:>' is not declared␤at <tmp>:1␤------> 3say ($7⏏5:)␤»
00:29 AlexDaniel camelia: huh, wouldn't it be weirder if it was declared?
00:32 AlexDaniel m: no strict; say (++$b); say $b
00:32 camelia rakudo-moar bfbe42: OUTPUT: «1␤1␤»
00:32 AlexDaniel m: no strict; say (++$:);
00:32 camelia rakudo-moar bfbe42: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '&infix:<:>' is not declared␤at <tmp>:1␤------> 3no strict; say (++$7⏏5:);␤»
00:40 IOninja m: sub infix:<:> {}; say ($:)
00:40 camelia rakudo-moar bfbe42: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Calling infix:<:>(Mu) will never work with declared signature ()␤at <tmp>:1␤------> 3sub infix:<:> {}; say ($7⏏5:)␤»
00:40 IOninja m: sub infix:<:> {@_}; say ($:)
00:40 camelia rakudo-moar bfbe42: OUTPUT: «[(Any)]␤»
00:40 IOninja heh
00:42 jjido joined #perl6
01:00 Cabanossi joined #perl6
01:02 aborazmeh joined #perl6
01:02 aborazmeh joined #perl6
01:03 ugexe i see why perl6 parser fails to install
01:03 ugexe https://github.com/drfor/perl6-Perl6-Parser
01:05 ugexe typoed their name
01:16 Actualeyes joined #perl6
01:21 sukrishn joined #perl6
01:34 bjz joined #perl6
01:34 MasterDukeMobile joined #perl6
01:36 jeffythedragonsl joined #perl6
02:15 Cabanossi joined #perl6
02:18 ufobat joined #perl6
02:22 adu joined #perl6
02:23 drrho joined #perl6
02:24 ufobat joined #perl6
02:29 TEttinger joined #perl6
02:47 ilbot3 joined #perl6
02:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
02:48 sukrishn joined #perl6
03:18 adu joined #perl6
03:34 noganex_ joined #perl6
03:59 wamba joined #perl6
04:03 SmokeMachine [&any-op] should always be equal to the last value of [\&any-op]?
04:23 labster joined #perl6
04:32 skids joined #perl6
04:34 labster joined #perl6
04:35 labster joined #perl6
04:41 labster joined #perl6
04:59 Cabanossi joined #perl6
05:29 Cabanossi joined #perl6
06:38 rindolf joined #perl6
07:22 r3m joined #perl6
07:24 domidumont joined #perl6
07:25 Sound joined #perl6
07:25 darutoko joined #perl6
07:29 sukrishn joined #perl6
07:30 faraco joined #perl6
07:38 bjz joined #perl6
07:41 nadim joined #perl6
07:48 jjido joined #perl6
07:48 faraco m: say "mix"x5 if "cat" eq 'cat'
07:48 camelia rakudo-moar bfbe42: OUTPUT: «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…»
07:48 faraco m: say "mix" if "cat" eq 'cat'
07:48 camelia rakudo-moar bfbe42: OUTPUT: «mix␤»
07:49 faraco m: say "mix" X 5 if "cat" eq 'cat'
07:49 camelia rakudo-moar bfbe42: OUTPUT: «((mix 5))␤»
08:13 setty1 joined #perl6
08:28 rindolf joined #perl6
08:49 jjido joined #perl6
08:52 RabidGravy joined #perl6
08:54 KDr2_c joined #perl6
08:59 KDr2_c Anyone knows why does the latest release of rakudo not work on JVM?
09:05 Cabanossi joined #perl6
09:06 domidumont joined #perl6
09:10 effbiai joined #perl6
09:10 effbiai joined #perl6
09:11 domidumont joined #perl6
09:15 RabidGravy I wasn't aware that it wasn't working
09:27 KDr2_c I saw the release note said it is not working on JVM
09:28 domidumont joined #perl6
09:29 sukrishn joined #perl6
09:31 domidumont joined #perl6
09:35 agentzh joined #perl6
09:37 sena_kun joined #perl6
09:39 geekosaur incompatible changes to unicode handliing, I think
09:39 geekosaur it's been catching up the last few days, but that didn't make the release
09:42 rindolf joined #perl6
09:49 n1ce joined #perl6
10:04 hlafarge joined #perl6
10:21 nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2) dd X ;
10:21 camelia rakudo-moar bfbe42: OUTPUT: «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…»
10:21 nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2) ; dd X ;
10:21 camelia rakudo-moar bfbe42: OUTPUT: «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…»
10:21 nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd X ;
10:21 camelia rakudo-moar bfbe42: OUTPUT: «X␤»
10:22 nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2} ; dd X() ;
10:22 camelia rakudo-moar bfbe42: OUTPUT: «X(Any)␤»
10:23 geekosaur more namespace fun, I see
10:24 nadim m: sub get_data {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2}  dd get_data() ;
10:24 camelia rakudo-moar bfbe42: OUTPUT: «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() ;
10:25 camelia rakudo-moar bfbe42: OUTPUT: «({:a(1)}, {:b(2)})␤»
10:25 nadim m: sub XX {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2}  ; dd XX() ;
10:25 camelia rakudo-moar bfbe42: OUTPUT: «({:a(1)}, {:b(2)})␤»
10:25 nadim m: sub X {my %h1 = a => 1 ; my %h2 = b => 2; return %h1, %h2}  ; dd X() ;
10:25 camelia rakudo-moar bfbe42: OUTPUT: «X(Any)␤»
10:27 tokomer joined #perl6
10:27 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
10:27 geekosaur so X is taken as a namespace, and that's not being handled right here
10:27 bjz_ joined #perl6
10:28 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 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 rakudo-moar bfbe42: OUTPUT: «({:a(1)}, {:b(2)})␤Hash %h1 = {:a(1), :b(2)}␤Hash %h2 = {}␤»
10:31 nadim %h1 slurps all the returned values, how do I make my (%h1, %h2) = ...  non slurpy?
10:32 nadim without changing %h1 to $h1
10:33 geekosaur I think you have to itemize the returns?
10:33 geekosaur 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:33 camelia rakudo-moar bfbe42: OUTPUT: «(${:a(1)}, ${:b(2)})␤Hash %h1 = {"a\t1" => ${:b(2)}}␤Hash %h2 = {}␤»
10:34 geekosaur nope :/
10:34 nadim :)
10:34 nadim but the idea was good
10:34 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 :/
10:34 nadim Bed!
10:53 Cabanossi joined #perl6
10:54 lukaramu joined #perl6
11:03 Ven joined #perl6
11:05 jjido joined #perl6
11:13 Ven_ joined #perl6
11:25 unclechu hey guys, how do i get/set environment variable in perl6?
11:27 lizmat m: say %*ENV<PATH>
11:27 camelia rakudo-moar bfbe42: OUTPUT: «/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␤»
11:28 unclechu lizmat: thanks)
11:29 lizmat m: %*ENV<FOO> = 42; shell q/echo $FOO/
11:29 camelia rakudo-moar bfbe42: OUTPUT: «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␤␤»
11:29 unclechu pretty consistent along with stdout/err/in
11:29 lizmat yup
11:35 timotimo geekosaur: X() is a coercion type
11:35 timotimo m: dd X(Cool)
11:35 camelia rakudo-moar bfbe42: OUTPUT: «X(Cool)␤»
11:35 timotimo m: dd X(Any)
11:35 camelia rakudo-moar bfbe42: OUTPUT: «X(Any)␤»
11:35 timotimo m: dd X()
11:35 camelia rakudo-moar bfbe42: OUTPUT: «X(Any)␤»
11:39 Cabanossi joined #perl6
11:41 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:42 timotimo you can use @foobar[1..*]
11:44 unclechu timotimo: thanks, that works
11:44 timotimo no prob
11:45 lizmat m: my @a = ^10; .say for @a.skip(1)  # unclechu
11:45 camelia rakudo-moar bfbe42: OUTPUT: «1␤2␤3␤4␤5␤6␤7␤8␤9␤»
11:46 unclechu lizmat: thanks, a lot better)
11:46 lizmat m: my @a = ^10; .say for @a.skip  # better
11:46 camelia rakudo-moar bfbe42: OUTPUT: «1␤2␤3␤4␤5␤6␤7␤8␤9␤»
11:46 unclechu lizmat_:
11:46 lizmat afk for some more schlepping&
11:46 unclechu hmm.. it looks like it isn't working for immutable List
11:47 timotimo that's strange. it's an iterator-y method
11:47 unclechu `$ perl6 -e '%*ENV<PATH>.split(<:>).skip(1).print'`
11:47 unclechu `No such method 'skip' for invocant of type 'List' in block <unit> at -e line`
11:47 lizmat m: my $a = (0,1,2,3); .say for $a.skip  # seems to work ok?
11:47 camelia rakudo-moar bfbe42: OUTPUT: «1␤2␤3␤»
11:48 timotimo what version you at?
11:48 timotimo skip is a little new-ish
11:48 unclechu `This is Rakudo version 2017.01 built on MoarVM version 2017.01`
11:49 lizmat yeah, skip seems to be post 2017.01
11:50 unclechu lizmat: okay, will keep that in mind
11:50 lizmat looks like 8a6bfc68a87bed7c6c introduced it, which was Jan 21
11:51 lizmat "I've waited to push this until
11:51 lizmat after the 2017.01 release, so that we have about a month to revert it
11:51 lizmat should it be considered an addition we could do without"  :-)
11:52 lizmat really afk&
11:55 gfldex spectesting is a slow business :-|
11:58 timotimo get more cores :)
12:01 sukrishn joined #perl6
12:10 bjz joined #perl6
12:39 Cabanossi joined #perl6
13:06 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 rakudo-moar bfbe42: OUTPUT: «({:a(1)}, {:b(2)})␤Hash %h1 = {:a(1), :b(2)}␤Hash %h2 = {}␤»
13:06 nadim given the above, how do I get %h1 and %h2 set with what the sub sends back?
13:09 Cabanossi joined #perl6
13:13 dalek json: 20f4bce | moritz++ | README (2 files):
13:13 dalek json: README -> README.md
13:13 dalek json:
13:13 dalek json: also remove mention of ufo. Closes #28
13:13 dalek json: review: https://github.com/moritz/json/commit/20f4bced28
13:13 yoleaux 26 Feb 2017 04:25Z <AlexDaniel> dalek: ahoi, please update that repo to use geth instead: Change the webhook to https://geth.perl6.party/?chan=#perl6-dev (or #moarvm for moarvm), Content-type: application/json and "Send me everything."
13:13 yoleaux 14 Mar 2017 19:15Z <IOninja> dalek: you're a deficient bot
13:13 espadrine joined #perl6
13:13 dalek json: 32c43c0 | moritz++ | README.md:
13:13 dalek json: README: fix indention
13:13 dalek json: review: https://github.com/moritz/json/commit/32c43c0bf0
13:22 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 rakudo-moar bfbe42: OUTPUT: «Mu␤Mu␤»
13:23 gfldex nadim: ^^^ that should work (in my eyes) but doesnt. You may have stepped on a bug.
13:29 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 rakudo-moar bfbe42: OUTPUT: «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␤»
13:30 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 rakudo-moar bfbe42: OUTPUT: «Type check failed in binding to '<anon>'; expected Positional but got Hash (${:a(1)})␤  in block <unit> at <tmp> line 1␤␤»
13:30 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 rakudo-moar bfbe42: OUTPUT: «Hash %h1 = {:a(1)}␤Hash %h2 = {:b(2)}␤»
13:30 gfldex i take that back :)
13:35 lukaramu_ joined #perl6
13:37 agentzh joined #perl6
13:41 faraco joined #perl6
14:03 IOninja gfldex │ spectesting is a slow business :-|
14:04 IOninja Are you using TEST_JOBS=8 or whatever many cores you have?
14:09 nhywyll joined #perl6
14:35 gdonald joined #perl6
14:39 EGD joined #perl6
14:41 gfldex IOninja: i didn't but will
14:51 IOninja Wonder why we don't default to something saner than 1.... for that env var...
14:53 * RabidGravy concludes that implementing an EventSource client using its own HTTP client is a mugs game and moves on
14:59 AlexDaniel joined #perl6
14:59 AlexDaniel .tell dalek ahoi, please update that repo to use geth instead: Change the webhook to https://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.
15:00 AlexDaniel moritz: did you already change https://github.com/moritz/json to use Geth or not yet?
15:02 moritz AlexDaniel: it seem I didn't
15:03 moritz huggable: geth?
15:03 huggable moritz, nothing found
15:04 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.
15:04 moritz though I wonder if we want push notifications from perl6/json
15:04 moritz at all in here
15:05 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
15:05 jdv79 so then ::Tiny will be a partial impl of the spec?
15:05 moritz JSON::Tiny encodes strings in a spec compliant way, and one is enough
15:05 timotimo do you have to put a ? at the end?
15:05 timotimo huggable: geth
15:05 huggable timotimo, nothing found
15:05 timotimo OK
15:05 timotimo huggable: dalek
15:05 huggable timotimo, nothing found
15:05 timotimo huggable: dalek?
15:05 huggable timotimo, nothing found
15:05 timotimo fair enough
15:06 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 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
15:07 jdv79 that's not what i was talkking about.  this ticket was about encoding unicode or not
15:07 moritz jdv79: I understand
15:07 jdv79 i meant timotimo on that last one
15:07 timotimo oh!
15:08 jdv79 cool.  i think i woke up and wasted enough of everyone's time in misremembering
15:08 jdv79 thanks!
15:08 timotimo huh ... what did i miss?
15:08 cibs joined #perl6
15:08 moritz timotimo: https://github.com/moritz/json/issues/27
15:09 timotimo oh, does json::tiny turn all unicode characters into escape sequences?
15:10 timotimo er i mean
15:10 timotimo all non-ascii unicode character
15:13 moritz I think so, yes
15:13 timotimo didn't know that
15:22 faraco o/
15:24 Cabanossi joined #perl6
15:35 xinming joined #perl6
15:44 ggoebel joined #perl6
15:49 sena_kun joined #perl6
15:50 zakharyas joined #perl6
15:50 domidumont joined #perl6
15:52 gdonald joined #perl6
16:00 Sound joined #perl6
16:01 jsoo joined #perl6
16:05 Tonik joined #perl6
16:13 Geth ¦ doc: e386d330cc | (Wenzel P. P. Peppmeyer)++ | doc/Language/mop.pod6
16:13 Geth ¦ doc: link to Metamodel::ClassHOW
16:13 Geth ¦ doc: review: https://github.com/perl6/doc/commit/e386d330cc
16:22 BenGoldberg joined #perl6
16:30 moritz lol I blogged: https://perlgeek.de/blog-en/perl-6/2017-012-inline-python.html
16:30 dj_goku joined #perl6
16:33 cognominal joined #perl6
16:37 khw_ joined #perl6
16:47 titsuki joined #perl6
16:50 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
16:50 bisectable6 AlexDaniel, bisect log: https://gist.github.com/43c1626229a204c085acb06d3573118f
16:50 bisectable6 AlexDaniel, (2017-03-01) https://github.com/rakudo/rakudo/commit/f9eb811dd20074e902debddcb2de426d700335de
16:50 IOninja moritz: FWIW syntax highlighting would make those examples more palatable :)
16:51 IOninja m: dd WHAT qw<x>; dd WHAT 'x'.words
16:51 camelia rakudo-moar fbe7ac: OUTPUT: «Str␤Seq␤»
16:51 IOninja m: dd WHAT qw<x y>; dd WHAT 'x'.words
16:51 camelia rakudo-moar fbe7ac: OUTPUT: «List␤Seq␤»
16:51 moritz IOninja: the ebook version has syntax hilighting :-)
16:51 IOninja just sayin' :)
16:51 moritz IOninja: appreciated
16:56 AlexDaniel IOninja: yeah, it's just that we have a broken example in our docs. See this: https://github.com/perl6/doc/issues/1252
16:58 Geth ¦ doc: 29f13e6f39 | (Zoffix Znet)++ | doc/Language/quoting.pod6
16:58 Geth ¦ doc: Fix broken example
16:58 Geth ¦ doc:
16:58 Geth ¦ doc: Fixes #1252
16:58 Geth ¦ doc: review: https://github.com/perl6/doc/commit/29f13e6f39
16:58 AlexDaniel ah, okay
17:00 skids joined #perl6
17:31 IOninja m: IO::Spec::Win32.is-absolute('/').say
17:31 camelia rakudo-moar fbe7ac: OUTPUT: «True␤»
17:32 bartolin joined #perl6
17:32 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:38 agentzh joined #perl6
17:44 moritz it seems is-absolute means "absolute inside a volume" on OSes that have volumes
17:45 kurahaupo__ joined #perl6
17:45 IOninja But why?
17:47 IOninja 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:50 IOninja 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:51 moritz agreed, it's weird
17:51 moritz though iirc windows has a working directory per volume, no?
17:51 moritz (which means I have no idea what chdir() actually does)
17:53 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 IOninja "C:\$Recycle.Bin".IO
17:53 IOninja "E:\$RECYCLE.BIN".IO
17:54 agentzh joined #perl6
17:54 IOninja same with &*chdir
18:00 TEttinger joined #perl6
18:17 bolangi paranoidd: I've requested action from github about supporting Edit on pages located in subdirectories.
18:17 bolangi Ooops, sorry, wrong channel.
18:19 mst bolangi: neat nonetheless. good luck.
18:20 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:21 mst I quite like the idea
18:21 mst except I'd call it $.with-lookahead(2) I think
18:21 mst took me a moment to understand it
18:22 DrForr Yeah, I can see that. It's just returning an iterator for special needs.
18:23 DrForr I should be able to do this with .rotor(3 => -2), but that does @x.elems - 2 iterations.
18:24 bolangi mst: Thanks and greetings!
18:24 Cabanossi joined #perl6
18:24 mst I don't honestly understand rotor
18:25 DrForr Oh, I get the idea. It just doesn't *quite* work for me.
18:26 ugexe I generally use rotor as a natatime
18:26 timotimo DrForr: i think you want :partial?
18:26 timotimo or is that not enough?
18:27 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:28 DrForr (a b | b c | c d ) # .rotor(2 => -1, :partial)
18:28 DrForr (a b | b c | c d | d (Any) ) # what I want.
18:28 timotimo ah
18:29 timotimo i could see an extension to :partial
18:30 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 sukrishn joined #perl6
18:32 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
18:32 AlexDaniel m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y?) { say “$x ↔ {$y // ‘bla’}” }
18:32 camelia rakudo-moar fbe7ac: OUTPUT: «a ↔ b␤b ↔ c␤c ↔ d␤d ↔ bla␤»
18:32 IOninja m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y = 'blah') { say “$x ↔ $y” }
18:32 camelia rakudo-moar fbe7ac: OUTPUT: «a ↔ b␤b ↔ c␤c ↔ d␤d ↔ blah␤»
18:33 AlexDaniel m: for <a b c d>.rotor(2 => -1, :partial) -> ($x, $y = Any) { say “$x ↔ $y” }
18:33 camelia rakudo-moar fbe7ac: OUTPUT: «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 ↔ ␤»
18:33 AlexDaniel oops… well, yes
18:33 AlexDaniel IOninja++, didn't think about this
18:34 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]}
18:34 camelia rakudo-moar fbe7ac: OUTPUT: «(("a", "b"), ("b", "c"), ("c", "d"), ("d", Nil)).Seq␤»
18:35 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
18:35 DrForr It does mean a few more test cases, I have to have lists with lengths where $x % 3 == {0,1,2}.
18:36 agentzh joined #perl6
18:38 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:38 camelia rakudo-moar fbe7ac: OUTPUT: «Two: a b␤Two: b c␤Two: c d␤A-ha! Only one: d␤»
18:39 AlexDaniel DrForr: or maybe even something like this?
18:40 AlexDaniel 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 rakudo-moar fbe7ac: OUTPUT: «Two: a b␤Two: b c␤Two: c d␤A-ha! Only one: d␤»
18:40 AlexDaniel though maybe the second case needs unpacking too
18:40 AlexDaniel ah, you don't need @ there
18:40 AlexDaniel 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 rakudo-moar fbe7ac: OUTPUT: «Two: a b␤Two: b c␤Two: c d␤A-ha! Only one: d␤»
18:41 AlexDaniel yea
18:42 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
18:43 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” }
18:43 camelia rakudo-moar fbe7ac: OUTPUT: «Two: a b␤Two: b c␤Two: c d␤A-ha! Only one: d␤»
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” }
18:43 camelia rakudo-moar fbe7ac: OUTPUT: «Two: a b␤Two: b c␤Two: c d␤A-ha! Only one: d␤»
18:45 DrForr At least this way I've only got the one loop to deal with. It works, at least so far.
18:49 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:50 DrForr I think I merged it about an hour ago, actually.
18:51 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:59 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) # ...
19:02 DrForr Well, .flat.rotor... but it's almost there.
19:13 spebern joined #perl6
19:14 girafe joined #perl6
19:17 AlexDaniel m: .say for <a b c d e f>.rotor(2 => -1, 1, :partial)
19:17 camelia rakudo-moar fbe7ac: OUTPUT: «(a b)␤(b)␤(c d)␤(d)␤(e f)␤(f)␤»
19:17 AlexDaniel m: .say for <a b c d e f>.rotor(2 => 0, 1, :partial)
19:17 camelia rakudo-moar fbe7ac: OUTPUT: «(a b)␤(c)␤(d e)␤(f)␤»
19:17 AlexDaniel m: .say for <a b c d e f>.rotor(2 => -2, 1, :partial)
19:17 camelia rakudo-moar fbe7ac: OUTPUT: «(a b)␤(a b c d e f)␤»
19:17 AlexDaniel why?
19:19 AlexDaniel 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)»
19:19 AlexDaniel :|
19:34 espadrine joined #perl6
19:45 agentzh joined #perl6
19:46 DrForr Eeh, I've already got .next and .previous and I'll probably want to augment those, I'll just use those accessors.
19:47 bjz joined #perl6
19:50 DrForr It needs parent and children anyway, so next and previous aren't an issue.
19:52 bjz_ joined #perl6
19:54 Cabanossi joined #perl6
20:00 sQuEE joined #perl6
20:01 cibs joined #perl6
20:01 zakharyas joined #perl6
20:48 Sgeo joined #perl6
20:53 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.
20:53 yoleaux 13 Mar 2017 08:32Z <DrForr> spebern: And thank you *very* much for your enthusiasm for the project, it's really refreshing.
20:53 spebern not an array of pointer to structs
20:54 Cabanossi joined #perl6
20:59 SCHAAP137 joined #perl6
21:07 IOninja hm, weird. Can't repro this any more on 2017.02 Rakudo :/ https://twitter.com/zoffix/status/838775119170383874
21:07 IOninja the too many file handles
21:10 * IOninja tries on 9da6de4
21:12 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?
21:13 lizmat and so is able to close the handle
21:13 IOninja lizmat: on HEAD. I'm trying earlier commits.
21:13 IOninja AlexDaniel: same as in the original
21:13 AlexDaniel IOninja: which is? I wanted to try bisecting it
21:13 AlexDaniel ah
21:13 AlexDaniel I'm blind
21:13 AlexDaniel nevermind
21:13 IOninja echo -e 'a\nb\nc' > lines
21:14 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...
21:15 IOninja Yeah, works on 9da6de4
21:15 IOninja AlexDaniel: so never mind :)
21:24 Cabanossi joined #perl6
21:30 bjz joined #perl6
21:36 labster joined #perl6
21:45 Voldenet m: my @x := gather { take "test" }; say @a.shift
21:45 camelia rakudo-moar fbe7ac: OUTPUT: «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␤»
21:45 Voldenet m: my @x := gather { take "test" }; say @x.shift
21:45 camelia rakudo-moar fbe7ac: OUTPUT: «Type check failed in binding; expected Positional but got Seq (("test",).Seq)␤  in block <unit> at <tmp> line 1␤␤»
21:46 IOninja You can't shift a Seq even if it were Positional.
21:46 Voldenet oh
21:47 Voldenet I wanted to try writing some coroutines using some 5-years old perl6advent article, no wonder it's not the same ;P
21:54 Cabanossi joined #perl6
21:54 Sgeo joined #perl6
22:02 IOninja m: my @x = lazy gather { take "test"; say 'meows'; take 'test2'; say "w00t" }; while @x { say @x.shift; say "♥";  }
22:02 camelia rakudo-moar fbe7ac: OUTPUT: «test␤♥␤meows␤test2␤♥␤w00t␤»
22:05 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:06 cpage_ joined #perl6
22:07 IOninja nadim: you got it right.
22:07 IOninja huggable: colonpair
22:07 huggable IOninja, nothing found
22:07 IOninja huggable: colonpairs
22:07 huggable IOninja, All the shortcuts of colonpairs: https://twitter.com/zoffix/status/839807414211854337
22:07 IOninja nadim: ^
22:08 IOninja nadim: oh wait, that's not it.
22:08 IOninja :) but it is a shortcut
22:08 IOninja m: :$*foo, :$foo, :$!foo, :$.foo, :&foo, :@foo, :%foo all work IIRC
22:08 camelia rakudo-moar fbe7ac: OUTPUT: «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␤»
22:08 IOninja s/m://
22:09 IOninja and :%.foo and :@.foo
22:10 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
22:10 nadim what are those?
22:10 IOninja All of these are variables/accessors/attributes
22:10 IOninja And they all work as shortcuts
22:11 nadim documented somewhere?
22:12 * IOninja shrugs
22:12 IOninja probably
22:14 IOninja 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 rakudo-moar fbe7ac: OUTPUT: «[{: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…»
22:16 IOninja m: my $*foo = 'foo'; dd %(:$?FILE, :$*foo)
22:16 camelia rakudo-moar fbe7ac: OUTPUT: «Hash % = {:FILE("<tmp>"), :foo("foo")}␤»
22:16 IOninja I think that covers everything \o/
22:18 gdonald joined #perl6
22:26 rindolf nadim: hi
22:30 nadim rindolf: evening!
22:31 Sgeo joined #perl6
22:31 nadim what does one use in capture to not capture? Mu? Any? undef?
22:32 lizmat |
22:32 lizmat ?
22:32 lizmat sub a(|) { }
22:32 rindolf nadim: how are you?
22:36 nadim rindolf:  looking into p6 again
22:37 rindolf nadim: ah, nice
22:38 nadim finxing Data::Dump::Tree and commenting the examples
22:40 nadim 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 nadim I could just write $dont_care but it's ugly
22:41 lizmat m: sub a($a,$,$b) { dd $a,$b }; a 1,2,3
22:41 camelia rakudo-moar 6060bd: OUTPUT: «Int $a = 1␤Int $b = 3␤»
22:41 lizmat just $ will do
22:42 nadim nice but doesn't that put it in the default $
22:42 nadim IE, does it unpack it? I want to ignore it altogether, if possible
22:43 IOninja nadim: what's "default $"? The $ is anonymous. You can't get to it. Seems as good as ignoring
22:48 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:50 BenGoldberg joined #perl6
23:00 lizmat nadim: naming it $ will allow an optimizer to skip the unpacking in the future
23:00 lizmat you only need to indicate that you don't need it:   making it anonymous should be enough for you as a user  :-)
23:06 nadim great
23:10 sukrishn joined #perl6
23:12 IOninja Wondering, how come a slurped file uses almost 5x RAM than the size of the file itself?
23:13 IOninja Some of my measurements: https://twitter.com/zoffix/status/843600777457340416
23:13 geekosaur expansion of mostly 1-byte characters to codepoints?
23:13 geekosaur plus, probably overhead for synthetic grapheme codepoints
23:13 AlexDaniel doesn't sound so bad actually!
23:14 geekosaur it could be doing what Haskell's String type does :)
23:14 IOninja I see.
23:14 AlexDaniel IOninja: just as an idea, what happens if you read it as binary file?
23:15 AlexDaniel :bin and you'll get a Buf
23:15 geekosaur (linked lists of codepoints. overhead roughly 48 bytes per character with 64 bit words)
23:15 IOninja AlexDaniel: uuuh.... in bin mode I'm hitting some sort of a bug due to my test being a sparsefile, I'm guessing.
23:15 IOninja $ perl6 -e 'dd "file".IO.slurp(:bin)'
23:15 IOninja Out of range: attempted to read 1000000000 bytes from filehandle
23:16 AlexDaniel geekosaur: yea, 4-byte overhead is very little… could be better of course but still
23:16 AlexDaniel IOninja: :|
23:16 IOninja Here's the code for the bench if you want to play with it: https://gist.github.com/zoffixznet/77219bc00ebd594417f07e32e0d898bc
23:16 geekosaur that sounds like a libuv safety net being hit, maybe
23:17 * 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 :)
23:18 AlexDaniel 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
23:21 AlexDaniel but still, with :bin it's only about 2x
23:22 AlexDaniel maybe LTA, but can't call that horrible
23:23 labster joined #perl6
23:27 lizmat IOninja: perhaps line 465 in IO::Path needs to be changed from:
23:27 lizmat $res := nqp::readfh($PIO,buf8.new,$size)
23:27 lizmat to
23:27 lizmat actually, not a one line change
23:28 lizmat the idea would be to presize the buf8 to the known number of elems
23:28 lizmat $res := nqp::readfh($PIO,nqp::setelems(buf8.new,$size),$size)  # perhaps this is enough ?
23:29 lizmat not sure whether nqp::readfh needs an empty buffer, or can take a buffer of the right size
23:30 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
23:39 IOninja To avoid the bin crash on sparsefile? It FILETEST-S reports it's proper size tho
23:40 IOninja not sure what spooky file that other branch is talking about...
23:42 IOninja Ah
23:43 IOninja Well, I never read from that buf
23:44 Sound joined #perl6
23:54 Cabanossi joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo