Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-10-30

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:23 aborazmeh joined #perl6
00:23 aborazmeh joined #perl6
00:32 Cabanossi joined #perl6
00:41 kybr joined #perl6
01:02 cdg joined #perl6
01:02 Cabanossi joined #perl6
01:03 darkmorph joined #perl6
01:32 Cabanossi joined #perl6
01:40 redhands joined #perl6
02:12 poohman joined #perl6
02:13 wander joined #perl6
02:18 ch3ck3r joined #perl6
02:19 colomon joined #perl6
02:21 apallatto joined #perl6
02:32 cdg joined #perl6
02:32 bitrauser_ joined #perl6
02:41 Herby_ joined #perl6
02:42 Herby_ o/
02:55 ilbot3 joined #perl6
02:55 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!
03:00 piojo joined #perl6
03:03 Herby_ I'm trying a Python OO exercise, using Perl 6.  I'm stuck.
03:04 Herby_ https://gist.github.com/anonymous/2f2221c3b89040bceff57073dd552aaa
03:04 Herby_ How do I create the "last_id" attribute in p6? For each note created, it should get the next id available
03:09 ugexe ++$
03:09 Herby_ ?
03:09 ugexe or `state $last_id += 1`
03:10 Herby_ do I declare $last_id outside of the class too?
03:10 ugexe not with `state`
03:11 ugexe oh i see
03:12 ugexe m: class Foo { my $last_id = 0; method add { $last_id++ }; method last_id { $last_id } }; Foo.new.add; Foo.new.last_id
03:12 camelia rakudo-moar 1949a2bc1: ( no output )
03:12 ugexe m: class Foo { my $last_id = 0; method add { $last_id++ }; method last_id { $last_id } }; Foo.new.add; Foo.new.last_id.say
03:12 camelia rakudo-moar 1949a2bc1: OUTPUT: «1␤»
03:13 ugexe m: class Foo { my $last_id = 0; method new { $last_id++; self.bless() }; method last_id { $last_id } }; Foo.new; Foo.new.last_id.say
03:13 camelia rakudo-moar 1949a2bc1: OUTPUT: «2␤»
03:14 Herby_ awesome
03:14 Herby_ thanks
03:19 wander C<\n> matches a single, logical newline character. C<\n> is supposed to also
03:19 wander match a Windows CR LF codepoint pair; though it's unclear whether the magic
03:19 wander happens at the time that external data is read, or at regex match time.
03:19 wander unclear?
03:19 wander is it?
03:27 dominix joined #perl6
03:27 dominix hi guys
03:27 ugexe i dont think its unclear, i think its just not what you might expect coming from other languages
03:28 dominix do someone knows about the project V5 ? that is perl5 implemented in rakudo. Is it dead ? stalled ? of no interest ?
03:32 noganex joined #perl6
03:39 geekosaur wander, I think which happens is not part of the spec, but part of the implementation?
03:44 wander agree, spec says "\n matches logical newline"
03:45 wander I think the implementation is, that it happens when external data is read
03:46 ugexe depends, what if you read it in binary and decode it using a decoder that does not do newline translation?
03:46 geekosaur yes, current rakudo-moar at least rewrites text mode newlines to a general newline grapheme
03:47 geekosaur on read
04:17 piojo Zoffix: Thank you. moritz already corrected me once about the %hash<$val> incorrect syntax. I really need to break that habit!
04:24 evalable6 joined #perl6
04:46 Cabanossi joined #perl6
04:53 K_ joined #perl6
04:53 samcv is there a way for modules to know what version they are?
04:54 samcv like some dynamic variable that stores the version number of that installed module?
04:54 K_ Whatsnext?
04:54 samcv ugexe, do you know?
04:54 K_ 32
04:55 K_ ?:
04:55 samcv K_, do you have a question?
04:56 K_ How do i win? And get to walk away without spreading this diseez?
04:56 ugexe samcv: https://github.com/rakudo/rakudo/pull/1132 needs this to do it in a reasonable way, after which point we can possibly add it to .^ver
04:57 samcv ugexe, can we add a --version option to zef now? i always want to know what version i'm running but there's no way
04:57 samcv and i'm guessing a lot of people may expect that to work
04:57 ugexe no, that example is shown in the PR
04:58 samcv oh you mean it adds it as an option by itself
04:59 samcv ok thanks for link to PR
04:59 ugexe it makes it possible for zef to do it
05:16 cdg joined #perl6
05:31 Cabanossi joined #perl6
05:35 sacomo hi all
05:49 wamba joined #perl6
06:00 finanalyst joined #perl6
06:00 Cabanossi joined #perl6
06:01 finanalyst can anyone tell me whether the specification for the META.json file in S22 has been updated?
06:01 finanalyst mostly I am interested in the depends: field
06:08 Mrofnet joined #perl6
06:10 Morfent joined #perl6
06:13 darutoko joined #perl6
06:14 sacomo finanalyst, now sure if the ver, author adverbs work in depends. I haven't seen any modules using them.
06:16 finanalyst sacomo: so far I have seen some ver/author in modules, eg. Bailador. However, I remove these adverbs. My question is about the structure of depends
06:17 finanalyst According to S22, there are two / three structures: a) array of string, b) array of string | hash (which contains hints), c) hash of hash of array of string
06:18 finanalyst Recently, App::Cpan6 started using the hash structure, which broke my analysis program.
06:19 finanalyst Since I originally only took into account array of string, I now want to make more generic. Just checking to see if S22 has full spec
06:23 sacomo yeah, I have only seen the array of strings, App::Cpan6 is the first I have seen use that structure. I think now that the cpan6 effort is underway that will become more common.
06:23 sena_kun joined #perl6
06:29 skqvheallf joined #perl6
06:31 Cabanossi joined #perl6
06:39 Piotr_ joined #perl6
06:41 mempko joined #perl6
06:49 parv joined #perl6
06:56 wander joined #perl6
07:02 wander m: uniname("一").parse-names()
07:02 camelia rakudo-moar 1949a2bc1: OUTPUT: «Unrecognized character name [<CJK Ideograph-4E00>]␤  in block <unit> at <tmp> line 1␤␤»
07:02 wander m: say uniname("一")
07:02 camelia rakudo-moar 1949a2bc1: OUTPUT: «<CJK Ideograph-4E00>␤»
07:03 wander why does `uniname("一").parse-names()` not work?
07:05 wander I have seen rakudo #1031 but still don't know how parse-names work. especially where the dict is
07:16 evalable6 joined #perl6
07:17 Geth ¦ doc: b24a42baee | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
07:17 synopsebot Link: https://doc.perl6.org/language/regexes
07:17 Geth ¦ doc: Update regexes.pod6
07:17 Geth ¦ doc: review: https://github.com/perl6/doc/commit/b24a42baee
07:22 apallatto ~/2
07:23 abraxxa joined #perl6
07:24 domidumont joined #perl6
07:30 domidumont joined #perl6
07:34 Geth ¦ doc/master: 4 commits pushed by (Jeremy Studer)++, (Jarkko Haapalainen)++
07:34 Geth ¦ doc/master: 7263295d2f | Modified Dockerfile for building/hosting docs
07:34 Geth ¦ doc/master: 46136d12ba | Add Docker-related targets to Makefile
07:34 Geth ¦ doc/master: 80d17e6aff | Fixed broken link in CONTRIBUTING file
07:34 Geth ¦ doc/master: 4b72383aa8 | Merge pull request #1637 from jstuder-gh/docker_makefile
07:34 Geth ¦ doc/master: review: https://github.com/perl6/doc/compare/b24a42baee...4b72383aa8
07:34 wander m: say 'abcdefg' ~~ /\w ** {-Inf}/;     # OUTPUT: «「」␤»
07:34 camelia rakudo-moar 1949a2bc1: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:2␤------> 3<BOL>7⏏5»␤    expecting any of:␤        prefix␤        term␤»
07:36 wander m: say 'abcdefg' ~~ /\w ** {-42}/;      # OUTPUT: «「」␤»
07:36 camelia rakudo-moar 1949a2bc1: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:2␤------> 3<BOL>7⏏5»␤    expecting any of:␤        prefix␤        term␤»
07:36 wander m: say 'abcdefg' ~~ /\w ** {-10..-42}/;
07:36 camelia rakudo-moar 1949a2bc1: OUTPUT: «「」␤»
07:36 wander m: say 'abcdefg' ~~ /\w ** {-10..-42}/; # OUTPUT: «「」␤»
07:36 camelia rakudo-moar 1949a2bc1: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:2␤------> 3<BOL>7⏏5»␤    expecting any of:␤        prefix␤        term␤»
07:36 wander m: say 'abcdefg' ~~ /\w ** {-Inf}/;
07:36 camelia rakudo-moar 1949a2bc1: OUTPUT: «「」␤»
07:37 wander it complain "This type (Failure) does not support positional operations   in block <unit> at <unknown file> line 1" on my REPL
07:37 wander This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementing Perl 6.c.
07:38 wander and
07:38 wander m: say 'abcdefg' ~~ /\w ** {-10..-42}/;
07:38 camelia rakudo-moar 1949a2bc1: OUTPUT: «「」␤»
07:38 wander output 「abcdefg」
07:38 wander m: say 'abcdefg' ~~ /\w ** 1..*/;
07:38 camelia rakudo-moar 1949a2bc1: OUTPUT: «「abcdefg」␤»
07:39 geekosaur yes, that was a change within the past few months
07:40 geekosaur (bug fix)
07:41 wander ok, i'm going to get a recent release
07:57 rindolf joined #perl6
08:01 Cabanossi joined #perl6
08:06 wander m: (try say 'abcdefg' ~~ /\w ** {42..10}/  ) orelse say ($!.^name, $!.empty-range);
08:06 camelia rakudo-moar 1949a2bc1: OUTPUT: «(X::Syntax::Regex::QuantifierValue True)␤»
08:07 wander m: (try say 'abcdefg' ~~ /\w ** {42..10}/  ); say ($!.^name, $!.empty-range);
08:07 camelia rakudo-moar 1949a2bc1: OUTPUT: «(X::Syntax::Regex::QuantifierValue True)␤»
08:07 wander m: (try say 'abcdefg' ~~ /\w ** {42..10}/  ) // ($!.^name, $!.empty-range);
08:07 camelia rakudo-moar 1949a2bc1: ( no output )
08:07 wander m: (try say 'abcdefg' ~~ /\w ** {42..10}/  ) // say ($!.^name, $!.empty-range);
08:07 camelia rakudo-moar 1949a2bc1: OUTPUT: «(X::Syntax::Regex::QuantifierValue True)␤»
08:08 jonas1 joined #perl6
08:08 wander m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!;
08:08 camelia rakudo-moar 1949a2bc1: OUTPUT: «Cannot use Range with non-Numeric or NaN end points as quantifier␤  in block <unit> at <tmp> line 1␤␤»
08:11 wander m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!.resume;
08:11 camelia rakudo-moar 1949a2bc1: OUTPUT: «This exception is not resumable␤  in block <unit> at <tmp> line 1␤␤»
08:12 wander m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!.Str
08:12 camelia rakudo-moar 1949a2bc1: OUTPUT: «Cannot use Range with non-Numeric or NaN end points as quantifier␤»
08:16 cdg joined #perl6
08:19 zakharyas joined #perl6
08:21 salva joined #perl6
08:26 rindolf joined #perl6
08:31 Cabanossi joined #perl6
08:36 Ven joined #perl6
08:43 wander Note that you cannot easily obtain the same behavior(regex conjunction) with a look-ahead, because a look-ahead doesn't stop looking when the quoted string stops matching.
08:44 wander ^^ what is a look-ahead?
08:45 moritz it's a regex doens't consume characters
08:45 moritz for example / \w+ <?before '='> / matches a word only if it is followed by a '='
08:46 moritz but the regex matches only the word, not the '='
08:46 moritz explained in more detail in https://www.amazon.com/Parsing-Perl-Regexes-Grammars-Recursive/dp/1484232275 </ad type="blatant">
08:49 Mrofnet joined #perl6
08:50 wander m: say "42=" ~~/ \w+ [<?before '='> && <.ws>]/
08:50 camelia rakudo-moar 948af00b5: OUTPUT: «「42」␤»
08:51 wander emmmm...what is the note means? && works well on look-ahead it seems
08:52 wander btw, indeed looking forward to your new book
08:59 rindolf joined #perl6
09:02 dj_goku_ joined #perl6
09:04 scovit joined #perl6
09:05 moritz yes, but only because <.ws> is also a zero-width match
09:09 eliasr joined #perl6
09:09 moritz m: say so 'abc' ~~ / <?before a> && . /
09:09 camelia rakudo-moar 948af00b5: OUTPUT: «False␤»
09:09 moritz m: say so 'abc' ~~ / <?before a> . /
09:09 camelia rakudo-moar 948af00b5: OUTPUT: «True␤»
09:09 moritz m: say 'abc' ~~ / <?before a> .. /
09:09 camelia rakudo-moar 948af00b5: OUTPUT: «「ab」␤»
09:23 lizmat joined #perl6
09:44 evalable6 joined #perl6
09:46 Cabanossi joined #perl6
10:01 robertle joined #perl6
10:12 rurban joined #perl6
10:16 Cabanossi joined #perl6
10:22 wander joined #perl6
10:23 wander .tell moritz thanks for your patient explanation, and sorry for I'm leaving for a while
10:23 yoleaux wander: I'll pass your message to moritz.
10:25 moritz you're welcome, and no problem
10:25 yoleaux 10:23Z <wander> moritz: thanks for your patient explanation, and sorry for I'm leaving for a while
10:26 El_Che morning
10:33 AlexDaniel squashable6: next
10:33 squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 3 days and ≈23 hours (2017-11-04 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
10:37 jnthn m: use nqp; say nqp::eqaddr(Int.new(5), Int.new(5)) # :)
10:37 camelia rakudo-moar 6ac2b15cf: OUTPUT: «0␤»
10:38 jnthn oops
10:38 geekosaur reallyUnsafePtrEq# :p
10:47 evalable6 joined #perl6
10:55 nadim_ joined #perl6
10:58 Geth ¦ doc: dbff958f5d | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
10:58 synopsebot Link: https://doc.perl6.org/language/regexes
10:58 Geth ¦ doc: Add and modify examples
10:58 Geth ¦ doc:
10:58 Geth ¦ doc: on zero or one quantifiers `?` and conjunction `&&`
10:58 Geth ¦ doc: And rewrite example on greedy versus frugal quantifiers
10:58 Geth ¦ doc: review: https://github.com/perl6/doc/commit/dbff958f5d
10:59 wamba joined #perl6
11:01 Cabanossi joined #perl6
11:02 cdg joined #perl6
11:03 sena_kun joined #perl6
11:13 Geth ¦ mu: 912a0d9d5b | (Tom Browder)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
11:13 Geth ¦ mu: take a shot
11:13 Geth ¦ mu: review: https://github.com/perl6/mu/commit/912a0d9d5b
11:20 margeas joined #perl6
11:33 knight__ joined #perl6
11:34 knight__ Hello, I am creating a module, but what is the real purpose of 'use lib 'lib''? Load all modules symbols from path lib ?
11:36 timotimo not all, but it'll put the lib folder first in the list of locations to look in
11:40 zakharyas joined #perl6
11:40 domidumont joined #perl6
11:47 cgfbee joined #perl6
11:50 knight__ timotimo: Is there any option like python globals()/locals() it returns symbols which have been defined in scope?
11:50 timotimo m: say ::.keys
11:50 camelia rakudo-moar 6ac2b15cf: OUTPUT: «($=pod $_ $/ !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE)␤»
11:50 timotimo that's how you get at the lexical scope's contents
11:50 timotimo m: say OUR::.keys
11:50 camelia rakudo-moar 6ac2b15cf: OUTPUT: «()␤»
11:51 timotimo those are the package-scoped variables, i.e. everything declared "our" instead of "my"
11:51 lizmat m: my $foo; dd ::.keys<$foo>
11:51 camelia rakudo-moar aab2b9830: OUTPUT: «Failure.new(exception => X::AdHoc.new(payload => "Type Seq does not support associative indexing."), backtrace => Backtrace.new)␤»
11:51 lizmat hmmm
11:51 lizmat m: my $foo; dd ::<$foo>
11:51 camelia rakudo-moar aab2b9830: OUTPUT: «Any $foo = Any␤»
11:51 lizmat m: my $foo = 42; dd ::<$foo>
11:51 camelia rakudo-moar aab2b9830: OUTPUT: «Int $foo = 42␤»
11:52 timotimo imma be AFK for a bit
11:53 knight__ timotimo: Also, is there any doc about environment bindings? I mean how interpreter makes some "execution" plan?
11:53 timotimo i don't know what that means?
11:54 knight__ I will show, wait
11:54 timotimo someone else will surely be able to answer while i'm gone
11:54 timotimo seeya
11:54 knight__ ok
11:54 knight__ :-)
11:54 knight__ bye, thank you
12:04 nadim_ joined #perl6
12:16 Cabanossi joined #perl6
12:16 araraloren joined #perl6
12:21 araraloren Is there any convenient way update value of Hash, just like `%h<x> = %h<x> // 'foo';`
12:22 lizmat %h<x> = "foo" ?
12:22 lizmat araraloren: not sure what you mean
12:22 araraloren sorry
12:23 araraloren If there key exists, I want update it
12:23 araraloren this
12:24 araraloren oh I'm a foolish.. :P
12:28 moritz %h<x> = 'foo' if %h<x>:exists;
12:29 lizmat araraloren: if they are always defined values in there, you can use 'with'
12:29 lizmat m: my %h = a => 42; $_ = 666 with %h<a>; dd %h
12:29 camelia rakudo-moar aab2b9830: OUTPUT: «Hash %h = {:a(666)}␤»
12:30 araraloren oh, nice
12:30 araraloren thanks
12:30 araraloren My friend not describe the question correctly. sorry
12:30 [Coke] .
12:32 mson joined #perl6
12:33 rurban joined #perl6
12:33 aborazmeh joined #perl6
12:33 aborazmeh joined #perl6
12:36 knight__ apropo my previous questions about execution plan. I am interested in some execution plan how interpreter interpretes data. For example when I have multiple inheritance, I would like to know how interpreter works, which method it will choose, which table of symbols will use. etc :-) I do not know how to say it english.
12:37 knight__ Some rules, how it works.
12:37 moritz knight__: classes have "Method Resolution Order", short MRO
12:37 moritz knight__: it tells which order the classes are searched for when looking for methods
12:38 moritz m: say Int.^mro
12:38 camelia rakudo-moar aab2b9830: OUTPUT: «((Int) (Cool) (Any) (Mu))␤»
12:38 moritz m: say IntStr.^mro
12:38 camelia rakudo-moar aab2b9830: OUTPUT: «((IntStr) (Int) (Str) (Cool) (Any) (Mu))␤»
12:38 moritz Perl 6 uses C3: https://en.wikipedia.org/wiki/C3_linearization
12:39 knight__ Thank you!
12:40 khw joined #perl6
12:45 bdmatatu joined #perl6
12:46 Cabanossi joined #perl6
12:46 COMBORICO joined #perl6
12:46 domidumont joined #perl6
12:52 perlpilot joined #perl6
12:54 darkmorph joined #perl6
12:54 domidumont joined #perl6
12:55 MasterDuke joined #perl6
12:59 cdg joined #perl6
13:12 mcmillhj joined #perl6
13:12 cdg joined #perl6
13:16 Cabanossi joined #perl6
13:21 aborazmeh joined #perl6
13:21 aborazmeh joined #perl6
13:32 COMBORICO joined #perl6
13:43 napo1eon joined #perl6
13:46 wander m: say "11" ~~ /(\d) {} :my $c = $0; ($c)/;
13:46 camelia rakudo-moar b6a4d5b55: OUTPUT: «「11」␤ 0 => 「1」␤ 1 => 「1」␤»
13:46 COMBORICO Question: What does the perl method do: "say '2'.perl;". I know it returns "2", but I don't understand what is going on.
13:47 wander where can I see how code like `{} :my $c = $0;` works?
13:48 wander COMBORICO, https://docs.perl6.org/routine/perl
13:48 COMBORICO Ty
13:48 geekosaur COMBORICO, it produces the perl source code needed to reproduce the expression. for a number or a string, it's just the number
13:48 geekosaur or string
13:48 wander briefly, returns a Perlish representation of the object
13:48 COMBORICO Ty
13:49 zakharyas joined #perl6
13:50 domidumont joined #perl6
13:51 Guest38 joined #perl6
13:51 Guest38 left #perl6
13:51 geekosaur mhhh. think embedded code is only documented in the speculations :/
13:52 geekosaur the real docs are steering people to action objects
13:52 COMBORICO geekosaur, i read the link, but your explanation is clearer. Thank you.
13:52 cognominal joined #perl6
13:54 cognominal Mon histoire d´A avec les Rita Mitsouko finit mal. RIP Fred.  https://www.youtube.com/watch?v=tPSyz7xweVc
13:54 cognominal oops
13:54 cognominal wrong channel
13:55 lizmat ah, l'erreur  :-)
13:58 geekosaur wander, so closures in regexes are apparently only documented at http://design.perl6.org/S05.html#Bracket_rationalization
14:00 geekosaur and ':my' is documented in the middle of http://design.perl6.org/S05.html#Variable_(non-)interpolation
14:01 geekosaur I am wondering if those are going to be deprecated, since the docs point you to action objects instead
14:03 moritz no
14:09 Guest49 joined #perl6
14:09 wander geekosaur, thank you
14:10 Guest49 left #perl6
14:11 wander so, for `"11" ~~ /(\d) {} :my $c = $0; ($c)/`, first I match "1", then run a block, which updates $/
14:11 wander following `:my $c = 0;` which is how we declare inside a regex/token/rule
14:12 bwisti joined #perl6
14:13 wander interesting, for we never(?) declare a variable in this form anywhere else
14:14 geekosaur er? it's a normal declaration preceded by a colon
14:14 lowin joined #perl6
14:15 wander aha :P
14:15 wander m: :my $x = 42;
14:15 camelia rakudo-moar 497e0582e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3:my7⏏5 $x = 42;␤    expecting any of:␤        infix␤        infix stopper␤        statement end␤        statement modifier␤        statement …»
14:16 Cabanossi joined #perl6
14:17 geekosaur it may help to note that, in a regex, : normally stops backtracking (and both closures and :my also have that effect)
14:18 geekosaur (closures, because it's kinda hard to run arbitrary code "in reverse" if you backtrack through it)
14:19 wander so such form is only used inside regex, is it?
14:20 geekosaur yes
14:20 geekosaur rgeex is a separate language from perl 6 proper, although it allows limited embedding of perl 6 via closures
14:20 geekosaur likewise strings are a separate language
14:21 geekosaur perl 6 cleverly uses its own grammar facilities to allow switching languages on the fly
14:21 ChoHag joined #perl6
14:21 perlpilot .oO( "my god, it's full of languages" )
14:21 geekosaur hypothetically, someone could implement python as a perl 6 grammar and you could then put a block of python code in the middle of your program
14:21 geekosaur (I think there was actually an effort to run perl 5 that way, but it stalled out back when rakudo was still using parrot?)
14:23 troys joined #perl6
14:23 lowin joined #perl6
14:24 wander moritz, do we have other method to do the same thing like `/(\d) {} :my $c = $0; ($c)/`? ( We should have :-) )
14:26 nadim joined #perl6
14:29 moritz wander: you mean /\d $0 / ?
14:30 moritz m: say '1223' ~~ /(\d) $0 /
14:30 camelia rakudo-moar 497e0582e: OUTPUT: «「22」␤ 0 => 「2」␤»
14:30 moritz m: say '1223' ~~ /$<alias>=(\d) ($<alias>) /
14:30 camelia rakudo-moar 497e0582e: OUTPUT: «Nil␤»
14:30 moritz :(
14:31 wander yes
14:32 darkmorph joined #perl6
14:32 wander m: say '1223' ~~ /$<alias>=(\d) $<alias> /; say $0;
14:32 camelia rakudo-moar 497e0582e: OUTPUT: «「22」␤ alias => 「2」␤Nil␤»
14:32 esh_ joined #perl6
14:33 bartolin joined #perl6
14:33 moritz how often do you actually need to capture the second bit, when you already know that it matches the same text as the first?
14:35 wander you're right. what i care about is the match, not the capture XD
14:35 ChoHag joined #perl6
14:35 jdv79 can a Pair's value  be Nil?
14:36 moritz m: say (a => Nil).perl
14:36 camelia rakudo-moar 497e0582e: OUTPUT: «:a(Nil)␤»
14:36 moritz jdv79: ^^ that was easy to answer :-)
14:37 jdv79 i asked the wrong question.  why can't a hash's value be Nil?
14:37 Geth ¦ marketing: 305da3af38 | (Zoffix Znet)++ | 47 files
14:37 Geth ¦ marketing: Add some decent open fonts to repo
14:37 Geth ¦ marketing:
14:37 Geth ¦ marketing: To save time setting up when designing on new boxes...
14:37 Geth ¦ marketing: review: https://github.com/perl6/marketing/commit/305da3af38
14:38 lizmat m: my %h is default(Nil) = a => Nil; dd %h
14:38 camelia rakudo-moar 497e0582e: OUTPUT: «Hash %h = {:a(Nil)}␤»
14:38 lizmat jdv79: ^^^
14:38 jdv79 oh, that makes sense
14:38 jdv79 thanks
14:40 geekosaur the core issue is that, in an assignment, Nil usually means use the default value for the type. so you need the default to also be Nil
14:44 abraxxa joined #perl6
14:45 jdv79 i thought of that just before lizmat showed it
14:45 kyan joined #perl6
14:46 Geth ¦ doc: a30596e843 | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
14:46 Geth ¦ doc: Add example on Capture markers
14:46 Geth ¦ doc: review: https://github.com/perl6/doc/commit/a30596e843
14:46 synopsebot Link: https://doc.perl6.org/language/regexes
14:46 jdv79 for an args hash being slipped into a constructor a default of Nil is useful
14:46 Cabanossi joined #perl6
14:48 wander maybe test defined?
14:48 wander m: say defined Nil; say defined Any;
14:48 camelia rakudo-moar 497e0582e: OUTPUT: «False␤False␤»
14:51 jdv79 i'm talking about - "{..., k => $v ?? $v...whatever !! Nil,... }
15:00 mempko joined #perl6
15:04 Guest78 joined #perl6
15:06 callyalater joined #perl6
15:16 Cabanossi joined #perl6
15:16 ugexe m: sub foo(*%_) { %_ }; my %hash = %( :a([1,2,3]), :b(1) ); say foo(%hash).perl # wonder if this error message can be improved
15:16 camelia rakudo-moar 497e0582e: OUTPUT: «Too many positionals passed; expected 0 arguments but got 1␤  in sub foo at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
15:17 ugexe ah n/m, too early
15:19 Ven joined #perl6
15:23 callyalater m: say ""; sub postfix:<!>(Int $n) { [*] 2..$n }; say "{6!}";
15:23 yoleaux 28 Oct 2017 04:35Z <Zoffix> callyalater: the quote braid bug is now fixed: c: HEAD $ = ""; sub postfix:<!> { [*] ^$^f+1}; say "{ 5! }";   Sorry it took longer to fix than original promised :)
15:23 camelia rakudo-moar 497e0582e: OUTPUT: «␤720␤»
15:24 callyalater Zoffix: Thank you!
15:52 evalable6 joined #perl6
16:01 Cabanossi joined #perl6
16:06 mcmillhj joined #perl6
16:21 mcmillhj joined #perl6
16:23 cdg joined #perl6
16:34 araujo joined #perl6
16:34 araujo joined #perl6
16:35 AlexDaniel` squashable6: next
16:35 squashable6 AlexDaniel`, ⚠🍕 Next SQUASHathon in 3 days and ≈17 hours (2017-11-04 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
16:37 cognominal joined #perl6
16:39 cdg_ joined #perl6
16:46 Piotr_ joined #perl6
16:46 Cabanossi joined #perl6
16:52 Coleoid joined #perl6
16:54 Ven joined #perl6
16:58 lizmat nice objective for this Saturday's Squashathon: https://stackoverflow.com/questions/47017160/formats-of-perl-6-documentation
17:00 timotimo hm, do we have a Pod::To::Markdown? :)
17:03 zakharyas joined #perl6
17:03 Coleoid Hi, #perl6!  I'm wrestling with NativeCalling a funky library.
17:03 Coleoid The NativeCall docs specify that lib functions which return structs, must return them by reference, and I'm faced with a lib which does not.  Do I have options beyond "rewrite those functions"?
17:04 cdg joined #perl6
17:04 timotimo if i remember correctly, returning structs is not properly standardised between ABIs or compilers or something?
17:05 timotimo hm, though of course we should support anything libffi and dyncall can. let's see if they support that
17:07 geekosaur Coleoid, or write a wrapper function
17:07 Coleoid That may be.  The C folks on StackOverflow seem to believe it's defined, safe, and proper to return structs by value, and then they start listing caveats...
17:07 geekosaur passing structs and returning structs both have weirdness; C knows how to do it, but making an FFI do it is hard enough that many don't bother
17:07 timotimo looks like dyncall doesn't support it
17:09 timotimo hm, does libffi support it?
17:09 timotimo 1.03 Oct-10-96
17:09 timotimo Passing struct args, and returning struct values works for
17:09 timotimo all architectures/calling conventions.
17:10 timotimo now how do we handle this ... a run time exception when trying to use a function with struct return type if moarvm is compiled with dyncall?
17:11 timotimo (that would probably also immediately trigger when precompiling a module with that in it
17:12 Coleoid geekosaur, I was thinking wrapper functions, too, if I can't avoid writing C with this project.
17:14 Coleoid timotimo, I run up to the native call, and exit immediately without any message thereafter.  So it gave me much better visibility than a precompile exception.
17:15 timotimo well, a precompile exception would not half-run the program if it's doomed
17:16 Cabanossi joined #perl6
17:16 Coleoid ...or, now I think you meant NativeCall doing its first-time precompile, and it's given helpful messages when I haven't built the signature.
17:17 timotimo m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo() returns Foo is native(Str) {*}
17:17 camelia rakudo-moar ae1f0fdaf: ( no output )
17:17 timotimo m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo() returns Foo is native(Str) {*}; foo()
17:17 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot locate symbol 'foo' in native library ''␤  in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289␤  in method CALL-ME at /home/camelia/rakudo-m-inst-1/share/perl6/…»
17:17 pmurias joined #perl6
17:17 timotimo huh, it allows a CStruct for "returns"?
17:17 timotimo m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo(--> Foo) is native(Str) {*}; foo()
17:17 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot locate symbol 'foo' in native library ''␤  in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289␤  in method CALL-ME at /home/camelia/rakudo-m-inst-1/share/perl6/…»
17:18 Coleoid Yes, they just must be returned by reference.
17:19 timotimo ah crap, of course
17:19 Coleoid Another sad thing is this struct is three uint8s, so it would even fit into an int32 return value.  Redefining the nativecall binding to do that didn't fool the runtime, though.  :D
17:19 timotimo in that case i also don't know how to signal that ... "is structure-return" or similar
17:20 timotimo yeah, depending on your architecture returning an integer or a struct with a sufficiently small size can still be vastly different
17:22 setty1 joined #perl6
17:23 geekosaur has vs. HAS?
17:23 timotimo you can't put has or HAS in a sub signature
17:23 Coleoid Sounds right.  Well, foo.  Looks like wrapper functions, then.
17:23 geekosaur I meant in the CStruct
17:23 timotimo it'd also be possible to signal it like returns FlatStruct[Foo] (name up for debate)
17:24 timotimo that won't help
17:26 COMBORICO joined #perl6
17:28 COMBORICO Question: sub plus_three
17:28 El_Che the travis schrodinger build: it only builds when you're not looking
17:30 COMBORICO Nevermind.
17:31 Coleoid Hm, this library has Python and Lua bindings, so we know return-structs-by-value is solvable.  I can just write my wrappers for now, though.  Thanks, timotimo++ and geekasaur++.
17:32 geekosaur python makes you write C code to bind native libs anyway
17:32 geekosaur (as does perl 5)
17:32 geekosaur and for that matter lua
17:33 Geth ¦ doc: acea6c5f1b | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
17:33 synopsebot Link: https://doc.perl6.org/language/regexes
17:33 Geth ¦ doc: Put section "Look-around assertions" to proper pos
17:33 Geth ¦ doc:
17:33 Geth ¦ doc: Seems its author directly appends this doc with it.
17:33 Geth ¦ doc: review: https://github.com/perl6/doc/commit/acea6c5f1b
17:40 eugene_barsky joined #perl6
17:41 eugene_barsky hi
17:46 Cabanossi joined #perl6
17:51 * [Coke] tries to decipher that commit message.
17:52 * [Coke] is very excited to see a skip test -> preamble change, though. :)
17:52 [Coke] oh, I get it. moved the doc (but also did a lot of other stuff)
17:53 pmurias http://blogs.perl.org/users/pawel_murias/2017/10/rakudojs-update---more-test-fixes-and-nativecalls-works-a-little.html # rakudo.js update
17:53 geekosaur yes, and accuses the doc's author of adding all new content near the end before the 'postamble' sections
17:55 ilmari or, allowing for imperfect grammar, just this section
17:56 ilmari appends -> appended
17:56 wander how do I report a bug on RT?
17:57 wander I've reached rt.perl.org, but got lost
17:58 [Coke] email rakudobug@perl.org
17:59 [Coke] https://github.com/rakudo/rakudo/wiki/rt-introduction
17:59 [Coke] https://github.com/rakudo/rakudo/issues is also open (recently)
17:59 wander got it
18:16 cdg joined #perl6
18:16 cdg joined #perl6
18:18 TEttinger joined #perl6
18:26 mempko joined #perl6
18:31 Cabanossi joined #perl6
18:43 lowin joined #perl6
18:48 lizmat pmurias++
18:50 ChoHag joined #perl6
18:57 ugexe m: Grammar.new
18:57 camelia rakudo-moar ae1f0fdaf: OUTPUT: «P6opaque: no such attribute '@!list' in type Capture when trying to bind a value␤  in block <unit> at <tmp> line 1␤␤»
19:01 Cabanossi joined #perl6
19:05 mcmillhj joined #perl6
19:10 Thrush joined #perl6
19:13 mcmillhj joined #perl6
19:14 Thrush joined #perl6
19:14 Thrush I'm a little confused about the difference(s) between the '..' and '...' operators.
19:15 Thrush m: 'a87' ... 'b09'
19:15 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Potential difficulties:␤    Useless use of ... in sink context␤    at <tmp>:1␤    ------> 3'a87' ...7⏏5 'b09'␤»
19:15 Thrush m: ('a87' ... 'b09').say
19:15 camelia rakudo-moar ae1f0fdaf: OUTPUT: «(a87 a88 a89 a77 a78 a79 a67 a68 a69 a57 a58 a59 a47 a48 a49 a37 a38 a39 a27 a28 a29 a17 a18 a19 a07 a08 a09 b87 b88 b89 b77 b78 b79 b67 b68 b69 b57 b58 b59 b47 b48 b49 b37 b38 b39 b27 b28 b29 b17 b18 b19 b07 b08 b09)␤»
19:16 Thrush In the command "('a87' ... 'b09').say", why is "a77" and "a78" included?
19:17 MasterDuke joined #perl6
19:18 geekosaur it counts forward from a to b and backward from 8 to 0 and forward from 7 to 9
19:19 espadrine joined #perl6
19:26 Thrush geekosaur, this is different than the behavior I'd expect, coming from a Perl5 background.  Is there any way to emulate Perl5's behavior?
19:27 [Coke] Inline::Perl5
19:28 [Coke] Not built in, as far as I know, no
19:28 geekosaur I thought there was  amodule
19:28 geekosaur the problem with the perl 5 one is it doesn;t generalize
19:29 geekosaur it's a bundle of special cases for specific patterns and failure for anything that doesn;t fit those patterns
19:41 cdg joined #perl6
19:47 knight__ joined #perl6
19:48 wamba joined #perl6
19:50 ChoHag joined #perl6
19:51 Morfent joined #perl6
19:52 Thrush m: my @a = ['a98'] ; @a.push( @a[*-1].succ )  until @a[*-1] eq 'b09'
19:52 camelia rakudo-moar ae1f0fdaf: ( no output )
19:52 Thrush m: my @a = ['a98'] ; @a.push( @a[*-1].succ )  until @a[*-1] eq 'b09'; @a.say
19:52 camelia rakudo-moar ae1f0fdaf: OUTPUT: «[a98 a99 b00 b01 b02 b03 b04 b05 b06 b07 b08 b09]␤»
19:53 Thrush It looks like " @a.push( @a[*-1].succ )  until @a[*-1] eq 'b09' " is one way to do it.
20:01 mr-foobar joined #perl6
20:03 timotimo that'd be much easier written as:
20:03 timotimo m: say "a98", *.succ ... "b09"
20:03 camelia rakudo-moar ae1f0fdaf: OUTPUT: «(a98 a99 b00 b01 b02 b03 b04 b05 b06 b07 b08 b09)␤»
20:06 timotimo dang, they had already left
20:07 El_Che timotimo: it looks like travis is hammered with evening
20:07 timotimo ?
20:08 El_Che build take a lot of time to start
20:08 El_Che and in my project it runs 1 subbuild at the time instead of the 4 or 5 it normally dies
20:08 timotimo i'm confused, why are you writing me this?
20:09 El_Che I am confused as well
20:09 El_Che wasn't meant to be specificaaly to you
20:09 El_Che to much tab magic, I guess
20:09 El_Che sorry
20:10 timotimo OK
20:10 geekosaur travis free tier is limited cpu time
20:14 El_Che indeed
20:15 Rawriful joined #perl6
20:15 El_Che it seem they only cap when busy. Like said, normally I get several subbuilds running at the same time
20:15 mingdao joined #perl6
20:16 geekosaur yep. all the paid folks having a productive monday :p (and the european ones probably pushing to it at the end of the work day, or maybe delaying it thinking they can avoid the rush --- but all delaying by about the same amount. I learned better than that a couple decades ago :)
20:16 El_Che hehe, true
20:22 Ven joined #perl6
20:25 cxreg maybe interesting: https://evolvingavm.com/
20:29 mingdao joined #perl6
20:33 COMBORICO joined #perl6
20:35 COMBORICO Question about immutable parameters.
20:35 COMBORICO sub plus-three( Int $number ) { $number += 3 }
20:35 COMBORICO my $value = 5;
20:35 COMBORICO say plus-three $value;  #error: cannot assign to an immutable value
20:36 COMBORICO How is "say" modifying $value?
20:36 [Coke] get rid of the say; it's the call to the function that's modifying $number.
20:36 timotimo it's not
20:36 gfldex m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; plus-three $value;
20:36 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot assign to an immutable value␤  in sub plus-three at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
20:36 gfldex m: sub plus-three( Int $number is copy ) { $number += 3 }; my $value = 5; plus-three $value;
20:36 camelia rakudo-moar ae1f0fdaf: ( no output )
20:36 [Coke] you want $number is rw or $number is copy
20:36 timotimo plus-three is assigning to $number, which is by default read-only becaues it's a parameter
20:36 callyalater m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; say plus-three $value;
20:36 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot assign to an immutable value␤  in sub plus-three at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
20:36 gfldex m: sub plus-three( Int $number is rw ) { $number += 3 }; my $value = 5; plus-three $value;
20:36 camelia rakudo-moar ae1f0fdaf: ( no output )
20:37 callyalater m: sub plus-three( Int $number is rw ) { $number += 3 }; my $value = 5; say plus-three $value;
20:37 camelia rakudo-moar ae1f0fdaf: OUTPUT: «8␤»
20:37 callyalater By default, I believe all parameters are read only unless specified otherwise with `is rw`.
20:38 callyalater m: sub plus-three( Int $number ) { $number += 3; return $number; }; my $value = 5; say plus-three $value;
20:38 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot assign to an immutable value␤  in sub plus-three at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
20:38 gfldex COMBORICO: see https://docs.perl6.org/type/Signature#Parameter_Traits_and_Modifiers
20:38 callyalater m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; my $v = plus-three $value; say $v;
20:38 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Cannot assign to an immutable value␤  in sub plus-three at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
20:39 callyalater m: sub plus-three( Int $number is rw) { $number += 3; return $number; }; my $value = 5; my $v = plus-three $value; say $v;
20:39 camelia rakudo-moar ae1f0fdaf: OUTPUT: «8␤»
20:39 COMBORICO Okay. Thank you all for your help.
20:47 AlexDaniel joined #perl6
20:52 cdg joined #perl6
20:54 cdg joined #perl6
21:10 cdg_ joined #perl6
21:17 ChoHag joined #perl6
21:19 raiph joined #perl6
21:25 cono joined #perl6
21:25 cono m: class A::B { method hm { my class C {}; C.^name.say }; }; A::B.new.hm
21:25 camelia rakudo-moar ae1f0fdaf: OUTPUT: «A::B::C␤»
21:26 cono how to define C, outside of A::B namespace?
21:26 COMBORICO Does "is rw" stand for re-writable?
21:26 Juerd COMBORICO: read-write
21:26 Juerd COMBORICO: ro stands for read-only.
21:26 COMBORICO Thanks!
21:27 Juerd cono: Why are you putting it there if you don't want it there?
21:28 lizmat Juerd: I assume scoping
21:29 Juerd COMBORICO: Please note that in many cases, changing the caller's values is considered very bad style. It should, in general, only be used as a performance optimization when you really need it (for example, to prevent copying a huge string in memory). In most situations, returning the new value and having the caller do the assignment is easier to read and maintain.
21:30 Juerd COMBORICO: So usually you'd do  sub plus-three(Int $number) { return $number + 3 }; my $value = 5; $value = plus-three $value;  # Or of course, my $value = plus-three 5;
21:30 COMBORICO Roger that.  I just NEED to know what things stand-for.
21:31 Juerd COMBORICO: Now that you mention it, that should probably be explained at https://docs.perl6.org/type/Signature#index-entry-trait_is_copy-trait_is_rw-Parameter_Traits_and_Modifiers
21:31 Juerd COMBORICO: Would you mind opening a github issue for that?
21:32 COMBORICO I'm still meditating on thing i wrote earlier.  Yup, I've been meditating on this page.
21:32 lizmat so what do you need to go to see the actual code on https://code-golf.io/ ?
21:32 cono Juerd: I'm using GraphQL module, which accepts class with name: Query, but I want to pass in this class Config class and other stuff which I need. That's why I thought that I create wrapper class which clousring Config inside of Query class
21:32 cono it doesn't work with A::B::Query
21:32 cono it neeeds to be Query without namespaces
21:33 Juerd cono: That typically means it's assuming you'll subclass Query, or if Query is a role, implement a class that "does Query;"
21:33 cono if I subclass from Query, the ^name will change
21:33 cono which again breaks internal GraphQL logic
21:34 Juerd If GraphQL uses .^name for a type check, that may be a design flaw in the module :(
21:34 cono I understand but this is what I have :)
21:34 cono https://github.com/CurtTilmes/Perl6-GraphQL/blob/master/lib/GraphQL.pm#L273
21:34 COMBORICO Juerd, hahaha i don't even know what a github issue is.
21:35 Juerd COMBORICO: Do you know what github is though? :)
21:35 COMBORICO Yes.
21:35 gfldex COMBORICO: it's a convenient way to complain :->
21:36 Juerd COMBORICO: "Issues" is the built-in issue tracker, or bug tracker if you will, that authors can get with any Git repository hosted on Github.
21:36 COMBORICO Juerd, were you speaking of complaining about rw?
21:36 Juerd COMBORICO: Yes
21:36 Juerd At the bottom of https://docs.perl6.org/type/Signature there is a link "Please report any issues"
21:37 COMBORICO I see.  I will do it.  Now to remember my password . . .
21:37 Juerd COMBORICO: Great, thank you!
21:38 Juerd cono: I don't recognise in that line why the class would have to be named Query though
21:39 cono because after that we are adding this here: https://github.com/CurtTilmes/Perl6-GraphQL/blob/master/lib/GraphQL.pm#L184
21:39 Juerd cono: I think the best work-around is to simply declare a global class instead of the lexical (my) one.
21:40 cono and when graphql request coming, it matches Query to the ^name
21:40 cono Juerd: and how to pass my config into this global class?
21:41 Juerd cono: Maybe a class attribute? That's a fancy name for a global variable that lives in the class, but because it has a fancy name and lives in the namespace it's not nearly as gross as a regular global variable :D
21:42 Juerd cono: class Query { our $.config; ... }; Query.config = ...;
21:42 cono attributes of the Query class will be expoed to the API :(
21:43 Juerd Then the gross solution...  our $config; class Query { ... }; $config = ...;
21:43 Juerd It really sounds like GraphQL should use .^name only as a fallback if no name is provided in another way.
21:43 cono I'm thinking about defining my custom class, and inherit top Query from my custom one..
21:44 ugexe m: class Foo { submethod TWEAK(|) { self.HOW does role :: { method name(|) { q|Query| } }; } }; say Foo.new.^name # hehe
21:44 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Query␤»
21:44 cono Juerd: totally agree with you
21:44 Juerd ugexe: Nice hack.
21:44 Juerd ugexe: I wonder how much other stuff would break :)
21:46 ugexe if its matching on $t.^name already, I imagine it should just work since it saves the $t alongside the $t.^name
21:46 Cabanossi joined #perl6
21:47 lizmat and another Perl 6 Weekly hits the Net: https://p6weekly.wordpress.com/2017/10/30/2017-44-nom-mastered/
21:47 ugexe if its doing something like $t.^name.new(...) then it'd break down
21:47 grumble joined #perl6
21:48 cono nope. no object creation at all: https://github.com/CurtTilmes/Perl6-GraphQL/blob/master/lib/GraphQL/Execution.pm#L468
21:48 knight__ hmm
21:48 knight__ interesting
21:48 cono just taking package on method and invoking it
21:56 epony joined #perl6
21:57 raiph .tell eugene_barsky er, hi. (better late than never...) :)  In answer to your SO, aiui, almost anything that makes #perl6 a great place to experience P6 is on topic.
21:57 yoleaux 25 Oct 2017 06:25Z <moritz> raiph: thanks, answered
21:57 yoleaux raiph: I'll pass your message to eugene_barsky.
22:04 raiph m: say 'hi eugene' # write m: plus perl 6 code to run it via a bot that uses a rakudo compiler on a MoarVM backend
22:04 camelia rakudo-moar ae1f0fdaf: OUTPUT: «hi eugene␤»
22:18 aindilis joined #perl6
22:24 COMBORICO As a new programmer in general but coming from C++, so far the steepest learning-curve has been Perl 6's default immutable parameter (compared to C++ default is mutable).
22:24 Ven joined #perl6
22:25 COMBORICO It took me an hour or more to understand what was going on!
22:26 lizmat perhaps we need a "coming from C++ traps" doc
22:27 lizmat I mean, we have for Haskell: https://docs.perl6.org/language/haskell-to-p6
22:28 lizmat Python: https://docs.perl6.org/language/py-nutshell
22:28 lizmat Ruby: https://docs.perl6.org/language/rb-nutshell
22:28 lizmat and several aspects when coming from Perl 5
22:31 Cabanossi joined #perl6
22:31 COMBORICO I have no programming experience so I'm not a good judge if yea or nay for that.
22:32 COMBORICO I just could not understand (still don't) why a person would want to have the parameter to be defaulted to const.
22:33 COMBORICO So that kept me thinking that i was understanding what i was reading incorrectly.
22:33 Juerd COMBORICO: Because it's considered bad style to mutate the arguments. It's possible because sometimes it's needed or the easy way out, but generally it's a bad idea.
22:34 lizmat COMBORICO: perhaps what you're looking for is "is copy" ?
22:34 COMBORICO But isn't C++ default to mutate parameters?
22:34 lizmat or do you really want your changes to be visible in the caller as well ?
22:34 ggoebel joined #perl6
22:35 COMBORICO I understood what was going on from this link:
22:35 COMBORICO https://www.reddit.com/r/ProgrammingLanguages/comments/5vqabi/how_do_you_feel_about_function_parameters_being/
22:36 perlawhirl I have a question about Range.sum() it does a 'self.int-bounds || nextsame;'... the nextsame jumps to Any.sum()... which iterates the invocant and sums each iteration
22:36 perlawhirl which means trying to sum an infinite range doesn't terminate... i'm trying to think...
22:36 Thrush joined #perl6
22:36 perlawhirl besides infinte ranges, what other ranges will fail int-bounds... and is there any reason why Range.sum() shouldn't just check for is-lazy() and fail if True?
22:37 Juerd COMBORICO: It looks like C++ defaults to "is copy": https://juerd.nl/i/e252132fe377471bb3400aa9ff64a423.png
22:37 Thrush How do I concatenate two arrays in Perl 6?  I'm looking for something like:  my @c = @a + @b;
22:37 lizmat perlawhirl: it probably should, please provide an example and make a Github Issue  :-)
22:38 Juerd Thrush: Arrays are not concatenated, but to add the elements from one array to the other, use append (or push with list flattening)
22:38 perlawhirl cool lizmat... while i've got your attention, and on the subject of int-bounds... re: RT131846
22:38 synopsebot RT#131846 [open]: https://rt.perl.org/Ticket/Display.html?id=131846 [BUG] [REGRESSION] not accepting Inf/Whatever as upper bound
22:39 perlawhirl an obvious fix would be to change '$ofrange.int-bounds(my int $i, my int $to)' to '(my (int $i, int $to) = $ofrange.int-bounds || ($ofrange.head, $elems))'
22:39 perlawhirl performance hit seems minimal... does it look ok to you on the face of it?
22:39 Juerd Thrush: To create a new list containing the array elements of an array, use "flat" or "|", e.g. "my @c = flat @foo, @bar;" or "my @c = |@foo, |@bar;"
22:39 Thrush m: my @a = 1..3; my @b = <a b c>; (my @c = @a).append(@b);  @c.perl.say
22:39 camelia rakudo-moar ae1f0fdaf: OUTPUT: «[1, 2, 3, "a", "b", "c"]␤»
22:39 COMBORICO Juerd, thanks! I need to meditate on these terms. My head is starting to spin. Ha.
22:40 Thrush m: my @a = 1..3; my @b = <a b c>; my @c = flat @foo, @bar;
22:40 lizmat perlawhirl: looking
22:40 camelia rakudo-moar ae1f0fdaf: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '@foo' is not declared␤at <tmp>:1␤------> 3a = 1..3; my @b = <a b c>; my @c = flat 7⏏5@foo, @bar;␤»
22:40 Thrush m: my @a = 1..3; my @b = <a b c>; my @c = flat @a, @b;
22:40 camelia rakudo-moar ae1f0fdaf: ( no output )
22:40 Juerd COMBORICO: Basically, in C++ it will mutate a private copy of the argument that was passed, so the result is not visible in the outer scope.
22:40 Thrush m: my @a = 1..3; my @b = <a b c>; my @c = flat @a, @b; @c.perl.say
22:40 camelia rakudo-moar ae1f0fdaf: OUTPUT: «[1, 2, 3, "a", "b", "c"]␤»
22:41 perlawhirl lizmat: sorry, should have linked specific line: https://github.com/rakudo/rakudo/blob/b07e7b1d0ffcafc1f9dfbb3d56eff59c8eaddbf8/src/core/List.pm#L1123
22:42 Juerd COMBORICO: So basically, "Int $foo is ro" translates to "const int foo", "Int $foo is rw" translates to "int &foo", "Int $foo is copy" translates to "int foo"
22:42 Thrush Here's a question:  I have an array @a (set to, say [1,2,3]) and I want to get the product of itself with itself.  I can do:  my @b = @a X @a;  But then let's say I want to get a product of @b with @a, like this:  my @c = @b X @a;
22:43 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c.perl.say
22:43 camelia rakudo-moar ae1f0fdaf: OUTPUT: «[($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), ($(2, 3), 3)…»
22:43 Juerd Thrush: An easier way to print variables for debugging is "dd". It also gives more detail.
22:43 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @c; dd @a X @a X @a
22:43 camelia rakudo-moar ae1f0fdaf: OUTPUT: «Array @c = [($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), (…»
22:44 Juerd Things with long output are probably better tested locally :D
22:45 Thrush I notice that the elements of @c are in the nested form of [[a,b], c] instead of [a,b,c] (like I would get with @a X @a X @a).  How can I get the [a,b,c] form?
22:45 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @a X @a X @a
22:45 camelia rakudo-moar ae1f0fdaf: OUTPUT: «((1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1), (3, 2, 2…»
22:47 timotimo m: my @a = <a b c>; my @b = <x y z>; my @result = flat @a, @b; say @result.perl
22:47 camelia rakudo-moar ae1f0fdaf: OUTPUT: «["a", "b", "c", "x", "y", "z"]␤»
22:47 COMBORICO Jeurd, i will write that in my textbook.  I'm still not getting it 100%, but I'm close.  Thanks for the help.
22:47 Juerd COMBORICO: You're welcome
22:52 COMBORICO Juerd, You're sure read-write means constant, right?
22:52 Juerd COMBORICO: No, constant == read-only aka immutable
22:53 COMBORICO I thought read-write would mean able to write.  And const means not able to write.
22:54 COMBORICO So why does rw == const?
22:54 Juerd COMBORICO: That is not the case.
22:54 Juerd COMBORICO: Where does it say that rw is const?
22:54 COMBORICO Ahh! I miswrote it!
22:54 Juerd rw is more like passing a value by reference, like "void mutate(int &ref) { ... }" in C++
22:55 mcmillhj joined #perl6
22:55 COMBORICO Right, okay.  Too much reading today, i guess.
22:57 COMBORICO "is copy" is call-by-value, right?
22:58 Juerd Yes. It creates a local copy of the value that can be mutated, but the changes won't be made to the value in the caller's scope.
22:58 lizmat "is copy" is call-by-value *but* also creates a local container so you can change it locally
22:59 lizmat Juerd++  # faster  :-)
22:59 Juerd lizmat: Lots and lost of http://typing-speed-test.aoeu.eu/ :)
22:59 Juerd s/lost/lots/  # still not enough apparently.
22:59 * lizmat feels lots every now and then as well  :-)
23:00 COMBORICO Lizmat, I'll add that to my notes.
23:01 Cabanossi joined #perl6
23:04 COMBORICO So Perl 6's default for parameters again is . . . ro (const), right?
23:04 Juerd Yes
23:05 COMBORICO Whew! Time to take a break! Haha.  Thanks for the help, you two! My textbook credits you both!
23:06 timotimo oh be aware that the copy "is copy" makes is extremely shallow :)
23:07 lizmat perlawhirl: testing a fix for RT #131846 now
23:07 synopsebot RT#131846 [open]: https://rt.perl.org/Ticket/Display.html?id=131846 [BUG] [REGRESSION] not accepting Inf/Whatever as upper bound
23:08 [Coke] Should protoregex be one word or two?
23:09 lizmat m: proto regex foo { }
23:09 camelia rakudo-moar 094921796: OUTPUT: «5===SORRY!5===␤Null regex not allowed␤at <tmp>:1␤------> 3proto regex foo { 7⏏5}␤Proto regex body must be {*} (or <*> or <...>, which are deprecated)␤at <tmp>:1␤------> 3proto regex 7⏏5foo { }␤␤»
23:09 lizmat m: protoregex foo { }
23:09 camelia rakudo-moar 094921796: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routines:␤    foo used at line 1␤    protoregex used at line 1␤␤»
23:09 lizmat two I guess ?
23:09 [Coke] in prose, I mean. so 'protoregex' isn't code, so I'm guessing it should be 2 words in prose.
23:09 Herby_ joined #perl6
23:09 Herby_ \o
23:10 Herby_ Just read the weekly
23:10 Herby_ everyone++ for the 2017.10 release
23:14 knight__ hmm, What shall I read to know what is the meaning of word like graphemes...?
23:14 lizmat https://en.wikipedia.org/wiki/Grapheme
23:15 knight__ ok, some linguistic books:-)
23:15 darkmorph joined #perl6
23:15 lizmat tl;dr: what a human thinks a character is
23:16 lizmat perlawhirl: https://github.com/rakudo/rakudo/commit/bdc73563f4
23:17 perlawhirl lizmat++ thanks so much!
23:17 [Coke] f
23:17 lizmat sorry for it falling through the cracks
23:18 [Coke] whoops
23:18 mcmillhj joined #perl6
23:20 perlawhirl lizmat: no probs
23:22 Thrush If I have @a = [1,2,3]; and @b = @a X @a; how can I combine @b and @a to make a @c that is the same as @a X @a X @a ?  I would think @c = @b X @a; but that gives a different answer.
23:22 Thrush m: my @a = [1,2,3]; my @product = @a X @a X @a; dd @product
23:22 camelia rakudo-moar 094921796: OUTPUT: «Array @product = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3…»
23:23 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @c
23:23 camelia rakudo-moar 094921796: OUTPUT: «Array @c = [($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), (…»
23:23 Thrush See?  Not the same.
23:23 timotimo yup
23:24 timotimo m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c = @c.map({ flat $_[0].List, $_[1] }); dd @c
23:24 camelia rakudo-moar 094921796: OUTPUT: «Array @c = [(1, 1, 1).Seq, (1, 1, 2).Seq, (1, 1, 3).Seq, (1, 2, 1).Seq, (1, 2, 2).Seq, (1, 2, 3).Seq, (1, 3, 1).Seq, (1, 3, 2).Seq, (1, 3, 3).Seq, (2, 1, 1).Seq, (2, 1, 2).Seq, (2, 1, 3).Seq, (2, 2, 1).Seq, (2, 2, 2).Seq, (2, 2, 3).Seq, (2, 3, 1).Seq,…»
23:24 timotimo m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c = @c.map({ (flat $_[0].List, $_[1]).List }); dd @c
23:24 camelia rakudo-moar 094921796: OUTPUT: «Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1…»
23:25 Thrush I can do this:  my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map({|$_[0], $_[1]}); dd @c
23:25 Thrush m:  my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map({|$_[0], $_[1]}); dd @c
23:25 camelia rakudo-moar 094921796: OUTPUT: «Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1…»
23:25 Thrush But is there a simpler way?
23:27 Thrush Is there any way to convert the 'X' infix operator to a regular method?
23:27 Thrush I tried "@a.X(@a)" but that doesn't work.
23:28 timotimo m: say &METAOP_CROSS
23:28 camelia rakudo-moar 094921796: OUTPUT: «sub METAOP_CROSS (\op, &reduce) { #`(Sub|34398544) ... }␤»
23:29 Thrush For that matter, is there any way to convert any infix operator (like, say, '+') to a method?  For example, I want to call "4+5" as "4.+(5)".  Can that be done?
23:29 timotimo you can by using its full name
23:29 timotimo m: say 1.&infix:<+>(2);
23:29 camelia rakudo-moar 094921796: OUTPUT: «3␤»
23:29 lizmat m: say 1.&[+](3)   # shorter
23:29 camelia rakudo-moar 094921796: OUTPUT: «4␤»
23:30 timotimo m: say &[X]
23:30 camelia rakudo-moar 094921796: OUTPUT: «sub infix:<X> (| is raw) { #`(Sub+{is-pure}+{Precedence}|31444240) ... }␤»
23:30 timotimo neat.
23:30 Juerd I don't think that'll make it easier, though.
23:30 * timotimo heads out
23:31 timotimo m: say &[X](<a b c>, <2 3>, <☺ ☹>);
23:31 camelia rakudo-moar 094921796: OUTPUT: «((a 2 ☺) (a 2 ☹) (a 3 ☺) (a 3 ☹) (b 2 ☺) (b 2 ☹) (b 3 ☺) (b 3 ☹) (c 2 ☺) (c 2 ☹) (c 3 ☺) (c 3 ☹))␤»
23:31 Juerd I would have expected something simple like [X] |@b, @a to work but I really don't understand what that does, apparently
23:32 timotimo that'll put the contents of @b into the same argument list that @a is put into
23:32 Juerd Is there any syntax to get the [0]s of a list, then the [1]s, then the [2]s, etc?
23:32 timotimo depending on what's inside @b at that point, it's probably wrong :)
23:33 timotimo m: my @lists = <a b c>, <d e f>, <g h i>; say [Z] |@lists;
23:33 camelia rakudo-moar bdc73563f: OUTPUT: «((a d g) (b e h) (c f i))␤»
23:33 timotimo only works properly if @lists has at least two elements i believe
23:34 Juerd @c = [X] @b»[0], @b»[1], @a  works but hard coding indices feels wrong :)
23:35 Juerd m: my @a = [1,2,3]; my @b = @a X @a; my @c = [X] |([Z] |@b), @a; dd @c;
23:35 camelia rakudo-moar bdc73563f: OUTPUT: «Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1…»
23:35 Juerd Oh my.
23:35 Juerd That's ugly :)
23:36 espadrine joined #perl6
23:37 Juerd Would be slightly prettier if you could write something like @b.zip instead of [Z] |@b
23:37 Thrush The reason I want @a X @a to be done, THEN Xed with @a again is because in my code I'm doing an array product, then filtering (with grep) then doing a product again.
23:38 Thrush I want to get something like @a X @a X @a, but instead I'm getting something like [@a X @a] X @a.
23:38 Juerd Thrush: Is the [X] |([Z] |@b), @a  what you wanted?
23:38 Thrush So how do I undo the "[]" part of [@a X @a] x @a ?
23:39 Thrush Juerd:  Let me check real quick...
23:40 Thrush Juerd:  I notice that that returns lots of elements.  I only want 3*3*3 elements (27), which is the number that @a X @a X @a returns.
23:41 Thrush m: (@a X @a X @a).elems.say; ([X] |([Z] |@b), @a).elems.say
23:41 camelia rakudo-moar bdc73563f: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '@a' is not declared␤at <tmp>:1␤------> 3(7⏏5@a X @a X @a).elems.say; ([X] |([Z] |@b)␤»
23:41 Thrush m: my @a = [1,2,3]; (@a X @a X @a).elems.say; ([X] |([Z] |@b), @a).elems.say
23:41 camelia rakudo-moar bdc73563f: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '@b' is not declared␤at <tmp>:1␤------> 3; (@a X @a X @a).elems.say; ([X] |([Z] |7⏏5@b), @a).elems.say␤»
23:42 Thrush m: my @a = [1,2,3]; (@a X @a X @a).elems.say; my @b = @a X @a; ([X] |([Z] |@b), @a).elems.say
23:42 camelia rakudo-moar bdc73563f: OUTPUT: «27␤243␤»
23:42 Thrush That's 27 elements vs. 243 elements.
23:42 Thrush Juerd:  That's 27 elements vs. 243 elements.  So, not quite what I was looking for.
23:42 Juerd 3³ vs 3⁵
23:43 Thrush Juerd:  Yes.  Not sure why, though.
23:43 Juerd Neither am I
23:43 mcmillhj joined #perl6
23:45 piojo1 joined #perl6
23:45 Thrush Juerd:  I've come up with this:  (@b X @a).map( {|$_[0], $_[1]} ); but it seems a bit too wordy.
23:45 Juerd Because @a X @a is not 3 elements, it's 9.
23:45 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map( {|$_[0], $_[1]} ); dd @c
23:45 camelia rakudo-moar bdc73563f: OUTPUT: «Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1…»
23:45 Thrush m: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map( {|$_[0], $_[1]} ); @c.elems.say
23:45 camelia rakudo-moar bdc73563f: OUTPUT: «27␤»
23:46 Cabanossi joined #perl6
23:46 cdg joined #perl6
23:47 Geth ¦ doc/master: 12 commits pushed by (Will "Coke" Coleda)++
23:47 Geth ¦ doc/master: review: https://github.com/perl6/doc/compare/acea6c5f1b...a10c20d447
23:52 callyalater left #perl6
23:53 schelcj joined #perl6
23:55 Juerd Thrush: I give up
23:55 lizmat perhaps a GH Issue is in order ?
23:57 Thrush Thanks for trying, Juerd.  I appreciate it.
23:57 Thrush I gotta go.  But thanks for all your help.
23:58 Juerd lizmat: Maybe more a stackoverflow or perlmonks thing
23:58 lizmat maybe

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

Perl 6 | Reference Documentation | Rakudo