»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
Xliff ctilmes: LOL! Thinking about it. 00:16
ugexe m: print((($_ eq "e") and uc($_) or $_)) for split("", "Perl Weekly Challenge"); # polyglot for the beginner challenge, too 00:23
camelia PErl WEEkly ChallEngE
ugexe m: my $count; print((($_ eq "e" and $count++) and uc($_) or $_)) for split("", "Perl Weekly Challenge\n"); print($count) 00:37
camelia Perl WEEkly ChallEngE
5
ugexe m: my $count; print((($_ eq "e" and ++$count) and uc($_) or $_)) for split("", "Perl Weekly Challenge\n"); print($count)
camelia PErl WEEkly ChallEngE
5
timotimo m: $_ = "perl weekly challenge"; say +tr/e/E/ 00:40
camelia 5
timotimo m: $_ = "perl weekly challenge"; say +tr/e/E/; .say
camelia 5
pErl wEEkly challEngE
ugexe but mine is way faster 01:07
what if you had to run that 100000 times
and only had 2.5s
how would you scale this out? 01:10
timotimo i'll multithread it on my swarm of 128-core machines 01:13
isomorphismes_ Perl 6 seems like the right place to put an end to ^ meaning "BEGINNING" and $ meaning "END" because of the (a) widespread sanity of the community (b) p6 grammars (c) support for unicode 01:18
ugexe we doubled down on it and have ^^ and $$ too 01:18
isomorphismes_ if I make some commits to rakudo making stuff like www.fileformat.info/info/unicode/c...ndex.html, U+0004 (EOT), alias / synonymous for BEGIN and END, is that likely to be accepted? 01:19
ugexe: that's clearer imo
ugexe its not quite the same thing
isomorphismes_ ugexe: ^^ and $$ are clearer to read. But so would END and BEGIN be.
yeah, there are a variety of candidates in unicode-search.net/unicode-namesea...l?term=END
like "syriac end of paragraph" (sounds likea good one) 01:20
U+220e (\xe2 \x88 \x8e), end of proof, could work too
ugexe: dollars aren't quite the same as EOL, either ...
I mean, unless there's going to be a lot of people wanting to match the capital strings BEGIN and END for very common $ and ^ functionality, might as well alias those ascii strings too .... no? 01:21
ugexe BEGIN and END are already perl6 things
isomorphismes_ ah sorry 01:22
still learning the lang
ugexe m: END say 2; BEGIN say 1;
camelia 1
2
isomorphismes_ thank you ugexe
unicode-search.net/unicode-namesea...term=START has U+2402 = \xe2 \x90 \x82 = ␂ 01:24
I just mean, "stuff like this"
Would it be worth the commit? Or no rakudo members will want to take it in?
ugexe m: grammar MyGrammar { token XXX { ^ }; token ZZZ { $ }; token TOP { <XXX> foo <ZZZ> } }; say so MyGrammar.parse("fo"); say so MyGrammar.parse("foo"); 01:27
camelia False
True
ugexe docs.perl6.org/language/regexes#Su...of_anchors 01:29
if you want to propose something i would suggest coming up with something that can be applied and consistent across the other anchors (or most of them) 01:30
MasterDuke isomorphismes_: you might be able to do it as a slang, which you could publish as a module first
ugexe e.g. if ^ is "START UNICODE THING", then what is ^^?
figure that out for the other anchors, then come up with theoretical examples that demonstrate the added value to the user 01:31
making a module out of it is one way to do that 01:32
isomorphismes_ MasterDuke: thank you 01:40
ugexe: I was intending just to alias, not replace
see if there is any uptake besides myself 01:41
glad you guys use the .party TLD (tpm-regex.perl6.party) 01:43
Geth doc: 39b1b74399 | cfa++ | doc/Language/py-nutshell.pod6
Fix typo.
01:45
synopsebot Link: doc.perl6.org/language/py-nutshell
melezhik Hi! Has anyone experienced extremly slow zef install for one of their modules. I am stuck with performance issue - www.reddit.com/r/perl6/comments/b6...perl5_and/ 02:45
and really don't know what to do with that
sorry wrong link 02:46
that's the one - www.reddit.com/r/perl6/comments/b6...e_install/
Geth doc: ff25568778 | (JJ Merelo)++ | doc/Language/classtut.pod6
Expands explanation on `is rw` trait

