»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
Geth doc/master: 7 commits pushed by (Will "Coke" Coleda)++ 00:09
[Coke] make xtest now also checks that the type-graph.txt file matches what's in rakudo. 00:10
MasterDuke [Coke]++. gonna convert htmlify.p6 to hyper/race now they're working? 01:06
Geth mu: albastev++ created pull request #26:
Add to advent schedule
06:10
wander m: my $formatted-text = "Fourscore and seven years ago...".indent(8); say $formatted-text; 08:00
camelia Fourscore and seven years ago...
Geth mu: 4a24cb5e81 | albastev++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Add to advent schedule

  "Tackling a Big Grammar in Perl 6" would be a blog post about how Perl 6 allowed me to successfully build and test a modular Modelica Grammar.
08:11
mu: bd8945164d | lizmat++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Merge pull request #26 from albastev/master

Add to advent schedule
wander how does adverb work on pod6? 08:15
some like `=for code :allow<B L> :preamble<my $formatted-text;>'
wander what's the different between such a code block and just indent the code 08:16
and is `:preamble ' for passing tests? 08:17
DrForr {..} introduces a new scope. And though I'm not sure, I'm guessing :preamble has nothing to do with passing tests, it's just a comment to the effect that 'my $formatted-test;' appears before the start of some code. 08:19
wander m: my uint64 $a = 42; say $a.^name; # 08:33
camelia Int
lizmat m: my int64 $a = 42; dd $a.^mro 08:36
camelia (Int, Cool, Any, Mu)
lizmat a native is not really an object: if you treat it like an object, it mimics its HLL counterpart
m: my str $a = "foo"; dd $a.^mro
camelia (Str, Cool, Any, Mu)
wander no problem. just to get a rakudo-moar output
:P
lizmat m: say 42 08:37
camelia 42
lizmat :-)
AlexDaniel` uh. Just yesterday I was enjoying fallen leaves and stuff, and overnight we have like 20 cm of snow files.progarm.org/IMG_20171026_114002.jpg 08:47
the kids are sledging right in front of my house :) 08:48
ufobat wow 09:08
cool
where are you from AlexDaniel?
AlexDaniel` Estonia
tadzik nice :D
DrForr Hoo boy, we're gonna get it here in Prague soon then. 09:09
Geth doc: 45af77b021 | (Tom Browder)++ (committed using GitHub Web editor) | doc/Language/tables.pod6
fix spelling
09:10
synopsebot Link: doc.perl6.org/language/tables
wander DrForr, finally I find the explanation of :preamble at perl6/doc/EXAMPLES.md 09:13
it's about Writing Examples
DrForr Ah. 09:15
ufobat i wanted to go hicking with the kids this weekend, but the weatherforecast is not so good :/ 09:16
Geth doc: 46e6c137ee | (Tom Browder)++ (committed using GitHub Web editor) | doc/Language/tables.pod6
clarify restrictions vs bad practice
09:28
synopsebot Link: doc.perl6.org/language/tables
Geth doc: 91eb48a83d | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/objects.pod6
Unified format of code block

and delete redundant links
09:30
synopsebot Link: doc.perl6.org/language/objects
piojo When I initialize DBIish in a module, I'm getting "SORRY! This type (NQPMu) does not support associative operations" when I include that module in other files 09:50
DbConn.pm6 contains: use DBIish; DBIish.connect('Pg');
Importer.pm6 contains: use DbConn;
and I'm running: perl6 -I. -MImporter -e 'say 5'
Does this seem like a DBIish problem, or rakudo? 09:51
It seems like it's all about the depth of includes I have--if there is just one include, it works. But two levels (either the CLI version I pasted, or adding a .p6 script that includes Importer, so there are two levels of "using") 09:53
moritz does it work if you run DbConn.pm6 directly?
piojo moritz: yes 09:54
Also fine to run code in Include.pm6 directly
(It happens on both Linux and Windows, so I think it's not a personal problem) 09:56
piojo If you test, please be sure to delete ./.precomp. Otherwise it may run even when the test case will normally fail 09:57
piojo Err, I meant it's fine to run "Import.pm6" directly. Didn't mean to introduce another class 10:01
I'm rebooting, be back in a minute 10:03
piojo I'm also getting a "Missing serialize REPR function for REPR ConditionVariable (Lock::ConditionVariable)" when I come up with any workaround for the previous error 10:20
piojo Though if I cram it all into one script, it works fine 10:23
Geth ecosystem: 5b7cf09a7e | (Alexey Melezhik)++ (committed using GitHub Web editor) | META.list
Sparrowdo gets uploaded to CPAN
10:25
buggable New CPAN upload: Sparrowdo-0.0.35.tar.gz by MELEZHIK cpan.metacpan.org/authors/id/M/ME/....35.tar.gz 10:36
Geth mu: JJ++ created pull request #27:
Requesting a slot for the Advent Calendar
10:48
mu: 2f74350439 | (JJ Merelo)++ | misc/perl6advent-2017/schedule
Requesting a slot for the Advent Calendar

It can be moved up and down at will; I just greedily took the first spot available. It will be about how I tried to make scripts to take my Perl6 book to production easily and ended up working on the Perl 6 Text::Markdown module.
10:52
mu: d173b3ffa9 | (Zoffix Znet)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Merge pull request #27 from JJ/master

Requesting a slot for the Advent Calendar
piojo moritz: Can you tell whether DBIish only working in one file is a rakudo or DBIish bug? 11:05
Grimy The docs say “=== uses the WHICH method to obtain the object identity”, but what does this mean? Sometimes $a !== $b even though $a.WHICH eq $b.WHICH, so === must be doing something else. 11:29
Looking at rakudo’s source, it looks like there are many overloads of ===, but only infix:<===>(Any, Any) is documented. 11:31
AlexDaniel uh, !==? you mean !=== ? 11:36
Grimy Uh, yes, that’s what I meant 11:39
raschipi Can you give an example? 11:42
Grimy m: my ($a, $b) = (1e0, 1e0 + 4e-15); $a === $b, $a.WHICH eq $b.WHICH 11:44
camelia ( no output )
Grimy m: my ($a, $b) = (1e0, 1e0 + 4e-15); say $a === $b, $a.WHICH eq $b.WHICH
camelia FalseTrue
geekosaur Num is not using WHICH, it's using an overload to compare actual values. .WHICH is only needed for non-value types 11:47
geekosaur and then the vagaries of IEEE floating point will get in the way and confuse things (and may well be confusing the .WHICH) 11:48
m: dd (1e0+4e-15).WHICH
camelia ObjAt.new("Num|1")
geekosaur uh
Grimy So the issue is just that WHICH on Nums isn’t using enough precision? 11:49
geekosaur apparently
but again, for value types it doesn;t bother with .WHICH because it can compare the values
Grimy Well ideally both should give the same results
geekosaur there is no reason to build an ObjAt for a number, generally
Geth mu: ac6b925c8b | (Jonathan Stowe)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Update schedule

I have some vague stuff about messaging patterns sketched out somewhere :)
12:03
wander It said "Unlike Subroutines, additional named arguments will not produce compile time or runtime errors." 12:26
I wonder how additional named arguments produce compile time or runtime errors on Subroutines 12:27
lizmat m: use nqp; dd nqp::unbox_n(1e0); dd nqp::unbox_n(1e0 + 4e-15) # geekosaur: the source of the issue 12:30
camelia 1e0
1e0
lizmat m: use nqp; dd nqp::unbox_n(1e0); dd nqp::unbox_n(1e0 + 4e-14) # one order of magnitude larger and we're ok
camelia 1e0
1.00000000000004e0
raschipi lizmat: Is this floating point error? 12:32
lizmat I'm not sure: I'm just saying that the problem is not in rakudo, but lies deeper, probably in MoarVM 12:33
as the JVM backend does not have this issue, I'm told
j: say 42
camelia Error while reading '/home/camelia/p6eval-token': No such file or directory at /home/camelia/rakudo-j-inst/bin/eval-client.pl line 10.
lizmat alas, we can't test that easily :-( 12:34
[Coke] MasterDuke: (hyper/race) or something. :)
[Coke] (docs, preamble) github.com/perl6/doc/blob/master/E...#preambles 12:35
Geth doc: aa93bc2a41 | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/objects.pod6
unified format

