🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
timotimo m: sub bake(*%p) { for %p { say "cooking $_.value() $_.key()s" } }; bake :10cookies, :5donuts, :3quiches 00:02
camelia cooking 5 donutss
cooking 10 cookiess
cooking 3 quichess
cpan-raku New module released to CPAN! Sparrow6 (0.0.21) by 03MELEZHIK 01:00
Xliff m: say "This is my PI: π.fmt('%1.12f')" 02:14
camelia This is my PI: π.fmt('%1.12f')
Xliff m: say "This is my PI: { π.fmt('%1.12f') }"
camelia This is my PI: 3.141592653590
Xliff m: my $PI := π; say "This is my PI: $PI.fmt('%1.12f')" 02:15
camelia This is my PI: 3.141592653590
Xliff my @a = <a b c d e>; say "@a f g"
evalable6 @a f g
Xliff my @$ = <a b c d e>; say "@a f g"
m: my @a = <a b c d e>; say "@a f g"
camelia @a f g 02:16
Xliff m: my @a = <a b c d e>; say "@a[] f g"
camelia a b c d e f g
Xliff m: my @a = <a b c d e>; say "@a[1, 2] f g" 02:17
camelia b c f g
Geth doc: 02c1164d5c | (Mike Swierczek)++ | doc/Language/control.pod6
Attempt to add 'case statements' to indexing

This is just for a search convenience if someone coming from a C-style language background searches for 'case' or
  'case statements' instead of 'switch'.
06:41
doc: 70d4583308 | (Mike Swierczek)++ | doc/Language/control.pod6
Update.
linkable6 Link: docs.raku.org/language/control
doc: 5b4787e111 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | doc/Language/control.pod6
Merge pull request #3448 from Michael-S/add_case_keyword_ref_to_given

Attempt to add 'case statements' to indexing
doc: 7f064c7cae | (Luis F. Uceta)++ | 2 files
Clarify description of reduce sub/method for Any and List

  * Also add a few examples
Refs: #3340
06:43
doc: 9ef5e5e452 | (Luis F. Uceta)++ | 2 files
Make changes as requested
linkable6 DOC#3340 [open]: github.com/Raku/doc/issues/3340 [RFE][docs] Confusing description of reduce sub/method
doc: 0af36d0f2b | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 2 files
Merge pull request #3447 from uzluisf/master