With new examples, and a reference to `is rw` on the whole class. It was probably better where it is, in classtut, rather than in the typesystem, which didn't seem to have (at least now, 18 months after OP) a place for it. This closes #1572
07:03
synopsebot Link: doc.perl6.org/language/classtut
doc: 3ea709ac2f | (JJ Merelo)++ | doc/Language/phasers.pod6
Rephrases LAST explanation to clarify, closes #2701
synopsebot Link: doc.perl6.org/language/phasers
xinming For hyper method call operator, @array>>.meth(); Can I think it is almost the same as await @array.map: start { $_.meth() }; ?? 09:07
masak xinming: by spec it's parallel like that, yes. I don't know that Rakudo actually parallelizes it. 09:08
timotimo i'd probably expect it to be equivalent to @array.hyper.map(*.meth), in particular it'd probably batch many values together to one work unit 09:12
hanzi loop { my $x; say ++$x; } 09:14
is this supposed to produce (output) a constant value of $x of 1? 09:15
in the documentation i was not able to find any mention of how my causes initialization in each looping of a loop 09:16
moritz hanzi: yes 09:18
hanzi many thanks! 09:19
moritz hanzi: and you didn't find any documentation because it's not different for loops than for any other block
hanzi where can i find that info in the doc?
was not looking wrt loops, just in general, and did not find
looked in docs.perl6.org
and in perl6intro.com/ 09:20
moritz I'd expect something in docs.perl6.org/language/variables
moritz if not, please open an issue according to github.com/perl6/doc/blob/master/C...rting-bugs 09:21
hanzi ok, thanks, in any case, i think this is rather fundamental info that should be present in the introduction of the my declarator 09:23
masak hanzi: you're not wrong. 09:24
though, as moritz++ points out, it's less to do about loops and more about blocks and block entry
m: sub foo { my $x; say ++$x }; foo() for ^3 09:25
camelia 1
1
1
masak same deal ^
moritz the problem is that everybody has different expectations about what belong into an introduction
hanzi thanks, just to be clear, my example was not meant to focus on loops
was just an example, maybe not the best one
moritz some people are familiar with how lexical variables are initialized in most programming languages, and Perl 6 behaves consistently with that
masak part of the difficulty, I think, is that there's no good *word* for that thing in memory "behind" the lexical variable of which there's one per block entry/frame
El_Che moritz: btw, I saw your fundamentals book in in O'Reilly's safari
not the 2nd one
moritz others find the behavior so intuitive that they don't need an explanation 09:26
others want an explanation
moritz sure, you can add it, but there simply soooo many things that could be explained in an introduction 09:26
what I really want is some semi-interactive website that starts with something like: "Lexical variables are declared with `my`, like in `my $x` or `my $y = 42` 09:27
and then there's a small symbol that you click on, which expands to a more detailed explanation of how lexicals work
moritz I think sjn++ was working on a project for books that support something like this, though I don't know if it went anywhere 09:28
hanzi good info, thanks for the help 09:31
gks what would be the easiest way in perl 6 to download a binary file over HTTP and saving it to a file (with a given name)? 11:53
basically i want `curl someurl.com > myfile` 11:54
tbrowder ctilmes: your DB::SQLite module is excellent! thanks 11:54
tbrowder for an easy-to-use module that eases sqlite use immensely. 11:55
timotimo easier than using DBIish? 11:56
kawaii m: say so Nul; 12:00
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
Nul used at line 1. Did you mean 'Nil', 'Num'?
kawaii blah
m: say so Nil;
camelia False
kawaii $level = Nil, which is False, so why does this unless not work? www.irccloud.com/pastebin/y7ch9aCq/ 12:01
tbrowder timotimo: for me, yes. but i haven't tried DBlish in a while and Curt's examples scratched an itch. 12:05
lizmat m: my $a is default(42) = 666; say $a; $a = Nil; say $a 12:16
camelia 666
42
lizmat kawaii: ^^^
oops, should have looked at the paste 12:17
m: my $a = ~Nil; say "foo" if $a
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
lizmat kawaii: not sure :-( 12:19
kawaii bug, maybe?
lizmat m: my $a = ~Nil; say "foo" unless $a # seems to work in this case 12:20
camelia Use of Nil in string context
foo
in block <unit> at <tmp> line 1
lizmat kawaii: do you see that warning as well in your code ?
kawaii Yes, exactly as it says
so I'm certain $level = Nil
www.irccloud.com/pastebin/Opb7I2BD/ 12:21
lizmat no, $level is ""
kawaii lizmat: this code works fine
lizmat stringification of Nil is ""
kawaii ah
lizmat without stringification of Nil, it would be Any
m: my $a = Nil; dd $a
camelia Any $a = Any
kawaii understood :)
m: say so ""; 12:22
camelia False
kawaii even so, it should still work :(
lizmat yeah...
perhaps a "dd $level" before the unless to make doubly sure that $level contains what we think it should contain ? 12:23
perhaps it contains 1 for the number of elements ?
kawaii lizmat: `List $level = $("",)` 12:30
dd result ^
lizmat m: say "foo" if $("",) 12:31
camelia foo
lizmat so you got a 1 elem list with a "" in it
kawaii let me go look at the code we use to create $level...
lizmat :-) 12:32
kawaii so this block here handles which routine each detected command runs, and we create $args-str to populate other values based on this... www.irccloud.com/pastebin/rpYODJkQ/ 12:33
I'm going to refactor this anyway, to support a cleaner command syntax i.e. `!level (add|rm|list)` instead of hyphenated commands so probably not worth fixing right now :) 12:34
kawaii lizmat: wrapping $level in () fixes it for now :) 12:38
lizmat yeah, that it would
kawaii thanks for your help debugging! 12:39
lizmat yw :-)
gfldex lolibloggedalittle: gfldex.wordpress.com/2019/03/29/co...-whenever/ 13:07
sena_kun gfldex, "displays to much or to little" <- is it a pun? 13:09
gfldex sena_kun: would you believe me it I would say „yes“? :->
sena_kun gfldex, as a non-native folk, I'll do my best. ;) 13:10
timotimo gfldex: it look like there's no space between ".tap" and "on the parameter" 13:11
lizmat gfldex: also wheneveralways 13:12
gfldex: also s/paramter/parameter/ 13:13
gfldex the spaces are an wordpress editor artifact
I solved it by adding 3 spaces, move the cursor a little and then remove 2 13:14
lizmat gfldex: is that the new WP editor ?
gfldex yes
otherwise it's really nice 13:15
lizmat *phew* glad to be using the old one
gfldex you can inline `code` and start a code block with ```
lizmat for me, it worked actively against my P6W workflow
gfldex and lots other neat stuff
SmokeMachine gfldex: is your script using this? github.com/FCO/JSON-Stream 13:18
gfldex yes
SmokeMachine :)
gfldex: how was it? many problems? 13:19
gfldex the documentation is a bit sparce and it doesn't forward closed input streams
SmokeMachine gfldex: would you mind to open issues? 13:20
gfldex SmokeMachine: would not help, because it can't forward that the input Supply is closed without breaking other stuff. 13:21
SmokeMachine gfldex: sorry, I didn't get it... 13:23
gfldex SmokeMachine: you need something like github.com/gfldex/bin/blob/master/...at.p6#L138 to react to the closed input Supply. But then any script using the module trying to do the same got a problem. Also, 90% of all tests stopped working when I tried to fix it myself. 13:28
cpan-p6 New module released to CPAN! Acme::Cow (0.0.3) by 03ELIZABETH 13:59
woolfy I love all the puns on this channel. 14:01
While most puns make me feel numb, mathematics puns make me feel number.
gfldex woolfy: I agree. This is a puntastic channel! 14:07
El_Che don't be a pun in the ass 14:09
moritz you pundits :D 14:12
woolfy It was easy as pi 14:26
ctilmes tbrowder: ty
timotimo: For DBIish, SQLite is good because it actually works (DBIish is broken for Pg and MySQL) 14:27
timotimo: DB:* are nice because they maintain a cache of handles and you can perform DB actions from different threads without worrying about stepping on simultaneous database actions
AlexDaniel gks: there are a bunch of modules, I'm not even sure which one is best :) 14:44
gks: if you want it be as close to curl as possible, then there's Net::Curl and LibCurl… and my favorite: just doing `run <curl … …>` 14:45
gks: otherwise people nowadays prefer Cro, I think
gks AlexDaniel: ok! i'm doing a thing partly as a way of learning perl6, so just running curl as a shell command felt counterproductive. I can write bash scripts all day long, but i wanna learn perl 6 :) 14:47
i'll look into Cro!
jnthn Off the top of my head, `use Cro::HTTP::Client; my $resp = await Cro::HTTP::Client.get($url); spurt :bin $filename, await $resp.body-blob;` :) 14:49
pistacchio hi, yesterday I asked if it's ok to post here snippets of perl6 to have them reviewed for learning purposes and check if there are idioms that i missed or best practices that i ignored. is there a recommended platform to share perl6 files or a github gist would suffice? 14:50
lizmat github gist works for most people here :-) 14:51
pistacchio gist.github.com/pistacchio/9af8d01...971c135fbb 14:51
uzl Hello #perl6!
pistacchio @lizmat thanks. this is the link, if anyone would like to give me any tip
uzl How do I circumvert circular dependency? I've a class in its own pm6 file (Git::Repository.pm6), which uses some utility functions from another pm6 file (Utils.pm6). However, the Utils.pm6 file has a function (repo-create) that instantiate the class from the first file. I could place this function to the same compilation unit (I think!) as the class but I want to keep all the utility functions in a single file. 14:52
Any idea on how to approach this?
sprunge.us/p7Pajr 14:53
gks jnthn: thanks!
lizmat pistacchio: and the question is exactly? Just about the idioms used ?
pistacchio @lizmat yes. the code works of course, but i'd like to know if it uses idiomatic perl6 or if there is something i'm missing, like doing something in a more convoluted why while there are bits of the language that i don't know and that would turn out useful 14:55
it's just a way of learning the language, really
sjn wonders if it's possible to get a perl6 eval bot in another channel here on freenode 15:10
moritz sjn: it is 15:11
sjn looks at perl6/whateverable 15:18
AlexDaniel yeah, that is also possible :) 15:19
which channel are we talking about and how many bots do you want? :)
moritz sjn: I can also send camelia to another channel if you want
sjn moritz: that would be cool :) 15:21
uzl Is the `z` file tests enough to check if a directory is empty, meaning not even zero-sized files? Or should I rather `dir $path-to-dir` and then coerce to Int? 15:23
sjn p6: "BUTTERFLY".uniparse.say 15:31
camelia 🦋
sjn would have assumed a butterfly would be printed there
moritz sees a butterfly
sjn hm. missing font here, then 15:32
timotimo uzl: i'd expect a size based on the stat system call to always be the same for folders, or perhaps it depends on the filesystem in use 15:33
lucs moritz: What terminal do you use? (urxvt here, no butterfly) 15:35
uzl timotimo: The docs say "is dependent on the operating system". Do you think it's a safer bet then to list the files in the path and then coerce that to Int?
timotimo that will give you the number of files in it (excluding . and .. by default) 15:36
where an empty file will also show up
moritz lucs: the xfce terminal
lucs Thanks, I'll look it up.
uzl timotimo: I think I'll go with that then.
moritz lucs: but it's typically not a matter of the terminal, but whether UTF-8 is properly configured, and then it's a question of available fonts
uzl timotimo: BTW, do you mind looking at colabti.org/irclogger/irclogger_lo...3-29#l435? 15:37
lucs moritz: I'm not too handy with all that, so thanks for the tip :)
timotimo uzl: one way is always to use run-time module loading using "require", i think 15:38
if you need something that happens at compile time, though, that'll mean your "at run time" is actually during the compile time, and that'd be bad news
kawaii Is it normal for Perl 6 applications to be distributed with META6.json files too? To list their dependencies and such? 15:40
Or does that only apply to modules?
timotimo that makes them installable, and also a META6.json is required for it to "use" its own modules 15:41
and for modules to load each other
kawaii great thanks :)
timotimo unless you're into fiddling with paths manually and putting "use lib" in all your code
having scripts in a bin/ folder will get them installed to the system as launchers
uzl timotimo: I don't understand all the intricacies ;-); I'll have to read the docs again. BTW, do you mean loading the class module into the utility module? Or could it be either way? 15:42
timotimo it could probably work either way, you'll have to experiment, and tbh i haven't tried this yet either :S 15:43
BBL 15:44
uzl I'll have to experiment then. Thanks! 15:45
uzl timotimo: One last question. There must be several ways but what's the closest thing of asserting something in P6? Using the Test module? Just checking for definedness or truthness? 15:47
moritz Test modules works well for testing 15:49
there is no real assert statements, but a die "you are too old" if $age > 42; is quick to write
there are also PRE and POST phasers for routines 15:50
which you can use to check things at routine entry and exit
uzl moritz: I think a die statement will suffice here. I'm asking because I'm following along this Python implementation of a simple Git and the author uses assert. 15:52
sjn huh. a few minutes with camelia in another channel, and we've found a security issue :) 17:24
El_Che sjn: there were some know ones, but I forgot what exactly 17:45
vrurg What short term is best to use when referring to the language specification (.c, .d)? Revision? 17:57
moritz vrurg: version 18:25
or simply say v6d
vrurg moritz: But for the build process? Diwali is called 'language specification' 18:26
I mean, wouldn't we get teminology ambiguity somewhere?
moritz vrurg: we might have a misunderstanding here, because what you say confuses me 18:27
vrurg blogs.perl.org/users/zoffix_znet/20...lease.html – here it is called 'language specification' 18:28
But let's assume we get another compiler. It would implement the specification. Yet, they would have versions like: v1.1 of compiler implementing v6.d 18:29
This is why I wonder wouldn't it be more correct to call .c and .d not version but specifications? 18:30
The reason I'm asking is because I'm redoing Configure.pl and would like to stick to a consistent terminology to avoid future confusions. 18:31
moritz rakudo says "Rakudo version 2019.04 [...] implementing Perl 6.d." 18:38
nothing ambiguous about that, IMHO
vrurg BTW – yes. So, it implements a spec and this is what I'll use. Thanks! 18:39
TreyHarris Is there a unicode combining backspace? Or some other way to overprint two arbitrary glyphs on outputs that can support that without needing a single font glyph that matches? 19:31
(Context: I had a on-screen meter that I can show 9 out of 10 possible values via box characters, but the tenth doesn't exist; if I could print two of the others in the same space it would visually be the tenth) 19:32
moritz not that I'm aware of 19:34
the best you can try is to find combining characters that make up the right shape of what you want
timotimo TreyHarris: for that purpose i'll always just use reverse video 19:43
kybr commaide.com/download says "The latest Comma Community release is 2019.3.0.1." but the available downloads are 2019.3.0---i tried on Windows and macOS. can someone confirm? 19:57
timotimo sena_kun: -^
perhaps the in-program updater will get it for you 19:58
sena_kun kybr, well, 2019.3.1 was a fix for Windows. Others are still 2019.3.0, so that's correct.
Linux gives me 3.0, Windows gives me 3.1, all's nice. 19:59
there is indeed a bug that Linux version will say to you that 3.1 is ready... But you can just "Ignore this particular update".
kybr ok. well, i submitted a ticket. on macOS, the internal updater claims there is a new version. ah. ok. so the bug is on macOS, FYI. 20:00
ugexe sena_kun: any chance you can fix github.com/croservices/cro-openapi...n/issues/6 ? 20:21
patrickb o/ 20:55
patrickb Is there an easy way to iterate the chars of a Str? I currently use for `$str.split: '', :skip-empty -> $c {...}`, but I don't need to modify, just access. 20:57
lizmat m: say "foobar".comb 21:02
camelia (f o o b a r)
lizmat patrickb ^^^
m: say "foobar".comb(2) # if you want two at a time 21:03
camelia (fo ob ar)
patrickb lizmat: thanks! 21:07
TreyHarris timotimo: thanks, reverse-video works, and lets me make what I already had look more consistent by making half reverse video, half regular 21:11
sena_kun ugexe, I can't, but I certainly can ping jnthn. 21:58
ugexe oh right... thats even mentioned in the issue
jnthn Ah, that even looks like an easy thing to deal with... 22:01
sena_kun: Hm, the last commit there is a version bump; I'm guessing that a release with that simply never got shipped to CPAN? 22:04
sena_kun jnthn, yeah
jnthn, I'd bet on it, at least.
jnthn yeah, matches what I see 22:05
Sorry about that :(
timotimo have more CI for this :) 22:06
jnthn Uploaded now
timotimo: I think it's more CD that I need :) 22:07
timotimo true
CI is at best a half-measure i suppose
guifa hmmm 23:15
guifa p6: my @a = <a b c>; @a[0..1] = <x y>; say @a; 23:15
evalable6 [x y c]
guifa p6: my @b = <a b c>, <a b c>; @b[0..1;0] = <x y>; say @b;
evalable6 (exit code 1) Cannot modify an immutable Str (a)
in block <unit> at /tmp/qaEWnYj4gs line 1
guifa p6: my @c = <a b c>, <a b c>, <a b c>; @c[0..1][0] = <x y>; say @c; 23:16
evalable6 [(x y) (a b c) (a b c)]
stigo just fyi: #oslohackerspace was playing around with camelia and found out how to execute commands, I send the following command to it to shut it down to prevent anyone from actually causing any harm: qqx|chmod 0000 evalbot;kill `ps -o ppid= $*PID`| 23:19
guifa oh actually it’s even more simple (though frustrating) issue 23:20
p6: my @a = <a b>; @a[0] = ‘x’; say @a; 23:21
evalable6 [x b]
guifa my @b = <a b>, <a b>; @b[0;0] = ‘x’; say @b;
p6: my @b = <a b>, <a b>; @b[0;0] = ‘x’;
evalable6 (exit code 1) Cannot modify an immutable List ((a b))
in block <unit> at /tmp/3ChKcRnbux line 1
timotimo stigo: yeah, it just lets you do that
the other evalbots, too
guifa What am I missing for assignment in multidimensional arrays? 23:26
Juerd guifa: The difference between multidimensional arrays, and arrays of lists 23:35
Juerd m: my @b[2;2] = <a b>, <c d>; @b.perl.say; @b[1;0].say; 23:36
evalable6 Array.new(:shape(2, 2), ["a", "b"], ["c", "d"])
c
Juerd m: my @b = <a b>, <c d>; @b.perl.say; @b[1][0].say;
evalable6 [("a", "b"), ("c", "d")]
c
AlexDani` xD 23:46