Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2018-01-10

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:01 lelf smth more end-user-friendly?  the problem is that ‘sub foo is native’ is too lazy with regard to dyn library bindings
00:02 timotimo if it's okay to be unix-specific, you can try binding dlopen and friends with nativecall
00:04 markong joined #perl6
00:17 margeas joined #perl6
00:23 ckraniak joined #perl6
00:29 lookatme joined #perl6
00:34 Grauwolf_ joined #perl6
00:36 Geth joined #perl6
00:40 lookatme o|
00:41 TimToady .oO(a grim cyclops?)
00:41 S007 joined #perl6
00:42 lookatme o_O
00:44 TimToady .oO(the top of a movie projector?)
00:48 lookatme (°ー°〃)
00:51 TimToady .oO(an upside-down skateboard flying out of a dustcloud?)
00:52 gfldex .oO(What is the hippie smoking…again?)
00:53 gfldex .oO(And can I have some too?)
00:53 lookatme (@_@;)
00:55 epony joined #perl6
00:56 TimToady .oO(a winking snail towing another snail out of a tunnel?)
00:56 S007 joined #perl6
00:57 epony joined #perl6
00:57 lookatme (⊙﹏⊙)
00:58 TimToady .oO(hard to shoot at the target when I drank too much...)
01:00 * lookatme back to work
01:00 TimToady o|
01:05 Cabanossi joined #perl6
01:13 Geth ¦ ecosystem: a02d987859 | (Zoffix Znet)++ (committed using GitHub Web editor) | META.list
01:13 Geth ¦ ecosystem: Add CoreHacker::Q to ecosystem
01:13 Geth ¦ ecosystem:
01:13 Geth ¦ ecosystem: "Perl 6 QAST Visualizer": https://github.com/zoffixznet/q
01:13 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/a02d987859
01:13 Zoffix joined #perl6
01:14 Zoffix .tell lizmat you had some interest in the module. The first baby version got released as CoreHackers::Q: https://github.com/zoffixznet/q
01:14 yoleaux Zoffix: I'll pass your message to lizmat.
01:15 Zoffix left #perl6
01:16 nativecallable6 joined #perl6
01:17 unicodable6 joined #perl6
01:17 quotable6 joined #perl6
01:40 cdg joined #perl6
02:09 stmuk joined #perl6
02:16 cdg joined #perl6
02:42 perlbot joined #perl6
02:59 Actualeyes joined #perl6
03:01 ilbot3 joined #perl6
03:01 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:20 khisanth_ joined #perl6
03:28 Todd_ joined #perl6
03:34 Todd_ Ji All.  I am stumped.  I just installed rakudo-pkg on a Fedora 27 server (removed all the zef's and rakudo's first) and I can't get anything to zef properly.  All packages have the same issue.  " --force-test" is required on all of them to complete.  When I go to "use xxx", you get an error messages as to it can;t find one of the long letter directories in the /opt path (it really isn't theWould someone mind looking at my vpaste and te
03:34 Todd_ " --force-test" is required on all of them to complete.  If I force, when I go to "use xxx", you get an error messages as to it can't find one of the long letter directories in the /opt path (it really isn't there).  Would someone mind looking at my vpaste and telling me what I am doing wrong?
03:34 Todd_ http://vpaste.net/MnJEg
03:35 Todd_ sorry for the weird copy and paste.
03:37 Zoffix joined #perl6
03:38 Zoffix Todd_: do you have ~/.zef or ~/.perl6 directory by any chance?
03:38 Zoffix I may be mistaken, but it's possible zef is installing the modules user-local, but the path when you `use` them doesn't include the path where it's installing them or something.
03:38 Todd_ yes and yes
03:39 Zoffix Todd_: and when you `use` the module? Does the error message list ~/.perl6 in the list?
03:40 Todd_ # eraseme.pl6 ===SORRY!=== Could not find Terminal::ANSIColor at line 9 in:     /home/linuxutil     /root/.perl6     /opt/rakudo-pkg/share/perl6/site     /opt/rakudo-pkg/share/perl6/vendor     /opt/rakudo-pkg/share/perl6     CompUnit::Repository::AbsolutePath<54193536>     CompUnit::Repository::NQP<30451248>     CompUnit::Repository::Perl5<30451288>
03:41 Zoffix Todd_: are you root?
03:42 Todd_ yes and I just realized that and renamed /root/.zef and /root/.perl6
03:42 lookatme Is it lake some test tool ? or something else
03:42 lookatme like prove
03:42 Todd_ rerunning "zef install Terminal::ANSIColor" gives the same error
03:43 lookatme I faced same problem in fresh installation of Fedora 27
03:44 Zoffix Todd_: renamed to what?...
03:44 Todd_ mv ~/.zef ~/.zef.000     mv ~/.perl6 ~/.perl6.000
03:45 Todd_ both the root and users
03:45 Zoffix No idea
03:45 Zoffix left #perl6
03:46 Todd_ I am doing a "dnf --enablerepo=* upgrade" to see if that helps
03:49 lookatme Todd_, you can try it with  --debug
03:49 Todd_ the zef command?
03:49 lookatme yeah, it print the debug message
03:50 Todd_ in progress
03:51 Todd_ http://vpaste.net/21U9f
03:53 Todd_ Is this a hint:
03:53 Todd_ ListUtil.c: loadable library and perl binaries are mismatched
03:53 Todd_ where are these loadable libraries?
03:54 Todd_ I think I am on to something.  Don't anybody help me until I get back
03:55 Todd_ rats.  renaming .precomp did not help
03:55 lookatme idk
03:55 lookatme no idea :)
03:56 geekosaur that message is a *perl 5* mismatch
03:57 bloatable6 joined #perl6
03:57 geekosaur you have a perl 5 XS module that doesn't match the perl 5 executable (or shared library, depending on how perl was configured0
03:58 geekosaur something tells me your F27 is much more hosed than just rakudo. or you have a perl 5 you copied over that needed to not be copied.
03:58 lookatme so some perl5 script will failed ?
03:58 Todd_ ahhhh.  now it is starting to make sense.  I will try wiping p5 and reinstalling it.  I presume zef is using p5
03:58 lookatme And I think the zef maybe use prove(a perl5 script for test) to test something
03:58 geekosaur I think it uses Inline::Perl5 for some things
03:58 geekosaur probably have to ask nine
03:59 Todd_ I have had the WORST luck with Inline::Perl5.  Probpably a good thing as it forced me to dive into p6 harder
03:59 lookatme And I am wonder why you copy the Perl5 or Rakudo and other things ?
04:00 lookatme The correct way is reinstall them, not copy
04:01 geekosaur and/or ugexe
04:02 Todd_ I am using `# dnf remove perl` and the corresponding install.  ther is a reinstall, but I wanted to hunt down any leftovers first
04:04 Todd_ removed and reinstalled p5.  Still get: loadable library and perl binaries are mismatched
04:12 telex joined #perl6
04:35 Todd_ update: the perl 5 chat guys are helping me fix battling cpan and installed binaries, which is causing the issue
04:38 Todd_ wish list: please update zef to use perl6 instead of perl5 to do its magic
04:43 Todd_ okay: # perl -v bash: /usr/bin/perl: No such file or directory
04:45 Cabanossi joined #perl6
04:46 Todd_ I useed find to hunt down any leftovers and now I will reinstall
04:47 Todd_ # dnf install perl perl-interpreter         this will be a while!
04:49 lelf left #perl6
05:09 Todd_ Yippee!!!!  This command show the offender!  # perl -le 'for (@INC) { print $_ if -f "$_/DBI.pm" }'
05:09 Todd_ `mv /home/todd/perl5 /home/todd/perl5.000`  fix the issue
05:20 Todd_ "if" Fedora had our moduels loaded up, would this be the right way to translate their names into the repo names (word in Perl 5):
05:20 Todd_ # dnf repoquery --whatprovides 'rakudo(DateTime::Format)'
05:21 MasterDuke joined #perl6
05:25 kerframil joined #perl6
05:46 eythian joined #perl6
05:52 Kaiepi joined #perl6
06:03 Sgeo joined #perl6
06:29 Todd_ I am having trouble installing modules on Fedora 26.  Would someone please look at my vpaste and see what I am doing wrong?  http://vpaste.net/x04uk
06:30 Todd_ All moduesl give the same error
06:30 sena_kun joined #perl6
06:41 lowbro joined #perl6
06:41 lowbro joined #perl6
07:07 El_Che Todd_: it looks like you're using system zef instead the one of the package
07:07 El_Che /opt/rakudo-pkg/bin/zef (as root) or /opt/rakudo-pkg/bin/install_zef_as_user if you want them in your $HOME
07:08 El_Che (the latter is the beter option for dev stuff)
07:10 El_Che Todd_: rakudo-pkg does not touch system path to no interfere with system rakudo (if present). You need to look at the PATH section in the doc to prevent this type of error
07:11 El_Che in short "export PATH=/opt/rakudo-pkg/bin:$PATH" will do (and adding ~/.perl6/bin if you install locally)
07:14 Todd_ I uninstalled the rakudo package and reinstalled Fedroa's and all is well.  Go figure ....
07:16 El_Che it's not related
07:16 El_Che you are using /usr/bin/zef
07:16 El_Che while the package provides /opt/rakudo-pkg/bin/zef
07:18 El_Che I decided not to change the user $PATH when I created the packages, maybe I need to review that, but not interfearing with system rakudo is a good thing, imho
07:19 El_Che even when not adapting the path can lead to weird (but safe) results
07:21 Todd_ I uninstalled rakudo and rakudo-ref.  Then did a global find and aced ANYTHING that had the letters "zef" in it.  I then installed the rakudo-pkg rpm.  That is when I got into trouble.  I did this same thing an fe hours earlier on a Fedora 27 server and it went perfectly, excewpt for the Perl 5 module mismatches that blew zef's mind.
07:22 Todd_ I have this Fedora 26 machien scheduels for upgrade to 27 tomorrow evening, so I may have to go through this again.
07:23 El_Che well, having to manually delete binaries is a bad thing is they were installed from packages
07:23 El_Che for the record, rakudo-okg is self contained in /opt/rakudo-pkg and modules installed locally are in ~/.perl6
07:24 El_Che nothing is written elsewhere
07:46 lichtkind joined #perl6
07:47 ChoHag joined #perl6
07:48 Todd_ It is going to be a fun night.  Thank you all for the wonderful help!
07:56 abraxxa joined #perl6
08:05 zakharyas joined #perl6
08:09 zakharyas1 joined #perl6
08:14 sjn joined #perl6
08:35 wamba joined #perl6
08:41 darutoko joined #perl6
08:45 Geth ¦ doc: 7a0bb28bdc | (Luca Ferrari)++ | doc/Type/Any.pod6
08:45 Geth ¦ doc: Improve &exit documentation.
08:45 Geth ¦ doc:
08:45 Geth ¦ doc: Specify that exit status code has to be interpreted by calling process, and
08:45 Geth ¦ doc: that LEAVE is prevented when using exit.
08:45 Geth ¦ doc: Remark that &exit should be used to terminate abnormally only the main process,
08:45 synopsebot Link: https://doc.perl6.org/type/Any
08:45 Geth ¦ doc: while exceptions should be used for other cases (e.g., methods).
08:45 Geth ¦ doc:
08:45 Geth ¦ doc: This does not remove the TODO item attached, but I believe
08:45 Geth ¦ doc: there's not a better place to document exit since it is already documented
08:45 Geth ¦ doc: with the usage of MAIN and the phasers.
08:46 Geth ¦ doc: review: https://github.com/perl6/doc/commit/7a0bb28bdc
08:46 Geth ¦ doc: fed435e1b2 | (Luca Ferrari)++ | doc/Language/functions.pod6
08:46 synopsebot Link: https://doc.perl6.org/language/functions
08:46 Geth ¦ doc: Explain that 'return' in MAIN will produce always an exit code of zero.
08:46 Geth ¦ doc: review: https://github.com/perl6/doc/commit/fed435e1b2
08:47 scimon joined #perl6
08:58 melezhik joined #perl6
09:06 zakharyas joined #perl6
09:13 torbjorn the token/rule names found in key names in the resulting Match object - is there magic involved in determining whta class they get?
09:14 torbjorn ie token foo { [foo]* } # would that result in $/<foo> being an Array because of the * ?
09:14 dakkar joined #perl6
09:18 moritz [foo] doesn't capture
09:18 moritz (foo)* does, and yes, $<foo> would be an array
09:18 moritz the only exception is the ? quantifier, which produces either a Match or a Nil capture
09:32 lelf joined #perl6
09:33 torbjorn ah yes, () of course
09:34 torbjorn so token foo { foo } # woueld not be an array?
09:34 moritz that doesn't even capture
09:35 moritz well, $<foo> in the caller caputres
09:36 lelf How do you do “:(Foo[::T] \a, Foo[T] \b)”? Akin to “:(::T \a, T \b)”. [Foo is defined]
09:36 moritz m: my token foo { foo }; 'foo' ~~ /<foo>/ and say $<foo>.^name
09:36 camelia rakudo-moar f02606cea: OUTPUT: «Match␤»
09:36 moritz m: my token foo { foo }; 'foo' ~~ /<foo>+/ and say $<foo>.^name
09:36 camelia rakudo-moar f02606cea: OUTPUT: «Array␤»
09:45 Geth ¦ doc: e3edec2d40 | (Luca Ferrari)++ | doc/Language/functions.pod6
09:45 Geth ¦ doc: Small rephrasing about coercion.
09:45 Geth ¦ doc:
09:45 Geth ¦ doc: Also define the example class Bar at the beginning of the example, there is
09:45 Geth ¦ doc: no point here to leave it abstract.
09:45 synopsebot Link: https://doc.perl6.org/language/functions
09:45 Geth ¦ doc: review: https://github.com/perl6/doc/commit/e3edec2d40
09:54 dakkar hmm. re: coercion, I feel it mixes "target type" and "method used to get it". I can't say «sub x(IO::Path() $d) { ... }», even though «sub x(IO() $d) { ... }» will actually coerce to IO::Path
09:55 dakkar m: sub x(IO::Path()$d) { $d.^name.say}; x('a')
09:55 camelia rakudo-moar f02606cea: OUTPUT: «No such method 'IO::Path' for invocant of type 'Str'␤  in sub x at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
09:55 dakkar m: sub x(IO()$d) { $d.^name.say}; x('a')
09:55 camelia rakudo-moar f02606cea: OUTPUT: «IO::Path␤»
10:00 travis-ci joined #perl6
10:00 travis-ci Doc build errored. Luca Ferrari 'Small rephrasing about coercion.
10:00 travis-ci https://travis-ci.org/perl6/doc/builds/327159440 https://github.com/perl6/doc/compare/fed435e1b268...e3edec2d409b
10:00 travis-ci left #perl6
10:00 buggable [travis build above] ☠ Did not recognize some failures. Check results manually.
10:04 stmuk_ joined #perl6
10:05 zakharyas1 joined #perl6
10:08 ChoHag joined #perl6
10:30 wamba joined #perl6
10:54 ChoHag joined #perl6
10:56 Zoffix joined #perl6
10:59 Zoffix dakkar: it's just a convention that a method named "Foo" converts an object to type "Foo". The coersion merely calls a method with .^name of target type. Str does not have "IO::Path" method so that coersion rightly fails. IO::Path does role IO tho and Str type has IO method that returns an IO object (IO::Path in this case).
11:00 Zoffix But nothing's stopping you from defining a method with IO::Path as a name and using IO::Path as target type in coercer
11:00 Zoffix m: use MONKEY; augment class Str { method IO::Path { self.IO } }; -> IO::Path(Str) $x { dd $x }("foo")
11:00 camelia rakudo-moar f02606cea: OUTPUT: «IO::Path.new("foo", :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))␤»
11:01 dct joined #perl6
11:04 Zoffix FWIW, there are also two paths in coersion: the slow path will try to see if there's a method and complain if there isn't:
11:04 Zoffix m: try '-> IO::Path(Str) :foo(:bar(:$ber)) {}("x")'.EVAL; say [$!.^name, $!]
11:04 camelia rakudo-moar f02606cea: OUTPUT: «[X::AdHoc Unable to coerce value for '$ber' from Str to IO::Path; no coercion method defined␤  in block <unit> at EVAL_0 line 1␤  in block <unit> at <tmp> line 1␤]␤»
11:05 Zoffix But the fast path will go right away to try to call it and will just throw method not found error as a result:
11:05 Zoffix m: try '-> IO::Path(Str) {}("x")'.EVAL; say [$!.^name, $!]
11:05 camelia rakudo-moar f02606cea: OUTPUT: «[X::Method::NotFound No such method 'IO::Path' for invocant of type 'Str'␤  in block <unit> at EVAL_0 line 1␤  in block <unit> at <tmp> line 1␤]␤»
11:06 ckraniak joined #perl6
11:07 Zoffix (that's an implementation detail, but perhaps the docs should be more vague about what gets thrown when coercion fails)
11:11 rindolf joined #perl6
11:13 Zoffix m: -> ::T \a where Array[T.of], \b where Array[T.of] {}(Array[Int], Array[Int])
11:13 camelia rakudo-moar f02606cea: ( no output )
11:13 Zoffix m: -> ::T \a where Array[T.of], \b where Array[T.of] {}(Array[Int], Array[Num])
11:13 camelia rakudo-moar f02606cea: OUTPUT: «Constraint type check failed in binding to parameter 'b'; expected anonymous constraint to be met but got Array[Num] (Array[Num])␤  in block <unit> at <tmp> line 1␤␤»
11:13 ilmari joined #perl6
11:13 ilmari joined #perl6
11:15 Zoffix lelf: doesn't look like that's implemented (filed as R#1383). That ^ looks like a slower workaround you could use
11:15 synopsebot R#1383 [open]: https://github.com/rakudo/rakudo/issues/1383 [NYI] Type capture in parametarization NYI
11:18 Zoffix left #perl6
11:22 lelf ha! alright
11:24 lelf m: (my Int @ = [1..3]).WHAT # ← is there a shortcut for this?
11:24 camelia rakudo-moar f02606cea: ( no output )
11:24 margeas joined #perl6
11:30 lelf specifiying the *.of type I mean…  this is also too wordy:
11:30 lelf m: Array[Int]([1..3]).of
11:30 camelia rakudo-moar f02606cea: ( no output )
11:36 jnthn Could be (my Int @ = 1..3) or Array[Int](1..3) I'd think
11:36 jnthn Saves creating a throw-away Array
11:49 moritz m: dd Array[Int].new(1, 2, 3)
11:49 camelia rakudo-moar 7230b7651: OUTPUT: «Array[Int].new(1, 2, 3)␤»
11:53 dakkar re: type coercions, I understand everything that Zoffix said, and I know why it's that way. My issue is that the *documentation* says that in «Foo() $x», Foo is the parameter type that things get coerced to.
11:53 dakkar but that's not correct. It's both a type constraint, and the name of the conversion method
11:54 dakkar if I want a IO::Path, but not a IO::Special, and allow my callers to pass me a string… I can't
11:55 dakkar (and no, sub x(IO() $x where IO::Path) is a terrible work-around)
11:55 dakkar could we add a «sub IO::Path» alongside «sub IO», and document more clearly what the coercion actually does?
11:55 dakkar I may try doing that this weekend…
12:01 scimon Generally if I want a string that should be a valid IO::Path I make a subset but that's me. subset DirPath of Str where *.IO.d
12:01 scimon That sort of thing.
12:02 andrzejku joined #perl6
12:03 scimon I dunno. I'm not feeling 100% at the moment so am probably not understanding.
12:03 andrzejku hi
12:03 andrzejku can you see my messages?
12:04 dupadupakupa joined #perl6
12:05 DrForr andrzejku: Yes.
12:05 andrzejku thnks :)
12:05 andrzejku I decided to use sublime for irc and it looks it is working
12:06 DrForr irssi+tmux=shiny.
12:15 ilmari tmux, schmux
12:15 ilmari screen 4lyf
12:20 cdg joined #perl6
12:22 DrForr I started out with screen, but split-display sold me.
12:25 SCHAPiE joined #perl6
12:26 Altreus irssi ftl
12:26 Altreus weechat 4 lyf
12:28 * moritz wtf
12:29 DrForr Shrug.
12:45 leah2 joined #perl6
12:55 lelf I'm prob missing something trivial: how do you “X fff Y” getting list of lists (one for each matching sequence)?
12:55 moritz lelf: example?
12:56 ckraniak joined #perl6
12:57 lelf <begin 1 2 end begin 3 end X begin …> ⇒ [[1,2], [3], …]
12:59 masak lelf: not sure `fff` is the best tool for that, but it's definitely doable with (say) a recursive function or a loop/given construction
13:01 masak lelf: the problem you're bound to run into with `fff` is that its internal state is per *site* in the code -- which doesn't square well with needing one state per [] list
13:01 Geth ¦ doc: 0cfb87fb9e | (Luca Ferrari)++ | doc/Language/exceptions.pod6
13:01 Geth ¦ doc: Explain die uses $*ERR.
13:01 Geth ¦ doc:
13:01 Geth ¦ doc: See issue #1722.
13:01 Geth ¦ doc: review: https://github.com/perl6/doc/commit/0cfb87fb9e
13:01 synopsebot Link: https://doc.perl6.org/language/exceptions
13:01 Geth ¦ doc: 28d8512437 | (Luca Ferrari)++ | doc/Language/exceptions.pod6
13:01 Geth ¦ doc: Add a $*ERR.say on a simple catch block as example of how to use STDERR.
13:01 Geth ¦ doc:
13:01 Geth ¦ doc: See discussion in issue #1722.
13:01 Geth ¦ doc: review: https://github.com/perl6/doc/commit/28d8512437
13:02 masak (more exactly, there's one internal state per clone of the surrounding function. but that helps little here. I guess you *could* clone the function once per new list -- say, by re-entering the surrounding function -- but at this point I'd argue that we're far into X/Y land, and should use another tool.)
13:02 masak lelf: on a high level, what you appear to be doing is turning SAX into DOM :)
13:03 masak lelf: how do you plan to handle mis-nested data such as <end begin> or <begin end end begin> ?
13:03 masak (another thing `fff` won't do for you)
13:15 lelf no, no nesting
13:19 raschipi joined #perl6
13:21 masak no nesting? um, but `[1, 2]` is nested inside `[[1, 2], [3], ...]`
13:22 leah2 joined #perl6
13:23 lelf there can't be begin-end inside begin-end. so… say, one-level nesting
13:24 masak ok, now I see what you're saying
13:26 travis-ci joined #perl6
13:26 travis-ci Doc build passed. Luca Ferrari 'Add a $*ERR.say on a simple catch block as example of how to use STDERR.
13:26 travis-ci https://travis-ci.org/perl6/doc/builds/327219218 https://github.com/perl6/doc/compare/e3edec2d409b...28d8512437a1
13:26 travis-ci left #perl6
13:26 masak m: my @result; my @part; for <begin 1 2 end begin 3 end> { when "begin" { @part = () }; when "end" { @result.push(@part) }; default { @part.push($_) } }; say @result.perl
13:26 camelia rakudo-moar 773d2b9e7: OUTPUT: «[[IntStr.new(3, "3")], [IntStr.new(3, "3")]]␤»
13:26 masak hm :)
13:27 masak m: my @result; my @part; for <begin 1 2 end begin 3 end> { when "begin" { @part := [] }; when "end" { @result.push(@part) }; default { @part.push(+$_) } }; say @result.perl
13:27 camelia rakudo-moar 773d2b9e7: OUTPUT: «[[1, 2], [3]]␤»
13:28 lelf I'm itching for a Haskell’s groupBy function (group elements by comparing adjacent ones). So like squish, but groupping, not uniquing.
13:30 jnthn lelf: See categorize and classify
13:30 jnthn Oh, but that doesn't require adjacency
13:40 masak yeah, that's where the `fff` angle isn't all bad
13:40 masak it just fails in other ways
13:41 masak nothing stopping you from writing your own grouping function, though
13:41 itaipu joined #perl6
13:44 * [Coke] waves good morning over his bacon & coffee.
13:48 perlpilot joined #perl6
13:54 cdg joined #perl6
13:55 vichib joined #perl6
13:55 vichib joined #perl6
13:56 cdg joined #perl6
14:02 zakharyas joined #perl6
14:09 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin') Z @i.grep(:k, 'end')
14:09 camelia rakudo-moar 773d2b9e7: OUTPUT: «((0 3) (4 6))␤»
14:10 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1)
14:10 camelia rakudo-moar 773d2b9e7: OUTPUT: «((1 2) (5 5))␤»
14:11 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1).map({@i[&infix<..>(|$_)})
14:11 camelia rakudo-moar 8c5af9b97: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in subscript; couldn't find final ']' (corresponding starter was at line 1)␤at <tmp>:1␤------> 3 'end').map(*-1).map({@i[&infix<..>(|$_)7⏏5})␤    expecting any of:…»
14:12 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1).map({@i[&infix<..>(|$_)]})
14:12 camelia rakudo-moar 8c5af9b97: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    infix used at line 1. Did you mean 'indir', 'index'?␤␤»
14:12 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1).map({@i[&infix:<..>(|$_)]})
14:12 camelia rakudo-moar 8c5af9b97: OUTPUT: «Too few positionals passed; expected 2 arguments but got 1␤  in block <unit> at <tmp> line 1␤␤»
14:12 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1).map({@i[&infix:<..>(|$_.list)]})
14:12 camelia rakudo-moar 8c5af9b97: OUTPUT: «Too few positionals passed; expected 2 arguments but got 1␤  in block <unit> at <tmp> line 1␤␤»
14:12 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1).map({ say $_.perl })
14:12 camelia rakudo-moar 8c5af9b97: OUTPUT: «2␤5␤((1 True) (5 True))␤»
14:12 moritz m: my @i = <begin 1 2 end begin 3 end>; say @i.grep(:k, 'begin').map(*+1) Z=> @i.grep(:k, 'end').map(*-1).map({ say $_.perl })
14:12 camelia rakudo-moar 8c5af9b97: OUTPUT: «2␤5␤(1 => True 5 => True)␤»
14:13 jkramer joined #perl6
14:13 jkramer p6: '11325992321982432123259' ~~ m:ex/[ (\d ** 2..*) \d* ] ** 2..*/
14:13 camelia rakudo-moar 8c5af9b97: OUTPUT: «MoarVM panic: Memory allocation failed; could not allocate 100208 bytes␤»
14:13 moritz m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z=> @i.grep(:k, 'end').map(*-1)).map({@i[&infix:<..>(|$_.list)]})
14:13 camelia rakudo-moar 8c5af9b97: OUTPUT: «(1 => 2 5 => 5)␤Too few positionals passed; expected 2 arguments but got 1␤  in block <unit> at <tmp> line 1␤␤»
14:13 jkramer Does this work for anyone? It uses 100% CPU for me and hangs forever
14:13 atta joined #perl6
14:13 moritz m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z=> @i.grep(:k, 'end').map(*-1)).map({say .perl })
14:13 camelia rakudo-moar 8c5af9b97: OUTPUT: «(1 => 2 5 => 5)␤Bool::True␤»
14:14 jkramer Ah I guess it doesn't :)
14:14 moritz jkramer: try it with fewer characters first?
14:14 moritz m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1)).map({say .perl })
14:14 camelia rakudo-moar 8c5af9b97: OUTPUT: «((1 2) (5 5))␤Bool::True␤»
14:14 jkramer p6: '112112' ~~ m:ex/[ (\d ** 2..*) \d* ] ** 2..*/
14:14 camelia rakudo-moar 8c5af9b97: ( no output )
14:14 moritz m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1)).map({@i[&infix:<..>(|$_.list)]})
14:14 camelia rakudo-moar 8c5af9b97: OUTPUT: «((1 2) (5 5))␤Too few positionals passed; expected 2 arguments but got 1␤  in block <unit> at <tmp> line 1␤␤»
14:15 jkramer Oh wait that regex is broken anyway :D
14:15 timotimo "memory allocation failed" is often the result of infinite recursion of some kind
14:15 moritz m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z @i.grep(:k, 'end').map(*-1)).map({@i[.[0] .. .[1]]})
14:15 camelia rakudo-moar 8c5af9b97: OUTPUT: «((1 2) (5 5))␤Index out of range. Is: 1, should be in 0..0␤  in block <unit> at <tmp> line 1␤␤»
14:15 moritz :(
14:17 timotimo moritz: why not Z.. actually? and then index into @i directly with the result?
14:17 timotimo m: my @i = <begin 1 2 end begin 3 end>; (say @i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]})
14:17 camelia rakudo-moar 8c5af9b97: OUTPUT: «(1..2 5..5)␤»
14:18 timotimo m: my @i = <begin 1 2 end begin 3 end>; say (say @i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]})
14:18 camelia rakudo-moar 8c5af9b97: OUTPUT: «(1..2 5..5)␤((1))␤»
14:18 timotimo m: my @i = <begin 1 2 end begin 3 end>; say (say @i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({say $_; @i[@$_]})
14:18 camelia rakudo-moar 8c5af9b97: OUTPUT: «(1..2 5..5)␤True␤((1))␤»
14:18 timotimo oh, haha
14:18 timotimo m: my @i = <begin 1 2 end begin 3 end>; say (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({say $_; @i[@$_]})
14:18 camelia rakudo-moar 8c5af9b97: OUTPUT: «1..2␤5..5␤((1 2) (3))␤»
14:18 buggable New CPAN upload: List-Util-0.0.1.tar.gz by ELIZABETH https://cpan.metacpan.org/authors/id/E/EL/ELIZABETH/Perl6/List-Util-0.0.1.tar.gz
14:18 timotimo m: my @i = <begin 1 2 end begin 3 end>; say (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]})
14:18 camelia rakudo-moar 8c5af9b97: OUTPUT: «((1 2) (3))␤»
14:19 committable6 joined #perl6
14:20 jkramer p6: '112112' ~~ m:ex/(\d ** 2..*) [\d* ($0)]+/
14:20 camelia rakudo-moar 8c5af9b97: ( no output )
14:21 timotimo m: my @i = <begin 1 2 end begin 3 end>; @i.grep('begin'|'end') Zeq |('begin', 'end') xx * ?? (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]}) !! fail "malformed begin/end pairins"
14:21 camelia rakudo-moar 8c5af9b97: OUTPUT: «Potential difficulties:␤    Useless use of Zeq in sink context␤    at <tmp>:1␤    ------> 3nd begin 3 end>; @i.grep('begin'|'end') 7⏏5Zeq |('begin', 'end') xx * ?? (@i.grep(:␤»
14:21 timotimo m: my @i = <begin 1 2 end begin 3 end>; ([&&] @i.grep('begin'|'end') Zeq |('begin', 'end') xx *) ?? (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]}) !! fail "malformed begin/end pairins"
14:21 camelia rakudo-moar 8c5af9b97: ( no output )
14:21 timotimo m: my @i = <begin 1 2 end begin 3 end>; say ([&&] @i.grep('begin'|'end') Zeq |('begin', 'end') xx *) ?? (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]}) !! fail "malformed begin/end pairins"
14:21 camelia rakudo-moar 8c5af9b97: OUTPUT: «((1 2) (3))␤»
14:21 timotimo m: my @i = <begin 1 2 begin 3 end end>; say ([&&] @i.grep('begin'|'end') Zeq |('begin', 'end') xx *) ?? (@i.grep(:k, 'begin').map(*+1) Z.. @i.grep(:k, 'end').map(*-1)).map({@i[@$_]}) !! fail "malformed begin/end pairins"
14:21 camelia rakudo-moar 8c5af9b97: OUTPUT: «malformed begin/end pairins␤  in block <unit> at <tmp> line 1␤␤»
14:21 jkramer Any ideas why this doesn't match?
14:22 jkramer Shouldn't it return both 11 and 112 twice each?
14:23 timotimo you want :ex and :ov maybe?
14:23 timotimo p6: '112112' ~~ m:ex:ov/(\d ** 2..*) [\d* ($0)]+/
14:23 camelia rakudo-moar 8c5af9b97: ( no output )
14:23 timotimo p6: say '112112' ~~ m:ex:ov/(\d ** 2..*) [\d* ($0)]+/
14:23 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:23 timotimo p6: say '112112' ~~ m:ex/(\d ** 2..*) [\d* ($0)]+/
14:23 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:24 jkramer Doesn't ex imply ov?
14:24 jkramer > To find all possible matches of a regex – including overlapping ones – and several ones that start at the same position, use the :exhaustive (short :ex) adverb.
14:25 timotimo ah
14:25 timotimo p6: say '112112' ~~ rx/(\d ** 2..*) [\d* ($0)]+/
14:25 camelia rakudo-moar 8c5af9b97: OUTPUT: «Nil␤»
14:26 timotimo p6: say '112112' ~~ rx/(\d ** 2..*)/
14:26 camelia rakudo-moar 8c5af9b97: OUTPUT: «「112112」␤ 0 => 「112112」␤»
14:26 timotimo p6: say '11112' ~~ rx/(\d ** 2..*) [($0)]+/
14:26 camelia rakudo-moar 8c5af9b97: OUTPUT: «Nil␤»
14:26 timotimo p6: say '11112' ~~ rx/(\d ** 2..*) [($0)]/
14:26 camelia rakudo-moar 8c5af9b97: OUTPUT: «Nil␤»
14:27 timotimo hm?
14:27 timotimo p6: say '11112' ~~ rx/(\d **? 2..*) [\d*? ($0)]/
14:27 camelia rakudo-moar 8c5af9b97: OUTPUT: «Nil␤»
14:27 jkramer p6: '112112' ~~ m:ex/(\d ** 2..*) \d* $0/
14:27 camelia rakudo-moar 8c5af9b97: ( no output )
14:27 jkramer Hmm weird the versionwith $0 without parens works for me locally, just not with ($0)
14:27 timotimo you're not outputting anything
14:27 timotimo p6: say '112112' ~~ m:ex/(\d ** 2..*) \d* $0/
14:28 camelia rakudo-moar 8c5af9b97: OUTPUT: «(「112112」␤ 0 => 「112」 「11211」␤ 0 => 「11」 「12112」␤ 0 => 「12」)␤»
14:28 jkramer Oh
14:28 jkramer p6: say '112112' ~~ m:ex/(\d ** 2..*) \d* ($0)/
14:28 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:28 timotimo oh
14:28 jkramer Why doesn't $0 work with parens?
14:28 timotimo because nested parens, i bet
14:28 timotimo m: say 'aabbcde' ~~ m/(\w) $0 ((\w) $0)/
14:28 camelia rakudo-moar 8c5af9b97: OUTPUT: «「aabb」␤ 0 => 「a」␤ 1 => 「bb」␤  0 => 「b」␤»
14:29 timotimo i should get waked up or something
14:29 timotimo m: say 'aabbaaba' ~~ m/(\w) $0 [(\w) $0]/
14:29 camelia rakudo-moar 8c5af9b97: OUTPUT: «「aaba」␤ 0 => 「a」␤ 1 => 「b」␤»
14:29 timotimo there you can see the difference more clearly; but most clearly if it's printed with proper newlines
14:33 timotimo p6: say '112112' ~~ m:P5:ex/(\d{2,}) \d* ($1)/
14:33 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:33 timotimo p6: say '112112' ~~ m:P5:ex/(\d{2,}) \d* ($0)/
14:33 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:33 timotimo i wonder how we compile that
14:33 timotimo p6: say '112112' ~~ m:P5:ex/(\d{2,}) \d* $0/
14:33 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:36 timotimo jkramer: does that help?
14:36 timotimo not the last three lines, of course
14:36 timotimo those are just noise
14:37 rindolf joined #perl6
14:38 ggoebel joined #perl6
14:38 jkramer timotimo: Yeah thanks, I found some kind of workaround using another parens around the whole thing: '112112' ~~ m:ex/((\d ** 2..*) \d* $0)+/
14:40 moritz if you're already using :ex, why use the + inside the regex at all?
14:41 timotimo p6: say '112112' ~~ m:P5:ex/(\d{2,}) \d* \1/
14:41 camelia rakudo-moar 8c5af9b97: OUTPUT: «()␤»
14:41 timotimo how does p5 regex do backreferences to numbered captured groups again ...
14:41 jkramer \1 :)
14:42 jkramer I think
14:42 aquila-chrysaeto joined #perl6
14:42 timotimo right. $0 turned into an INTERPOLATE call in the :P5 regex i had up there
14:43 jkramer moritz: 'cause I want to count the repetitions of the number, but I haven't quite figured out how to do this with the Match object I'm getting
14:45 moritz jkramer: what problem are you trying to solve?
14:47 jkramer moritz: I want to find all numbers of 2+ digits in a string made of digits and the number of their occurances :)
14:47 jkramer It's not a real problem, just a random programming practice I found somewhere to get used to Perl 6 :)
14:48 moritz m: say '11211' ~~ m:ex/\d ** 2..* /
14:48 camelia rakudo-moar 8c5af9b97: OUTPUT: «(「11211」 「1121」 「112」 「11」 「1211」 「121」 「12」 「211」 「21」 「11」)␤»
14:49 moritz m: say ('11211' ~~ m:ex/\d ** 2..* /).map(*.Str).Bag
14:49 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(11(2), 112, 1121, 11211, 12, 121, 1211, 21, 211)␤»
14:49 timotimo m: say '11211'.comb.rotor(2=>-1).>>join("").Bag
14:49 camelia rakudo-moar 8c5af9b97: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing dot on method call␤at <tmp>:1␤------> 3say '11211'.comb.rotor(2=>-1).>>7⏏5join("").Bag␤    expecting any of:␤        postfix␤»
14:49 timotimo m: say '11211'.comb.rotor(2=>-1)>>.join("").Bag
14:49 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(11(2), 12, 21)␤»
14:49 timotimo jkramer: how's that?
14:50 moritz timotimo: that's only 2 digit numbers, not 2+ digit numbers
14:50 timotimo oh, of course!
14:50 ckraniak joined #perl6
14:50 timotimo m: say ('11211' ~~ rx:ex/\d ** 2..*/).Bag
14:50 camelia rakudo-moar 8c5af9b97: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Adverb ex not allowed on rx␤at <tmp>:1␤------> 3say ('11211' ~~ rx:ex/\d ** 2..*/7⏏5).Bag␤»
14:50 timotimo m: say ('11211' ~~ m:ex/\d ** 2..*/).Bag
14:50 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(「11211」, 「1121」, 「112」, 「11」, 「11」, 「1211」, 「121」, 「12」, 「211」, 「21」)␤»
14:51 timotimo m: say ('11211' ~~ m:ex/\d ** 2..*/)>>.Str.Bag
14:51 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(11(2), 112, 1121, 11211, 12, 121, 1211, 21, 211)␤»
14:51 timotimo with the original regex implementaiton you had you also have the problem that the second time some two-digit thing appears, it'll be the start of another attempt again
14:51 timotimo so you'll count everything multiple times
14:52 moritz m: say bag '11211' ~~ m:ex/\d\d+/ # golfing!
14:52 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(「11211」, 「1121」, 「112」, 「11」, 「11」, 「1211」, 「121」, 「12」, 「211」, 「21」)␤»
14:52 moritz m: say bag ~<< '11211' ~~ m:ex/\d\d+/ # golfing!
14:52 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(False)␤»
14:52 moritz m: say bag ~<<('11211' ~~ m:ex/\d\d+/)
14:52 camelia rakudo-moar 8c5af9b97: OUTPUT: «Bag(11(2), 112, 1121, 11211, 12, 121, 1211, 21, 211)␤»
14:53 timotimo that looks nicer
14:54 jdoege joined #perl6
14:58 jdoege Good (whatever time of day it is wherever you may be). I have a question and i am hoping someone here may have an answer. I have a large grammar that is finally working really well. The last task I have for it is to ignore comments. My plan is to redefine the ws token to include a comment regex. However, to get started, I began by simply redefining the ws token to what I believe it already is: token ws { \s+ | <|w> }
15:00 jdoege When I test my parser with this redefined ws token, it quickly fails on test cases it previously passed on when I would expect (nearly) identical behavior.
15:00 jdoege Did I redefine ws incorrectly?
15:01 raschipi Did you use the non-capturing form? <.ws>
15:01 jdoege Also, I notice that the parser now explicitly parses ws (as seen in Grammar::Trace output) whereas previously it was implicit and invisible. Is that expected?
15:02 jdoege I never reference ws directly. This is just implicit rule usage.
15:02 perlpilot that last bit is interesting
15:03 raschipi So, after declaring it you lost the magic, is that it?
15:03 jdoege Yup.
15:08 Actualeyes joined #perl6
15:10 Grauwolf joined #perl6
15:16 lancew joined #perl6
15:18 jdoege Interesting. Despite the documentation saying that ws matches \s+ or <|w>, there is an example of redefining ws to not match vertical whitespace that looks like this: token ws { <!ww> \h* } When I change my definition to token ws { <!ww> \s* } my parser resumes working. A bit of documentation clarification/correction may be in order. I am not sure I understand the distinction between these two definitions.
15:19 FROGGS joined #perl6
15:22 El_Che joined #perl6
15:29 Actualey` joined #perl6
15:45 aquila-chrysaeto joined #perl6
15:49 eliasr joined #perl6
15:51 jkramer timotimo: Nice, I didn't think of that, I focused too much on doing it all with a regex. :) I ended up with this one-liner (some formatting of the result included):
15:51 jkramer .match(/(..+)/, :ex)>>.Str.Bag.pairs.grep(*.value > 1).map(*.kv.join(':')).join(' ').say for $*IN.lines;
15:52 lizmat jkramer: I think you can leave out the .pairs there
15:53 jkramer lizmat: True, thanks :)
15:55 jkramer Saved a few more bytes by replacing .join(' ') with .Str :)
15:55 timotimo m: my $b = bag <hi hi hi bye bye lo>; say $b >>->> 1
15:55 camelia rakudo-moar a0486e548: OUTPUT: «Cannot modify an immutable Bag (Bag())␤  in block <unit> at <tmp> line 1␤␤»
15:55 timotimo m: my $b = bag <hi hi hi bye bye lo>
15:55 camelia rakudo-moar a0486e548: ( no output )
15:56 timotimo m: my $b = <hi hi hi bye bye lo>.BagHash; say $b; say $b >>->> 1; say $b
15:56 camelia rakudo-moar a0486e548: OUTPUT: «BagHash(bye(2), hi(3), lo)␤BagHash(bye, hi(2))␤BagHash(bye(2), hi(3), lo)␤»
15:56 timotimo m: my $b = <hi hi hi bye bye lo>.BagHash; say $b; say ($b >>->> 1) >>+>> 1; say $b
15:56 camelia rakudo-moar a0486e548: OUTPUT: «BagHash(bye(2), hi(3), lo)␤BagHash(bye(2), hi(3))␤BagHash(bye(2), hi(3), lo)␤»
15:56 timotimo a nice, round-about way to filter out things that only have one entry in the bag
15:57 lizmat sometimes I think a dedicated method for Bags would help
16:00 cdg joined #perl6
16:01 timotimo dedicated what method?
16:02 cdg joined #perl6
16:03 cdg_ joined #perl6
16:04 lizmat for grepping out items by frequency
16:04 lizmat the .grep is general, so it goes out and creates Pairs, and take the value, etc. etc.
16:04 lizmat while a dedicated method wouldn't need to do all of that
16:05 lizmat Bag.frequency(1) would give all elements with a frequence of 1
16:05 lizmat Bag.frequency(* > 1) would give all elements with a frequence > 1
16:05 lizmat *frequency
16:06 Ulti by elements do you mean just the keys or the pairs?
16:07 Ulti this is a nice idea for if you're using bag models for stats
16:07 lizmat just the keys
16:12 squashable6 joined #perl6
16:18 vichib joined #perl6
16:18 vichib joined #perl6
16:20 esh joined #perl6
16:23 john51 joined #perl6
16:26 lelf` joined #perl6
16:27 esh joined #perl6
16:27 vichib joined #perl6
16:28 * [Coke] had to rediscover Test::More in p5 today, whoops.
16:29 vichib joined #perl6
16:29 [Coke] "why aren't I getting test descriptions!?" /me's brain full
16:34 domidumont joined #perl6
16:34 moritz prove -v ?
16:35 [Coke] moritz: no, because I was using Perl 5's "Test", not "Test::More"
16:38 ckraniak joined #perl6
16:38 moritz aaaarg
16:40 [Coke] Wonder if it'd be worth trying to convert this to Inline::Perl5 (need WWW::Mechanize).
16:46 esh joined #perl6
16:50 * lizmat notes WWW::Mechanize is really needed
16:55 cdg joined #perl6
16:57 cdg__ joined #perl6
16:58 hoelzro joined #perl6
17:02 troys joined #perl6
17:05 El_Che lizmat: or something minimalistic in the style of https://github.com/headzoo/surf
17:09 khw joined #perl6
17:23 coverable6 joined #perl6
17:23 benchable6 joined #perl6
17:26 domidumont joined #perl6
17:37 cdg joined #perl6
17:39 bisectable6 joined #perl6
17:44 wamba joined #perl6
17:44 zakharyas joined #perl6
17:52 raschipi_ joined #perl6
18:13 leah2 joined #perl6
18:32 st_elmo joined #perl6
18:46 |oLa| joined #perl6
18:49 bdmatatu joined #perl6
18:51 bdmatatu Hi folks, is there a p6 equivalent to Perl 5's 'do FILE'?
18:52 Kaiepi joined #perl6
18:53 raschipi_ run?
18:54 DrForr You probably want EVALFILE, according to the 5to6 docs.
18:54 bdmatatu I think that runs it in another process...I'm thinking like 'use' but for something that's not *.pm or *.pm6
18:54 bdmatatu oh, thanks DrForr
18:55 Kaiepi joined #perl6
18:59 lizmat bdmatatu: EVAL slurp $file
19:01 bdmatatu Great, that works too
19:02 lizmat FWIW, EVALFILE is better, and doesn't run in another process
19:02 itaipu joined #perl6
19:02 lizmat in fact, it is basically implemented as EVAL slurp $fule
19:02 lizmat $file
19:04 bdmatatu I was kind of hoping it might also be possible to do that in the current lexical scope (e.g. any lexical vars in FILE would still be visible)
19:05 |oLa| left #perl6
19:07 lizmat they are, if you use EVALFILE
19:07 bdmatatu oh!
19:07 El_Che EVALFILE will be the title of the first security trolling talk about Perl 6 ;)
19:08 lizmat bdmatatu: if you put a "say $a" in a file "foo", and then do "my $a = 42; EVALFILE 'foo', it *will* say "42"
19:09 bdmatatu Okay, I was thinking about declaring 'my $a' in file foo and then trying to use it after doing an EVALFILE
19:09 bdmatatu I could see how that would be bad securitywise
19:10 lizmat you cannot change a pad once it is executing
19:11 El_Che bdmatatu: isn't a yaml or json file an alternative for declaring variables?
19:12 [Coke] lizmat: I had someone actually give me a hard time about using perl 5 on this (even though I am the only one who writes one offs in perl here. He was suprised to see me use 5 instead of 6)
19:12 lizmat well, yes
19:12 [Coke] (he was just teasing, but I still felt like I cheated. :)
19:12 * lizmat looks sternly at [Coke]
19:13 DrForr bdmatatu: Look at one of the config modules, or even (like others say) a .json or .yaml file - Letting configuration files run arbitrary code can get ugly.
19:13 bdmatatu Yeah I know it's ugly, but can be really handy for debugging and experimenting
19:13 timotimo or use a programming language that's made for config files: Lua
19:14 El_Che bdmatatu: It's not much effort to put the contents of a yaml or json file in an hash
19:14 lizmat m: my $a = 42 but role { method foo { "foo" } }; say $a; say $a.foo  # perhaps another way to add debugging info to values ?
19:15 camelia rakudo-moar d30e5b1e3: OUTPUT: «42␤foo␤»
19:15 bdmatatu The idea is that I want to load a script from a repl session and look at all the variables that were declared
19:15 lizmat m: role foo { has $.foo }; my $a = 42 but foo("bar"); say $a; say $a.foo  # another way
19:15 camelia rakudo-moar d30e5b1e3: OUTPUT: «42␤bar␤»
19:17 El_Che lizmat, AlexDaniel` , jnthn: 2017.12 rakudo linux packages are being built. Thx for fixing the bug
19:17 esh joined #perl6
19:17 lizmat El_Che++  # perseverance!
19:18 El_Che lizmat: people call other names referring to that :)
19:18 TEttinger El_Che: tenacity?
19:18 El_Che pain in the ass
19:18 El_Che :)
19:19 TEttinger force of will? Nietzche's usage of a similar term in German?
19:20 El_Che don't go there :)
19:20 ggoebel joined #perl6
19:22 TEttinger persistence
19:22 TEttinger :)
19:26 ckraniak joined #perl6
19:30 esh joined #perl6
19:33 esh joined #perl6
19:36 tobs I'd like to react whenever $*IO.lines but that code seems to want to slurp .lines. Iterating with 'for' works but I like Supply as a conceptual wrapper and also need multiple taps.
19:36 esh joined #perl6
19:36 tobs Can someone help? A Supply of a lazy Seq seems like something natural
19:38 jnthn Try react whenever Supply.from-list($*IO.lines) { }
19:39 greppable6 joined #perl6
19:39 tobs That isn't interactive either. It waits until I Ctrl+D (Rakudo 2017-07 still, if that makes a difference)
19:40 japhb joined #perl6
19:41 tobs s/$*IO/$*IN/ specifically
19:43 esh joined #perl6
19:46 jnthn Hm, curious, if I do perl6 -e 'react whenever Supply.from-list($*IN.lines) { .say }' then type foo and press enter, it immediately outputs foo
19:47 tobs Not here, with the same line. Updating Rakudo can't hurt (I hope)
19:47 lizmat STDIN isn't buffered, is it ?
19:47 jnthn It's either fixed in a more recent version or it's platform sensitive; handy I have 2017.12 on Linux (works) and 2017.07 on Windows (doesn't)
19:48 tobs 2017.07 on Linux here
19:48 jnthn OK, then it's most probably a fix since then
19:48 El_Che 2017.12 rpms/devs/apk should be out in some minutes
19:48 jnthn oh, also maybe try: react whenever Supply.from-list($*IN.lines, :scheduler($*SCHEDULER)) { .say }
19:50 tobs jnthn: that works
19:51 jnthn OK, then I can guess what change(s) fixed it :)
20:09 tobs (yes, 2017.12 works here too)
20:24 dct joined #perl6
20:27 El_Che https://github.com/nxadm/rakudo-pkg/releases/tag/v2017.12
20:28 El_Che 2017.12 packages released
20:30 moritz El_Che++
20:30 Zoffix joined #perl6
20:30 Zoffix m: &postcircumfix:<[ ]>()
20:30 camelia rakudo-moar d30e5b1e3: OUTPUT: «WARNINGS for <tmp>:␤Useless use of constant value [ ] in sink context (lines 1, 1)␤Cannot resolve caller postcircumfix:<[ ]>(...); none of these signatures match:␤    (\SELF, Any:U $type, |c is raw)␤    (\SELF, int $pos)␤    (\SELF, int $pos…»
20:30 Zoffix m: &postcircumfix:<[ ]>(1, 0)
20:30 camelia rakudo-moar d30e5b1e3: OUTPUT: «WARNINGS for <tmp>:␤Useless use of constant value [ ] in sink context (lines 1, 1)␤»
20:31 Zoffix I'm debugging that warning.... Does this bit of QAST look like it should be there? https://gist.github.com/zoffixznet/549227cb7720ed2237369e33812dcac2#file-gistfile1-txt-L53-L57
20:31 Zoffix Nothing is there for `infix:<+>` and I tried removing that bit, but now the code doesn't find the right routine name. Wondering if that bit is supposed to be there of if I'm removing it too soon
20:33 comborico1611 joined #perl6
20:33 moritz m: &circumfix:<[ ]>(1, 0)
20:33 camelia rakudo-moar d30e5b1e3: OUTPUT: «WARNINGS for <tmp>:␤Useless use of constant value [ ] in sink context (lines 1, 1)␤Cannot resolve caller circumfix:<[ ]>(Int, Int); none of these signatures match:␤    ()␤    (Iterable:D \iterable)␤    (Mu \x)␤  in block <unit> at <tmp> li…»
20:33 moritz Zoffix: ^^ do you mean that code?
20:34 moritz 'cause I only found a circumfix, not a postcircumfix, in that QAST tree
20:34 moritz or is that the point?
20:34 comborico1611 Looking for an emacs tip.  CHARACTER-HERE CURSOR-HERE.   How do I drop character-here to a new line and preserve its  indentation?
20:34 Zoffix moritz: yeah, that code, with &circumfix
20:34 comborico1611 and preserve its*
20:35 Zoffix moritz: no, the point is what appears two be two Stmts; one empty and one is just a `call &infix:<,>`, which I believe is causing the warning. They don't seem to be used for anything, are they?
20:36 moritz Zoffix: I wonder if the two elements of the infix:<,> call correspond to the [ and the ] from the routine name
20:36 Zoffix moritz: yeah. And it's made here: https://github.com/rakudo/rakudo/blob/master/src/Perl6/Actions.nqp#L2532
20:37 Zoffix Well, s/yeah/I think so/;
20:38 * Zoffix recompiles and dumps the values
20:43 Zoffix damn, forgot .ast call; /me does recompiles again
20:45 awwaiid joined #perl6
20:47 Zoffix moritz: yeah, it's the circumfix: https://gist.github.com/zoffixznet/c4b90700bb43d660992f99bdfeb5336a
20:47 Zoffix the [ and ] chars for it
20:48 Zoffix My next best guess is something rips out ASTs for the colonpair with WVal(Str) for `infix:<+>`, but it forgets to handle the more complex colonpair for circimfix. Just need to find that rip-out bity
20:48 Zoffix s/y$//
20:49 * Zoffix relocates but will read replies, if any
20:53 pilne joined #perl6
20:54 timotimo DrForr: you may want to delete that comment on your blog, the one that advertises a lot of liposuction service related addresses?
20:54 timotimo actually, every one of those links points at the same url
20:57 itaipu joined #perl6
20:59 evalable6 joined #perl6
21:03 * masak .oO( those ads suck )
21:03 Hotkeys joined #perl6
21:05 dct joined #perl6
21:12 kerframil joined #perl6
21:15 rindolf joined #perl6
21:22 bwisti joined #perl6
21:24 itaipu joined #perl6
21:45 dct joined #perl6
21:55 itaipu joined #perl6
21:58 cdg joined #perl6
22:00 timotimo oooooh
22:10 japanoise joined #perl6
22:12 brrt joined #perl6
22:12 syntaxman joined #perl6
22:19 espadrine_ joined #perl6
22:32 releasable6 joined #perl6
22:32 timotimo hmm. turning a for @plan { } with "when" statements inside into a while @plan with a $_ = @plan.shift in front makes when target the block outside of that
22:32 statisfiable6 joined #perl6
22:32 timotimo not surprising, but annoying in this case
22:32 reportable6 joined #perl6
22:48 buggable New CPAN upload: List-Util-0.0.2.tar.gz by ELIZABETH https://cpan.metacpan.org/authors/id/E/EL/ELIZABETH/Perl6/List-Util-0.0.2.tar.gz
22:49 * Zoffix is disappointed Perl 5's Util vs Utils confusion made it into Perl 6
22:50 Zoffix huh...
22:50 Zoffix We have both List::Util and List::Utils? :S
22:52 * Zoffix assumes the singular is the fruit of Project Camelia
22:53 Zoffix left #perl6
22:55 lizmat Zoffix: List::Util is a more or less straight port of Perl 5's List::Util
22:55 lizmat colomon's List::Utils is a nice collection, but has no bearing on the Perl 5 version
22:56 * lizmat goes to bed: enough porting for today
22:58 buggable New CPAN upload: Sub-Name-0.0.4.tar.gz by ELIZABETH https://cpan.metacpan.org/authors/id/E/EL/ELIZABETH/Perl6/Sub-Name-0.0.4.tar.gz
23:15 cdg joined #perl6
23:22 daxim joined #perl6
23:27 cdg joined #perl6
23:53 timotimo m: my $foo; my $p1 = a => $foo; my $p2 = a => $foo => 1; $foo = 99; say $p1; say $p2;
23:53 timotimo something wrong with camelia?
23:53 timotimo c: HEAD my $foo; my $p1 = a => $foo; my $p2 = a => $foo => 1; $foo = 99; say $p1; say $p2;
23:53 timotimo evalable6: say "hi"
23:53 timotimo what's happening
23:53 camelia rakudo-moar 0be9d5520: OUTPUT: «a => 99␤a => (Any) => 1␤»
23:53 committable6 timotimo, ¦HEAD(0be9d55): «a => 99␤a => (Any) => 1␤»
23:53 evalable6 timotimo, rakudo-moar 0be9d5520: OUTPUT: «hi␤»
23:53 timotimo OK
23:53 timotimo so, is this by design?

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

Perl 6 | Reference Documentation | Rakudo