and add note about default constructor
12:36
synopsebot Link: doc.perl6.org/language/objects
[Coke] DrForr: it's *exactly* about making the code compile without having to show all the work (which is sometimes helpful from a teaching standpoint) 12:39
(all the work has to be there, but the preamble isn't rendered, it's just used to make the code snippet compile.)
DrForr Oh, that. Hrm, that I could actually use. 12:41
wander m: my $x = 42; say "$x.^name"; say "$x.^name()"; 12:42
camelia 42.^name
Int
wander interesting.. 12:42
Geth mu: e5615cbf29 | (Brian Duggan)++ | misc/perl6advent-2017/schedule
Advent calendar: Dec 10

I propose to write an advent post involving the use of Rats/fractions for measurement.
[Coke] wander: if you have a question about what'll get interpolated, use {} 12:43
wander I see
[Coke] m: my $x = 42; say "{$x.^name}hi
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> 3my $x = 42; say "{$x.^name}hi7⏏5<EOL>
expecting any of:
[Coke] m: my $x = 42; say "{$x.^name}hi"
camelia Inthi
wander always I use {}, but how it actually works, I means without {} 12:44
[Coke] docs.perl6.org/language/quoting#In...lation:_qq 12:45
wander thank you 12:49
DrForr Specifically that sounds useful if I can get around to writing the pod => HTML + checker code. 12:54
Grimy m: dd all(1, 2) != 1, one(1, 2) != 1 12:55
camelia Bool::True
Bool::False
Grimy That’s the opposite of DWIM. Exactly one of (1, 2) is != 1.
ugexe Use a different operator 12:57
wander m: say 1 ~~ one(1, 2); 12:57
camelia True
wander say 1 ~~ all(1, 2) 12:58
evalable6 False
Grimy m: say 1 ~~ one(1, 2)
camelia True
Grimy m: say 1 !~ one(1, 2)
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of !~ to do negated pattern matching; in Perl 6 please use !~~
at <tmp>:1
------> 3say 1 !~ 7⏏5one(1, 2)
Grimy m: say 1 !~~ one(1, 2)
camelia False
Grimy Same issue
1 is !~~ exactly one of (1, 2), yet 1 !~~ one(1, 2) returns False. 12:59
raschipi As 1 ~~ one(1, 2) is true, the inverse of that is false
wander m: say one(1, 2) ~~ 1 13:00
camelia True
[Coke] m: say ! (all(1,2) == 1)
camelia True
[Coke] docs say this: 13:01
"Negated operators are special-cased when it comes to autothreading. $a !op $b is rewritten internally as !($a op $b). The outer negation collapses any junctions, so the return value always a plain Bool.
"
El_Che !release
!next
computer says no 13:02
[Coke] Not sure if != counts as a negated operator.
Grimy Yeah, it’s documented, but that doesn’t make it less counter-intuitive.
wander m: say ?all(map (* != 1), [1,2]); 13:04
camelia False
Grimy m: say [&&] ([1, 2] «!=» 1) 13:05
camelia False
wander it makes Junctions work strangely 13:15
that $a !op $b converted into !($a op $b) 13:16
raschipi what would you expect? 13:21
Grimy I expect “1 != any(1, 2)” to be the same as “any(1 != 1, 1 != 2)” 13:24
That’s how most operators work with junctions
raschipi But junctions collapse in boolean context 13:33
Grimy Well yeah. The problem is that it collapses to the negation of the value I’d expect. 13:34
El_Che when is the next releases planned (af the delay)? When it's ready or is there a target date? 13:41
raschipi m: say 1 == any(1, 2); say 1 != any(1, 2); say so any(True, False);
camelia any(True, False)
False
True
number8 Hello, everybody! I'm only starting with Perl 6, and really enjoying it, however I'm kinda confused about IO objects and how to handle them... For example, if I list a directory's contents with dir()... 13:43
number8 ...and want to rename a file (that may have spaces in it, for example), how do I treat the result, which is something like filename.jpg.IO? 13:44
can I treat it as if it were just the filename as a string, ignoring the .IO? 13:45
raschipi m: say '.'.IO.dir
camelia (".cpanm".IO ".local".IO ".npm".IO ".perlbrew".IO ".rcc".IO ".ssh".IO "Perlito".IO "evalbot".IO "log".IO "nqp-js".IO "p1".IO "p2".IO "perl5".IO "std".IO ".bash_history".IO ".bashrc".IO "mbox".IO ".lesshst".IO "evalbot.log".IO ".cpan".IO "dalek-queue".…
El_Che number8: "la la".IO.rename("lele") 13:46
jast and you can just directly use .rename on the elements you get from dir 13:47
number8 El_Che, thanks! So whenever I get a file or directory as a result with the .IO appended to it, I could just treat it as if it *didn't* have it as a suffix (i.e. as if it were a simple string)? 13:48
El_Che well, in practice yes. In reality you're getting an IO object you can use methods on 13:49
number8 Cool, thanks, jast!
raschipi No, you treat it as the IO object it is.
jast if you treated it as a string that would mean more effort. since it's an IO object you can use all the fancy IO methods on it
El_Che exactly
number8 Ok, I understand now, thanks you guys! 13:50
El_Che you're welcome
AlexDaniel El_Che: hello
El_Che: it was delaying because we found some bugs that had to be fixed. Right now it looks good so the release will happen soon 13:51
El_Che: fwiw you can ask releasable6, but it has a little bug and currently shows the wrong date :)
delayed* 13:52
El_Che Thx AlexDaniel
AlexDaniel El_Che: if you're holding your breath, then in 24 hours is a reasonable estimation, but that's just an estimation, not a promise :) 13:53
El_Che AlexDaniel: I'll keep lurking so I can start the build
jdv79 m: say "*a" ~~ /(.*\*.*?)/ 13:57
camelia 「*」
0 => 「*」
jdv79 shouldn't that match the a there? 13:58
jast non-greedy matching matches as little as possible
jdv79 say "*a" ~~ /\*.*?/ 13:59
evalable6 「*」
jast "as little as possible" means "nothing" here :)
if you anchor it to end of string it will match the 'a'
jdv79 i have other optional snippets before the anchor 14:01
jdv79 huh. been a while since i regexed it seems 14:01
jdv79 ah, ok. forgot the anchor. duh. 14:02
thanks
ryn1x_ Is Inline::Python compatible with windows? I can use it just fine on macOS and Ubuntu, but can not even install on windows... 14:07
number8 Oh guys, one last quick question: I'm really interested in getting some modules in, particularly Damian's Form, but haven't been able to use zef successfully at all, any thoughts? 14:16
raschipi what error are you getting? 14:17
put in a gist and give us the link 14:18
number8 I don't know if I just need to do some extra configuring, but I often get a message from zef as if it were searching in my local Rakudo directory for the module I'm trying to install, and then tells me it can't find it. 14:23
That's after I do 'zef install <module>'
I'm not on my main computer right now, so I can't get the exact error message :( 14:24
raschipi later then
number8 raschipi: Thanks. :) 14:25
timotimo it wouldn't surprise me if Form was already bitrotted beyond recognition, number8 14:41
timotimo okay, it got fixed up after the GLR at least, that was october 2015 14:42
oh, maybe that isn't what you're refering to; mathw made this one
but there is only one module named "Form" 14:43
timotimo okay, it does pass its test suite on an up-to-date rakudo 14:44
Geth doc: b5a893922c | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/objects.pod6
Update objects.pod6