Clarify description of reduce sub/method for Any and List
soar .sort: * < * 07:50
the sorted result is by descending.
It's confusing to me...
moritz soar: note that sort usually take a three-way comparison operator like <=> or cmp 07:54
hobbs soar: sort expects a callable that acts like <=> or cmp (returning -1, 0, 1 for less/same/more)
moritz if you pass it a two-way comparison operator, it's bound to behave weirdly
hobbs I think that if you give it <, it will interpret < as "more", and >= as "same" 07:55
which will get you a backwards result and/or a broken one because you're lying and telling it "same" when actually "more" :)
soar umm.... let me think of 07:56
hobbs (I'm assuming that since it doesn't crash, it interprets True as 1, and 1 as Order::More, and False as 0, and 0 as Order::Same) 07:57
soar semantic, * < *, is not valid here 07:59
how shall we say sorting by descending 08:00
hobbs .sort: { $^b <=> $^a } would be one way 08:02
or sort then reverse (I'm not sure if the optimization that replaces that with a reverse-sense sort exists in raku) 08:03
MasterDuke soar: if it's numeric data, `-*` or `+*` 08:07
m: my @a = (^4).pick(*); say @a; say @a.sort(-*); say @a.sort(+*) 08:08
camelia [3 1 2 0]
(3 2 1 0)
(0 1 2 3)
hobbs yeah, that's reasonable :) 08:09
soar thank you guys! Now I get it.
MasterDuke also, in the `(-|+)*` case it will do a schwartzian transform for you if needed 08:14
m: my @a = ("0".."9").pick(*); say @a; my @b; my $s = now; @b = @a.sort(-*) for ^50_000; say now - $s; say @b 08:15
camelia [7 2 9 0 3 4 8 6 1 5]
1.97999607
[9 8 7 6 5 4 3 2 1 0]
MasterDuke m: my @a = ("0".."9").pick(*); say @a; my @b; my $s = now; @b = @a.sort({ $^b <=> $^a }) for ^50_000; say now - $s; say @b
camelia [7 5 3 8 6 4 2 1 9 0]
2.95469545
[9 8 7 6 5 4 3 2 1 0]
soar so, .sort(-*) is faster than .sort( {$^b <=> $^a}) 09:09
lizmat soar: yes, because it does a Schwartzian Transform under the hood 10:40
soar good to know it. :-) 10:44
xfix i'm not sure, how Schwartzian Transform is going to help with a function as simple as `-*`? 11:27
i would personally expect `{$^b <=> $^a}` to be faster
unless `<=>` is ridiculously slow 11:28
oh, right, string to integer conversion is involved 11:29
lizmat indeed :-) and by using a Schwartzian transform, that conversion would only need to be done once for each element 11:30
rather than twice for *each* comparison
poohman hi 12:24
poohman m: class A { has Str $.a;has Str $.b};my A @c; @c.append(A.new(a => "1",b => "one"));for @c.append(A.new(a => "2",b => "two"));@c.grep(*.a ~~ /1/).map(*b) {.say}; 12:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3or @c.append(A.new(a => "2",b => "two"))7⏏5;@c.grep(*.a ~~ /1/).map(*b) {.say};
expecting any of:
block or pointy block
poohman m: class A { has Str $.a;has Str $.b};my A @c; @c.append(A.new(a => "1",b => "one"));@c.append(A.new(a => "2",b => "two"));for @c.grep(*.a ~~ /1/).map(*b) {.say}; 12:31
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3=> "two"));for @c.grep(*.a ~~ /1/).map(*7⏏5b) {.say};
expec…
poohman m: class A { has Str $.a;has Str $.b};my A @c; @c.append(A.new(a => "1",b => "one"));@c.append(A.new(a => "2",b => "two"));for @c.grep(*.a ~~ /1/).map(*.b) {.say}; 12:32
camelia WhateverCode object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
poohman could somebody please help me with the grep part of the above code 12:33
ShimmerFairy m: class A { has Str $.a;has Str $.b};my A @c; @c.append(A.new(a => "1",b => "one"));@c.append(A.new(a => "2",b => "two"));for @c.grep({$_.a ~~ /1/}).map(*.b) {.say}; 12:36
camelia one
ShimmerFairy there's a limit to how magical * can be.
poohman ah ok - I thought it was something deeper - thanks
ShimmerFairy In short, what the grep bit you wrote said wasn't {$_.a ~~ /1/} (like you wanted), but rather {$_.a} ~~ /1/ 12:38
poohman oh ok - that was not as simple as I thought 12:41
Geth doc: uzluisf++ created pull request #3449:
Revise the Capture page
13:48
wamba !boss 13:53
mahafyi moritz : good evening. I had purchased your Perl5 Fundamentals. Is there a list of new changes in the latest 'Raku' version somewhere? 15:01
lolol Perl6
moritz mahafyi: I'm working on a Raku revision right now. Basically all of the code examples still work. 15:07
mahafyi moritz : thanks :)
moritz the collation examples don't need "use experimental ..." anymore
but they work with too 15:08
mahafyi i have been completely skipping Testing of any kind, as i couldn't get it. Going back to your book to start learning that, as i plan to actually write something for actual use other than bits and pieces of learning scripts. I have read it is important to know this from the beginning. 15:10
Geth doc: 1a2cc93767 | (Luis F. Uceta)++ | doc/Type/Capture.pod6
Revise the Capture page

Refs: #3444
15:16
doc: 6cf253af53 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | doc/Type/Capture.pod6
Merge pull request #3449 from uzluisf/master

Revise the Capture page Closes #3444
linkable6 Link: docs.raku.org/type/Capture
linkable6 DOC#3444 [closed]: github.com/Raku/doc/issues/3444 [RFE][docs] Example for Capture is confusing.
Geth doc: coke assigned to uzluisf Issue doc/Type/List.pod6 fails example test github.com/Raku/doc/issues/3450
cb766dd9b3 | Coke++ | xt/code.pws
17:38
Geth doc: JJ self-assigned doc/Type/List.pod6 fails example test github.com/Raku/doc/issues/3450
4626b05cff | (JJ Merelo)++ | doc/Type/List.pod6