Unify format and fix links
14:46
synopsebot Link: doc.perl6.org/language/objects
timotimo so false alarm
ryn1x_ Submitted my install problem and the "--debug" output here: github.com/niner/Inline-Python/issues/27 . I know not many peole are using windows, but unfortunately many of the lab computers at my work have to be windows to run some commercial software. 14:52
timotimo could you put ``` before and after the big pasted text? 14:57
oh 14:58
you're just missing the python2-dev stuff
timotimo aha, they don't offer python2-config on windows 15:01
but it looks like all you need is -L to the Python/libs folder and then -lpython27 or what version you have 15:02
ryn1x_: ^
ryn1x_ timotimo: I was trying to do something like that, but have not suceeded yet.. should I try to modify config.pl6, make file, or just do it all manually in the terminal to accomplish this? 15:10
timotimo i have no clue how Inline::Python builds its stuff; i'd look for the earliest place to change how it does stuff 15:11
timotimo maybe find where it fails to find python2-config and substitute the right values there 15:11
ryn1x_ ok. thanks for pointing me in the right direction.
timotimo good luck!
i'll be afk soon 15:12
sproctor Been playing about with Cro again for a REST API Aggregation layer. Really liking it. Now looking at a very unwritten slide deck and trying to work out what to write. 15:47
Hmmmm.
wander m: my %seen of Int = (0 but role :: { method Str() {'NULL'} }); say Int.new(%seen<not-there>); 15:56
camelia Odd number of elements found where hash initializer expected:
Only saw 1 element
in block <unit> at <tmp> line 1
wander m: my %seen of Int is default(0 but role :: { method Str() {'NULL'} }); say Int.new(%seen<not-there>); 15:57
camelia 0
wander is ^^ a new feature? 15:58
on my env it says "NULL"
This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementing Perl 6.c.
ugexe bisect: old=2017.07 my %seen of Int is default(0 but role :: { method Str() {'NULL'} }); say Int.new(%seen<not-there>); 16:00
bisectable6 ugexe, Bisecting by output (old=2017.07 new=2aaa32c) because on both starting points the exit code is 0
ugexe, bisect log: gist.github.com/2db30cea7a543be4b8...12b4bfb154
ugexe, (2017-09-19) github.com/rakudo/rakudo/commit/08...1a4f5186dd
wander k 16:01
Herby_ o/ 16:04
ilmari m: say Int.new(0 but role :: { method Str() {'NULL'} }) 16:05
camelia 0
ugexe don't create a new Int 16:09
m: my %seen of Int is default(0 but role :: { method Str() {"NULL"} }); say %seen<not-there>.Int;
camelia NULL
Geth doc: 9518b15910 | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/objects.pod6
add example about Pecking order

and unify format, fix typo
16:11
synopsebot Link: doc.perl6.org/language/objects
ryn1x_ I can get Inline::Python to compile on windows now by manually adding the -I -L and -l, but the tests fail. Anyone see anything obvious for me to try? github.com/niner/Inline-Python/iss...-339723621 16:42
number8 guys, what should be the "type" in a sub signature for an object that is a (Path)? 16:47
Xliff \o 16:47
Getting an error from DBDish:
===SORRY!=== Error while compiling /home/cbwood/projects/p6-webservice-eveo nline/data/site#sources/4AC2B2490C5004AC37B710EF9240DBA21B048857 (DBDish::m ysql::Native) 16:48
Can't use unknown trait 'is native' in a method declaration.
number8 is it sub my_sub(Path $filename) {...}?
Xliff Tried to update using zef, but zef says latest is already installed.
sena_kun sub my_sub($filename) {...} is fine too. 16:57
but you can use sub my_sub(IO::Path) {...}
number8, ^^
if this is what you want. 16:58
number8 sena_kun: Thanks! 17:00
Xliff m: enum RM <GET PUT HEAD DELETE>; RM::HEAD.say; 17:06
camelia HEAD
Xliff Uhh... Is this supposed to happen? 17:10
Unhandled exception: getexpayload needs a VMException, got P6opaque (X::AdHoc)
at SETTING::src/core/Exception.pm:395 (/home/cbwood/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:print_exception)
from SETTING::src/core/Exception.pm:452 (/home/cbwood/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:<anon>)
^^ Occurring in stage parse. 17:12
AlexDaniel Xliff: can you try again with a clean setup? 17:20
Xliff AlexDaniel: Define "clean setup" 17:28
Dost that mean completely blowing away all existing modules and starting over?
AlexDaniel Xliff: well, this is not supposed to happen, but at the same time I don't know what we can do 17:30
Xliff: but I was just wondering if you can't compile at all or if there's something else at play 17:31
Xliff So what precisely do I need to obtain a "clean setup">
rm -rf moar-nom/install/share ? 17:32
AlexDaniel ok, what commands are you using exactly? Or is that with rakudobrew?
Xliff rakudobrew
Xliff Please don't tell me "rm -rf ~/.rakudobrew" -- I'd cry. 17:32
AlexDaniel I think with rakudobrew you can do “rakudobrew nuke moar-nom” and that will nuke the whole thing
Xliff *sob*
AlexDaniel :( sorry 17:33
maybe someone else will have a better suggestion
Xliff And I just rakudobrew'd this morning. 17:34
[Coke] have you been building "moar-nom" ?
Xliff "rakudobrew build moar"
And now I need to reinstall all dependent modules. *sigh*
[Coke] yes, known issues with using rakudobrew to deploy a different version into the same rakudobrew build. 17:35
Xliff Well, I never "build moar-nom", just "moar"
[Coke] you could build moar-<sha>, or kill the current version and install a new one. You can tell zef before you do this to list all the installed modules and then use that list to re-install. 17:36
Xliff: I think that's functionally the same.
if you're not saying you want "this released version", I think you get "latest dev commit"
Xliff And "latest dev commit" was what I intended. 17:37
Fun. Stage parse in the build is over 90 seconds. 17:38
[Coke] gist.github.com/coke/c13e55d56c17f...0bf9dba0b4 - based on something from zoffix 17:38
ugexe i think people usually want moar-blead, which includes nqp/moar at latest dev commit as well 17:39
[Coke] that's what I run instead of 'rakudobrew build nom'. Some of that probably isn't necessary, but I've had almost no problems since I cut over to using that.
ugexe: I typically want the latest commit, not nqp=master and moar=master. but YMMV. 17:40
er, the latest sha in the rakudo config
[Coke] basically, *i* only bump when rakudo does. 17:40
Zoffix number8, FWIW, the reason you thought it's object "(Path)" is because you used `say` to dump it, which only shows the short-name. The full name is IO::Path and you can get it by using .^name method instead; e.g.: $obj.^name.say. You can also just use `IO` as the type for this type. It's shorter to write and includes IO::Special type that kinda-like-IO::Path 17:51
I don't use rakudobrew on anything but my home dev box. 17:52
huggable: sauce
huggable Zoffix, Install untested latest development version of Rakudo from source: github.com/zoffixznet/r#table-of-contents
Zoffix ^ that script does the job for me and is much faster to upgrade rakudo than with rakudobrew setup 'cause you don't need to re-install modules (or nuke anything)
Xliff: "etting an error from DBDish" Is that on latest rakudo? 17:54
Zoffix Grimy: for every DWIM there's a WAT. It's a bit unwanted that `1 != one <1 1 3>` is True but there's a much more common case: `1 != 1|3` which without tweaked semantics would always be True and be both rather confusing and useless 18:05
Zoffix m: sub foo {}; foo :meow 18:07
camelia Unexpected named argument 'meow' passed
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
Zoffix wander: ^ that's how they produce errors
in contrast, methods ignore nameds they don't recognize
wander got it 18:08
Zoffix m: class One { method meow (:$foo) { say "foo is $foo" } }; class Two is One { method meow { nextsame } }.new.meow: :foo' 18:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3ethod meow { nextsame } }.new.meow: :foo7⏏5'
expecting any of:
infix
infix stopper
postfix
statement end
Zoffix m: class One { method meow (:$foo) { say "foo is $foo" } }; class Two is One { method meow { nextsame } }.new.meow: :foo
camelia foo is True
Zoffix Ignored so you could do stuff like that ^ without having to care about extra args one class might be taking or having to shovel args around just to keep it from crashing from unknown args a subclass might be taking 18:11
piojo: did you sort out the DBIish issue? If not, what rakudo version are you on? 18:12
Xliff Zoffix / AlexDaniel: "clean install" fixed everything. 18:14
Thanks.
Zoffix great
El_Che Does someone know if the random failing test after a succesful build is fixed on the upcoming release? 18:16
Zoffix El_Che: which test?
El_Che let me check the logs
Zoffix m: '/tmp/z4211'.IO.mkdir.add('Foo.pm6').spurt: 'constant z = Lock.new.condition'; use lib </tmp/z4211>; use Foo 18:18
camelia ===SORRY!===
Missing serialize REPR function for REPR ConditionVariable (Lock::ConditionVariable)
El_Che Zoffix: travis-ci.org/nxadm/rakudo-pkg/job...7896#L1551
Zoffix piojo: ^ that's one of the errors. Don't know if it makes sense to serialize that variable or what.
Like chaging it from constant to `my` would fix it
m: '/tmp/z4211'.IO.mkdir.add('Foo.pm6').spurt: 'my \z = Lock.new.condition'; use lib </tmp/z4211>; use Foo 18:19
camelia ===SORRY!===
Missing serialize REPR function for REPR ConditionVariable (Lock::ConditionVariable)
Zoffix m: '/tmp/z4211'.IO.mkdir.add('Foo.pm6').spurt: 'my \z = Lock.new.condition'; use lib </tmp/z4211>; use Foo
camelia ===SORRY!===
Missing serialize REPR function for REPR ConditionVariable (Lock::ConditionVariable)
Zoffix ok then :P
Well, I think it'd fix it and just my eval sucks 18:20
El_Che: yeah, I think that's fixed. Haven't seen any floppers in make test recently 18:23
El_Che Zoffix: great to hear. I had someone send a PR, test failed so he thinked his PR is faulty :) 18:24
just rerun the test :)
Zoffix El_Che: looks like Oct 6 is the last time nativecall tests flopped: irclog.perlgeek.de/perl6-dev/searc...p;q=travis 18:25
El_Che I'll be happy to see the new release then :) 18:26
Zoffix Yeah, it's a good realease :) Lots of work
m: use nqp; nqp::getcomp("perl6").version 18:27
camelia This is Rakudo version 2017.09-522-g2aaa32c96 built on MoarVM version 2017.09.1-621-g27f91344c
implementing Perl 6.c.
Zoffix c: 2017.09~1 nqp::getcomp("perl6").version
committable6 Zoffix, ¦2017.09~1: «04===SORRY!04=== Error while compiling /tmp/SzxKFCeEvM␤Could not find nqp::getcomp, did you forget 'use nqp;' ?␤at /tmp/SzxKFCeEvM:1␤------> 03nqp::getcomp("perl6")08⏏04.version «exit code = 1»»
Zoffix c: 2017.09~1 use nqp; nqp::getcomp("perl6").version
committable6 Zoffix, ¦2017.09~1: «This is Rakudo version 2017.08-174-gb4ba33af4 built on MoarVM version 2017.09.1␤implementing Perl 6.c.»
Zoffix ~174 commits in past reelease; 522 commits this release :) Even more on MoarVM; 2 years of work in the for of new JIT backened were merged 18:28
AlexDaniel everyone++ 18:30
Herby_ \o
Zoffix \o
lowin I'm starting out with learning perl6, but many popular editors seem to be lacking perl6 support. Is there a recommended gui editor out there? Preferably with autocomplete support. 18:54
Zoffix huggable: atom ide
huggable Zoffix, github.com/perl6/Atom-as-a-Perl6-IDE
Zoffix lowin: unsure about autocompletion.
moritz vim! 18:55
dunno about autocompletion as well :-)
also: visual studio code with github.com/sergot/vscode-perl6
Aceeri Is there a way to get a better "backtrace/stacktrace" than this? pastebin.com/raw/cfErskyF 18:56
moritz Aceeri: this looks very much like a Perl 5 warning. Please try #perl 18:56
Aceeri Ah whoops, sorry
lowin Zoffix, moritz, Alright I'll give atom and vs code a try. Thank you. 18:57
AlexDaniel huggable: editors
huggable AlexDaniel, There is a list of editors and IDEs usable with perl6 here: perl6.org/whatever/
AlexDaniel lowin: ↑
Zoffix piojo: managed to repro your DBIish issue, but failing to golf it down for now. I get the "This type (NQPMu) does not support associative operations" when this condition is met: I call DBIish.connect with wrong args; then fix the error and try running the script again. And the mu error remains until you blow away the precomp 19:17
|2h try DBIish golf: github.com/zoffixznet/debug/tree/master/dbiish irclog.perlgeek.de/perl6/2017-10-26#i_15355892
ZofBot Zoffix, Will remind you on 2017-10-26T17:17:35.340511-04:00 about try DBIish golf: github.com/zoffixznet/debug/tree/master/dbiish irclog.perlgeek.de/perl6/2017-10-26#i_15355892 19:17
Zoffix &
moritz sounds like a rakudo bug 19:17
timotimo are you perchance trying to precompile a db connection?
moritz that won't work 19:18
AlexDaniel wasn't it already explained in github.com/perl6/DBIish/issues/106 ?
rindolf hi all 19:19
AlexDaniel o/
rindolf i noticed i had fewer difficulties porting a py euler program to perl 6 this time around
Herby_ \o 19:20
Thrush Hi! I've got some questions for Perl 6. Here's one: If I have a string (say, "Hello"), how do I separate it into a list of characters? 19:21
Juerd Thrush: "Hello".comb
Herby_ m: "Hello".comb
camelia ( no output )
Herby_ m: say "Hello".comb
camelia (H e l l o)
Thrush Excellent! Thank you!
m: say 'Hello, World!'.comb 19:22
camelia (H e l l o , W o r l d !)
Juerd Thrush: For inspiration: docs.perl6.org/type/Str
Thrush Here's another question: If I have an object/class (like "Hello"), is there a way I can list all of its methods? (Kind of like "Hello".methods.sort in Ruby.) 19:22
Herby_ m: "abcdefghijk".comb(3).perl 19:23
camelia ( no output )
Herby_ m: say "abcdefghijk".comb(3).perl
camelia ("abc", "def", "ghi", "jk").Seq
bdmatatu m: say "Hello".^methods 19:24
camelia (BUILD Capture Int Num chomp starts-with ends-with substr-eq contains indices index rindex pred succ comb match subst-mutate subst ords lines parse-base parse-names samecase samemark samespace word-by-word trim-leading trim-trailing trim words encode …
Thrush Nice! Thank you! .^methods works great!
El_Che I hope to make it easier to download the latest rakudo release by using github pages, next to the releases tab, eg. : nxadm.github.io/rakudo-pkg/latest-...arch=amd64
Juerd Thrush: Getting a list of methods is mostly useful when you're learning the language. And I think the documentation is a better starting point than a bare list :)
Thrush Okay, another question: Is there some sort of in-interpreter help system that I can get documentation at my fingertips? Like help(String.comb) -- similar to what I can do in Python. 19:26
El_Che and the checksum as well: nxadm.github.io/rakudo-pkg/latest-...arch=amd64
Juerd Thrush: No. But there's doc.perl6.org/ 19:27
AlexDaniel m: say Str.WHY 19:28
camelia No documentation available for type 'Str'.
Perhaps it can be found at docs.perl6.org/type/Str
»
Juerd Thrush: Please reply in the channel instead of privately :) 19:29
Also, you're welcome :)
Thrush Another question: I learned that I can do: my @a = lazy 1 .. 10; to create a lazy list. But once I do that, it's always hidden from me until I traverse it. (That is, when I type "@a" I see "[...]". My question is: Can I "un-lazify" @a so that it shows the numbers from 1 to 10? Sort of like this in Python: a = list(a) 19:30
Oh, sorry about replying privately. I thought you were talking to me in private, so I thought I was replying in kind. 19:31
Juerd Thrush: Nah, I'm just beginning lines with your name :)
AlexDaniel m: my @a = lazy 1 .. 10; say eager @a
camelia [1 2 3 4 5 6 7 8 9 10]
AlexDaniel Thrush: maybe you want “eager”
Juerd Note that either @a.eager or eager @a will work 19:32
Or @a.eager() or eager(@a) if you like parentheses
Thrush That's great, AlexDaniel and Juerd. That answers my question perfectly.
AlexDaniel Thrush: also, if that's just for debugging, maybe dd can give you better results 19:33
m: my @a = lazy 1 .. 10; dd @a
camelia Array @a = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10... lazy list)
Thrush I've been searching for a while for those answers, and I couldn't find it anywhere, not even on StackOverflow.
AlexDaniel Thrush: if there are any specific pages on docs.perl6.org/ where you expected this information, we can improve the docs 19:34
Thrush What's "dd", and where can I read about it?
"dd" is for debugging, I assume.
AlexDaniel Thrush: docs.perl6.org/programs/01-debuggi...unction_dd
Herby_ are there any good examples or libraries that I can look at for functional programming in perl 6? 19:41
Thrush Okay, another question: Is there native support to have a Perl6 program to detect a keyboard press without having to press ENTER? 19:43
Thrush I searched on modules.perl6.org/ for "keypress", but I couldn't find anything. Is there any way I can read a keypress (without hitting ENTER) using Perl 6? 19:47
Thrush As for docs.perl6.org , I wouldn't mind seeing mention of "eager" on the "lazy" page at docs.perl6.org/routine/lazy . Even if it's just a footnote like 'See also "eager".' 19:50
Thrush And for that matter, it would be good if the "eager" page ( docs.perl6.org/routine/eager ) had a link to "lazy". Just by reading the "eager" page, I would not make the connection that "eager" 'undoes' "lazy". 19:51
In Perl 6, are there functions/methods similar to Perl5's ucfirst() and lcfirst() ? All I see is tclc(), which is nice, but not exactly like ucfirst() and lcfirst() . 19:54
AlexDaniel m: say ‘hello’.tc 19:57
camelia Hello
thundergnat Thrush: re read from keyboard without enter, Term::termios may do what you need. See rosettacode.org/wiki/2048#Perl_6 for an example. 19:58
Thrush If I create a function that uses gather/take, I notice that the returned list won't be lazy unless it is called (by the caller code) with the lazy keyword. My question is: Is there any way to force the return value to be a lazy list, even if the caller does not use the "lazy" keyword? 19:58
Thrush Thanks, thundergnat. According the Rosettacode page, it's only going to work on POSIX terminals. Is there a way I can do it under Windows platforms as well? 20:00
jnthn Thrush: Can just make it lazy in the sub too
lazy gather { ... } 20:01
Thrush jnthn: Huh... It never occurred to me to do that. Thanks! 20:05
What's the best way to make a deep copy of something? Like, say, a list of lists of lists. 20:07
How can I see the type/class of an object? I'm looking for something like: "hello".class() or (5).type() 20:11
sena_kun m: say 'boom'.^name
camelia Str 20:12
sena_kun m: say 1.^name
camelia Int
sena_kun Thrush, ^
Herby_ whats a good Perl 6 way to count how many times the word "Sam" appears in $string? 20:17
a functional way
Thrush sena_kun: Thanks! 'hello'.^name works great. I notice that there are a lot of methods that begin with "^", but they don't show up when I type "Hello".^methods . Is there any way for me to see them?
Herby_: Will this do? 'Hello, mellow fellow'.comb('llo').elems # returns 3 20:19
m: 'Hello, mellow fellow'.comb('llo').elems
camelia ( no output )
Herby_ m: say "This is a Sam string, count the Sam".comb('Sam').elems 20:20
camelia 2
Herby_ that works. thanks!
Thrush m: 'Hello, mellow fellow'.comb('llo').elems.say
camelia 3
sena_kun Thrush, well, these methods are related to meta-object protocol, so I am not the best person to ask, but you can refer to docs.perl6.org/language/mop.html for general knowledge. As for methods, you can refer to docs.perl6.org/type/Metamodel::ClassHOW 20:21
Thrush Thanks, sena_kun
sena_kun about showing on on tab completion, if you asked about it, it probably wants(or not) an issue.
s/on on/it on/ 20:22
jnthn Thrush: $obj.^foo is actually $obj.HOW.foo($obj) - that is, shorthand for doing a call on the meta-object. So the methods you call with .^ are not on the object itself, but on the meta-object 20:24
Geth doc: 7ojo++ created pull request #1633:
Added Dockerfile and instructions to CONTRIBUTING.md
20:37
El_Che in bash, there is a -o pipefail option. Does the perl 6 shell function have something similar? (pipefail: error exit status of command before a pipe not overwriiten by later success) 20:38
(workaround would be bash -c ... 20:39
Geth doc/master: 5 commits pushed by (Jarkko Haapalainen)++ 20:49
Geth mu: 59567e2d49 | (Zoffix Znet)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Change post I'm gonna write

Thought about it and don't think I'd write anything that's actually interesting to read for the original article idea.
21:14
Thrush Question: How can I type the "∈" character (in: say so 'bar' ∈ @a;) on a keyboard that doesn't have that character? I tried "say so 'bar' elem @a;" but that's giving me an error. 21:18
Thrush m: say so 'bar' ∈ @a; 21:21
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@a' is not declared
at <tmp>:1
------> 3say so 'bar' ∈ 7⏏5@a;
geekosaur m: my @a = <a b c d>; say so 'c' (elem) @a
camelia True
geekosaur the parens are part of the operator name 21:21
Thrush m: @a = <foo bar>; say so 'bar' ∈ @a;
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@a' is not declared
at <tmp>:1
------> 3<BOL>7⏏5@a = <foo bar>; say so 'bar' ∈ @a;
geekosaur how you'd type in the Unicode one depends on OS (and on Linux may depend on your windowing/desktop environment) 21:23
docs.perl6.org/language/unicode_entry
Thrush The page docs.perl6.org/language/unicode_entry says that the ascii equivalent of "∈" is "elem", but I substitute "elem" and I see it doesn't work. 21:25
geekosaur it says the equivalent is (elem) 21:25
the parens are *part of the name*
Thrush Oh! I gotta use the parentheses!
geekosaur (in general perl 6 uses operators wrappedin parens for 'set-like' operators)
I even showed it earlier 21:26
[26 21:21:26] <geekosaur> m: my @a = <a b c d>; say so 'c' (elem) @a
Thrush I'm surprised (and embarrassed) that I didn't realize that they (the parentheses) were needed (for the ∈ operator). Wow! (Thanks for your help, geekosaur!) 21:27
geekosaur it could stand being made more obvious 21:27
but I'm not sure how you;d do that; perl 6's flexibility means it allows thinngs like that, but unles syou already know how perl 6 'works' you are likely to miss the point 21:28
especially if you;re coming to it from a lnaguage like Haskell where () around an operator means you re talking about it as a function, or etc.
maybe a column for a short example 21:29
Thrush Well, there are examples that use the '∈' operator. It wouldn't hurt to have the exact same example by each one, with the only difference being that (elem) is used. 21:30
[Coke] in general, we don't want to list every way to do it on every example. 21:31
AlexDaniel any ideas for the next squashathon? 21:32
AlexDaniel no repo was chosen yet 21:33
AlexDaniel squashable6: next 21:33
squashable6 AlexDaniel, Next SQUASHathon in 7 days and ≈12 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
Thrush Is there a way to force a string to an int? Like maybe "123".int()
AlexDaniel m: say "123".Int
camelia 123
Thrush Also, is there a way to test a string to see if it looks like an int or a float?
[Coke] m: say +"123"
camelia 123
[Coke] m: say (+"123").^name 21:34
camelia Int
AlexDaniel [Coke]: that's not guaranteed to be an Int tho
geekosaur m: say ?"123a".Int 21:34
camelia False
[Coke] m: +"borf"
camelia WARNINGS for <tmp>:
Useless use of "+" in expression "+\"borf\"" in sink context (line 1)
Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5borf' (indicated by ⏏)
in block <unit> at <tmp> line 1…
geekosaur m: say ?"123".Int
camelia True
[Coke] AlexDaniel: no, but there's what he's asking and what he needs. Yes, + gives you a numeric value back, not necessarily an Int. 21:35
AlexDaniel :)
Thrush m: say ?"123.4".Int
camelia True
[Coke] s/he/they/ oops
the ? is checking if the numeric value is true
m: say ?"0".Int 21:36
camelia False
geekosaur hm, point, it goes further than just translating the Failure
Thrush m: ?"0.0".Int()
camelia WARNINGS for <tmp>:
Useless use of "?" in expression "?\"0.0\".Int()" in sink context (line 1)
AlexDaniel m: .say with "0".Int
camelia 0
Thrush m: say ?"0.0".Int()
camelia False
AlexDaniel m: .say with "abc".Int
camelia ( no output )
Thrush "abc".Int throws an exception, I think. Is there a way I can have it just return Nil? 21:40
AlexDaniel m: say try "abc".Int
camelia Nil
Thrush I know in Ruby I can say: n = Integer('4') rescue nil 21:41
Okay, 'try "abc".Int' seems to work. But it also works for 'try "4.75".Int' (which evaluates to 4). Is there anyway I can detect that '4.75' is not an Int? 21:42
AlexDaniel m: say try +"abc" 21:43
camelia Nil
AlexDaniel m: my $x = try +"4.75"; say $x.WHAT
camelia (Rat)
AlexDaniel m: my $x = try +"4.75"; say $x ~~ Int 21:43
camelia False
AlexDaniel m: my $x = try +"4.0"; say $x ~~ Int
camelia False
AlexDaniel m: my $x = try +"4"; say $x ~~ Int
camelia True
Thrush That works, AlexDaniel. Thanks. 21:46
Thrush m: 'hello'.say ; 'hello'.put # What's the difference between .put() and .say() ? 21:55
camelia hello
hello
geekosaur .put invokes .Str, .say invokes .gist 21:56
Thrush Thanks, geekosaur.
Thrush I like the "once" block (as documented in docs.perl6.org/language/control#once ). Is there a convenient way to do the opposite, as in do something everytime EXCEPT for the first time? 21:59
ugexe m: sub foo { if $++ { say 42 } }; foo(); foo(); foo() 22:00
camelia 42
42
Geth doc: db2e07bfb7 | (Jarkko Haapalainen)++ | doc/Type/Proc/Async.pod6
Added example on piping with Proc::Async (refs #1580)

Note that methods .bind-stdin, .bind-stdout and .bind-stderr still needs documentation.
synopsebot Link: doc.perl6.org/type/Proc/Async
ugexe m: sub foo { if (state $foo += 1) > 1 { say 42 } }; foo(); foo(); foo(); # expanded to show you what its doing 22:02
camelia 42
42
Thrush I don't think a state variable is what I'm looking for. I'm looking for something more like an else-part of a once-statement. 22:05
geekosaur 'once is actually a bit hacky and has enough gotchas that it's often not what you want; state variables are more likely to give you the expected behavior 22:06
geekosaur if $++ { #`{ first time } } else { #`{ other times } } 22:07
Thrush Sure, but I want them to reset the next time I call the code they're in. 22:08
ugexe its a state var, you can control that with whatever level of closure clone
Thrush I want to do something like this: for 1 .. 5 { my $sep = ' '; once {$sep=''}; print $sep; .print }; say ''
m: for 1 .. 5 { my $sep = ' '; once {$sep=''}; print $sep; .print }; say '' 22:09
camelia 1 2 3 4 5
ugexe well for a loop i would use FIRST to do that
Thrush So many coders do it like this instead: for 1 .. 5 { .print; print ' ' }; say '' 22:10
m: for 1 .. 5 { .print; print ' ' }; say ''
camelia 1 2 3 4 5
Thrush Note the space after the 5.
AlexDaniel why not .join ?
ugexe m: for 1..5 { KEEP " ".print; .print; } 22:11
camelia 12345
ugexe hm
Thrush No .join, because it's in a loop that's reporting info by printing.
AlexDaniel I see 22:12
ugexe i expected .print; to fire the KEEP
AlexDaniel m: for 1 .. 5 { print ' ' if $++; .print }; 22:13
camelia 1 2 3 4 5
ugexe m: for 1..5 { KEEP " ".print; .print; 0; }
camelia WARNINGS for <tmp>:
1 2 3 4 5 Useless use of constant integer 0 in sink context (line 1)
Thrush Basically, I want something like: for 1 .. 5 { not_the_first_time {print ' '}; .print }; say ''
Thrush Where can I read about FIRST ? 22:15
AlexDaniel docs.perl6.org/language/phasers
Thrush Ah! Found it here: docs.perl6.org/language/phasers#phasers_FIRST 22:16
ugexe m: sub foo { for 1..5 { if $++ { say $_ } } }; foo(); foo(); foo(); # $++ works like you want
camelia 2
3
4
5
2
3
4
5
2
3
4
5
Thrush ugexe: Apparently you're right. But if $ is a state variable, shouldn't we have to decrement it (back to 0) for it to work the next time? 22:19
ugexe its state is per closure clone 22:20
Thrush That is, shouldn't $ keep its state across calls to foo() ?
I guess I don't know what a closure clone is. 22:21
ugexe its a state variable of for { }, not foo { } essentially
Thrush Well, thanks. It appears to work for what I need: for 1 .. 5 { print ' ' if $++; .print }; say '' 22:27
m: for 1 .. 5 { print ' ' if $++; .print }; say ''
camelia 1 2 3 4 5
Thrush When I do "[].^methods", I'd like to see the methods in sorted order. But this doesn't work: say [].^methods.sort 22:30
m: say [].^methods.sort
camelia Method object coerced to string (please use .gist or .perl to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (please use .gist or .perl to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (…
MasterDuke m: say [].^methods.sort(*.name) 22:31
camelia (ACCEPTS Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new BIND-POS BIND-POS BUILDALL BUILDALL Method+{is-nodal}.new Method+{is-nodal}.new Bool CALL-ME Capture Method+{is-nodal}.new Method+{is-nodal}.new FLATTENAB…
AlexDaniel m: say [].^methods.sort(*.name.fc) 22:32
camelia (ACCEPTS Method+{is-nodal}.new Method+{is-nodal}.new append Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-nodal}.new BIND-POS BIND-POS Bool BUILDALL BUILDALL CALL-ME Capture cl…
AlexDaniel there's a ticket for that actually 22:33
RT#132290
synopsebot RT#132290 [new]: rt.perl.org/Ticket/Display.html?id=132290 [LTA] .gist of a Method does not always show the its .name (.say for <a b c>.^methods)
jnthn m: say [].^methods.sort(*.name.fc).map(*.name) 22:34
camelia (ACCEPTS antipairs append append Array ASSIGN-POS AT-POS AT-POS Bag BagHash BIND-POS BIND-POS Bool BUILDALL BUILDALL CALL-ME Capture clone combinations default DELETE-POS dynamic eager elems end EXISTS-POS flat flat FLATTENABLE_HASH FLATTENABLE_LIST F…
Zoffix There should be anotehr ticket for it too. I remember debugging this 22:49
Thrush Is there a Perl6 way to iterate through a list and apply some code to each element, in a non-map way? Kind of like this in Ruby: (1..5).each {|n| puts n}
I can do this: (1..5).map: {.say}
m: (1..5).map: {.say} 22:50
camelia 1
2
3
4
5
Thrush but it uses map() instead of each()
Zoffix m: .put for 1..5
jnthn Why do you need a non-map way?
camelia 1
2
3
4
5
Thrush It sort of does what I want, but I'd rather not map() it, if I can get away with just each()ing each element.
Doesn't map() construct a new Array/List? 22:51
jnthn Not in sink (void) context, no
Now I understand why you were asking though :)
AlexDaniel El_Che: :) 22:52
Zoffix Ah RT#132149
synopsebot RT#132149 [new]: rt.perl.org/Ticket/Display.html?id=132149 [BUG] Some Method objects use wrong .gist method
Thrush Thanks, jnthn.
Is there a way to grep() through a list, knowing each element's index in the list? Kind of like Ruby's each_with_index, or map.with_index 22:53
AlexDaniel m: say <a b c d>.grep(‘c’, :kv) 22:54
camelia (2 c)
AlexDaniel m: say <a b c d c z>.grep(‘c’, :kv)
camelia (2 c 4 c)
AlexDaniel or
m: say <a b c d c z>.grep(‘c’, :p)
camelia (2 => c 4 => c)
AlexDaniel or just :k also
m: say (for 1..5 { $_ * 100 }) 22:56
camelia (100 200 300 400 500)
Zoffix m: <a b c d>.kv.grep: { $^v eq "c" or next; say "Got $v at index $^i" }
camelia Got c at index 2
jnthn Or if you want the index inside of the map, then: 22:56
m: ('a'..'g').kv.map: -> $idx, $val { say "$val is at $idx" }
camelia a is at 0
b is at 1
c is at 2
d is at 3
e is at 4
f is at 5
g is at 6
Thrush Say I have a list of strings, and I want to .grep/.map them so that I return only the strings at even-numbered indeces. How would I do that? 22:59
I tried: say <a b c d>.kv.grep: -> $k,$v {$k %% 2} .map: {$_[1]}
m: say <a b c d>.kv.grep: -> $k,$v {$k %% 2} .map: {$_[1]}
camelia ()
Thrush but for some reason it's returning an empty list. 23:00
ugexe m: say <a b c d>.kv.grep(-> $k,$v {$k %% 2}).map: {$_}
camelia ((0 a) (2 c))
jnthn tbh, I'd just use the $++ %% 2 anon state-var trick for that 23:01
But to do it the .kv way would be something like .map: -> $, $v { $v } to discard the indexes 23:02
Thrush "say <a b c d>.kv.grep(-> $k,$v {$k %% 2}).map: {$_}" looks good, but I don't want the index, just the element.
jnthn May be neater to do .pairs.grep(*.key %% 2).map(*.value)
ugexe you can do $_[1] still, it wasn't working before because of the grep missing ( )
jnthn Sleep time for me. o/ 23:02
Thrush m: say <a b c d>.kv.grep(-> $k,$v {$k %% 2}).map: {$_[1]} 23:03
camelia (a c)
Thrush Okay, I think that worked. Apparently I had to use the () form for the grep (instead of the : form).
ugexe it fixes what .map gets called on 23:04
timotimo m: .say for <a b c d e f g>.rotor(1 => 1) 23:20
camelia (a)
(c)
(e)
(g)
timotimo Thrush: with : it'll put everything until the end of the line as the arguments to what you put the : in front of, so if you wanted to do something more with the result you'll either have to put () around the whole thing (so you can still use the : form) or use .method(foo) form instead 23:21
Geth evalbot: b74b19f122 | (Aleks-Daniel Jakimenko-Aleksejev)++ | 4 files
“nom” → “master” tweak

Removes mentions of “nom”. Basically, this was not needed because it is using the default branch anyway. But we will not need “nom” shortcut anymore so it can be named “master” instead.
This commit also removes two parrot scripts.
23:49