Thanks, @coke, for checking this out. Closes #3450
17:49
linkable6 Link: docs.raku.org/type/List
DOC#3450 [closed]: github.com/Raku/doc/issues/3450 [docs][xt] doc/Type/List.pod6 fails example test
JJMerelo .seen [Coke] 17:52
tellable6 JJMerelo, I saw [Coke] 2020-05-29T18:40:19Z in #raku: <[Coke]> timotimo++
[Coke] Hi. 17:56
Geth doc: 0041494085 | (JJ Merelo)++ | doc/Type/List.pod6
Fixes typo and closes #3450 again.
17:56
linkable6 Link: docs.raku.org/type/List
DOC#3450 [closed]: github.com/Raku/doc/issues/3450 [docs][xt] doc/Type/List.pod6 fails example test
JJMerelo Hi, [Coke] I was wondering if maybe we should automate example compilation and spell checks. Maybe with a GitHub action 17:57
Or even Azure pipelines. We just set it up for the Raku organization.
We could try and add some magic so that only changed files are checked 17:58
[Coke] I'm obviously 100% down for that, as I don't want to be the only runner of the tests. The original concern was: don't want to cause "build failures" when someone edited something via the web interface. Didn't want to make it burdensome for the casual contributor.
JJMerelo By the way, thanks a lot for doing that job 17:59
[Coke] JJMerelo: note that I'm already doing that magic myself with "util/update-and-test"
So please feel free to try to steal that.
[Coke] JJMerelo++ 17:59
JJMerelo OK, I'll open an issue. I mean we have so much computing power at our disposal now, that why shouldn't we use it...
timotimo i just learned that someone in a book about design patterns also has a helpful section that shows what it looks like when you overuse a pattern 18:00
i wonder if our docs should have that kind of section sprinkled in every now and then
"this is what it looks like when you use hashes for everything" 18:02
JJMerelo timotimo in examples, we overuse the pattern of "look how this is written with this utterly useless example involving foo and bar" 18:03
timotimo yes
true 18:04
JJMerelo timotimo I'd definitely would go for that. So please open an issue, so that at least we take it into account.
timotimo i wish i had a better example to show 18:05
JJMerelo timotimo we probably need a "pattern" and "antipattern" page too, so that we can refer to it when we say something is overused.
timotimo or an actual reference
JJMerelo no problem, I get the idea
While making clear that we encourage that people write stuff however they want. 18:06
timotimo those "people" is for readers of the docs or writers of the docs or both?
JJMerelo Some patterns are going to be faster than others, or clearer than others
timotimo well, both... 18:07
JJMerelo At the end of the day, people are going ot start writing their stuff by copying-pasting from the docs and/or stackoverflow 18:07
timotimo give every single entry in the docs a little slider between "fast" and "clear" with a V somewhere in between
JJMerelo timotimo hey, not so fast (or clear). No new tooling, please... Reference examples should be clear. Tutorial examples whould show both 18:08
timotimo to make examples more useful, we should give every example a set of input boxes for "your own stuff here" 18:09
so if you have a list already and it's called "@myshinylist" it'll substitute that in the example!
JJMerelo timotimo er... no, please... no additional tooling. I'm extremely happy now that the site is fully static 18:11
timotimo ok, but even if it's static in can still be dynamic 18:12
microsoft has this shiny new technology called "DHTML"
JJMerelo timotimo maybe it would be possible with Rakudo.js Still, additional tooling to generate that stuff... Heavier pages...
timotimo essentially you write your code in VB and compile it to a .dll, then you put that into your html
sorry, i'm drifting off into silly-land
JJMerelo timotimo ... and we can import it into Raku using NativeCode :-) 18:13
timotimo Call*
JJMerelo timotimo that would be cool, but... I mean, there are other priorities. But you could submit that as a possible project for Season of Docs 18:14
We'll try again next year, I guess.
timotimo there's already an isue somewhere for giving every example a link to one of the many sites that you can run raku code on
JJMerelo timotimo right... 18:15
timotimo at least some of them should be easily-ish feedable via an url parameter 18:16
otherwise we'll just™ ask for support to put an url into the url and the code would be pullde from that url
JJMerelo This is the issue github.com/Raku/doc/issues/1866 18:17
chloekek_ . 18:19
JJMerelo chloekek_ hey
chloekek_ henlo
timotimo hewwo 18:21
chloekek_ Haven’t done Raku in weeks
timotimo raku hawen't fowgotten youw 18:22
(am not actualy good at this)
chloekek_ I want to do less programming and it took me months to find something else to do 18:24
I think I want to pursue a hobby in electronics
El_Che chloekek_: isn't that just programming with soldering? :) 18:25
Grinnz it's just programming where your bugs are harder to explain 18:26
chloekek_ It’s programming but you get as much parallelism as you want.
I already had my first share of 30 minute debugging trivial issue. 18:27
Hooked up two LEDs to a 3 V battery in series. The LEDs need 2 V each. Didn’t work.
moritz fun fact: you always need a resistor in front of a LED, even if the voltage is "right" 18:32
how unintuitive
chloekek_ That’s because LEDs have a maximum current, and batteries and wires ideally don’t. 18:40
And the maximum means exceeding it blows it up, doesn’t limit it.
xfix some LEDs have built-in resistors, but usually you need to put a resistor in
chloekek_ Whilst waiting for new components to arrive I’m writing a Haskell library for defining circuits, and it has a function that automatically computes the necessary resistor. :) 18:41
tbrowder i take umbrage over criticism of too much foo, i'm lucky i can remember bar 19:23
tbrowder i hope the implict smiley was understood :-D 19:57
lizmat
.oO( I vaguely remember a bar :-)
20:03
[Coke] m: dd $*IN.lines; 20:12
camelia ("»Wann treffen wir drei wieder zusamm?«", " »Um die siebente Stund‘, am Brückendamm.«", " »Am Mittelpfeiler.«", " »Ich lösche die Flamm.«", " »Ich mit«", "", " »Ich komme vom Norden her.«", " »Und ich vom…