🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is still being worked out. If you're a beginner, check out the #raku-beginner channel!
Set by lizmat on 16 August 2021.
moon-child mjgardner: it's only 3 lines long, there's not really anything there to critique! 00:01
mjgardner I suppose, I just didn’t know if there was any more magic Raku operators or whatever I needed to be aware of. I’m just trying to avoid making a fool of myself before I write a post saying, “Look, this is the better version.” 00:03
moon-child a couple of things that you might not know about--I don't think they would improve the script, but as a point of style you might happen to prefer them-- 00:05
@feeds[0] can be written as @feeds.first or @feeds.head
in 'put $_.title, "\t", $_.link', you can leave off the $_ 00:06
or smoosh the whole thing into one string literal: put "$_.title()\t$_.link()" for...
mjgardner Oh right, you can interpolate method calls. 00:07
I think I’ll do without the smooshing, it’s got more punctuation noise. 00:11
moon-child yeah; I would probably prefer that if there were a lot of literal text alongside the interpolated bits, but not just for one character 00:12
Geth doc: e13f656fba | (JJ Merelo)++ | doc/Language/5to6-perlfunc.pod6
Clarify differences between ucfirst vs tc and tclc

This closes #3933.
08:33
linkable6 Link: docs.raku.org/language/5to6-perlfunc
doc: 2e3006c502 | (JJ Merelo)++ | doc/Type/Cool.pod6
Revision of the definition of log2 and log10

Triggered by #3929, I didn't really find the error; however, there were some minor issues with the definition and the grammar. Anyway, this closes #3929.
Geth doc: 916875f833 | (JJ Merelo)++ | doc/Language/haskell-to-p6.pod6
Adds description of takeWhile

With a specific example suggested by @mykhal in issue #3932. Also, closes #3932
09:01
linkable6 Link: docs.raku.org/language/haskell-to-p6
lizmat and another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/08/23/2021-34-stabler/ 12:29
sjn yay! lizmat++ # RWN 12:57
tib lizmat++ 13:04
Altreus it's a great consolation for the fact it's Monday 13:19
codesections m: say "this.uc() works"; 15:36
camelia this.uc() works
codesections er, 15:37
6c: say "word.uc() is"; 15:39
committable6 codesections, ¦6c (57 commits): «word.uc() is␤» 15:40
Altreus I don't think that's how it works :D
codesections Odd. Memory must be playing tricks on me. nevermind. 15:41
Altreus you can run methods in interpolation, but only on external objects, which chars within the string are not 15:43
6c: say "{ 'word'.uc() } is" ## maybe this? 15:44
...
committable6 Altreus, ¦6c (57 commits): «WORD is␤»
Altreus !
codesections oh, I remember now. I was thinking of this: 15:45
Altreus m: my $word = 'word'; say "$word.uc() is" ## also this?
camelia WORD is
codesections that
Altreus yeah, the thing has to be being interpolated already :)
codesections indeed, that's what was temporarily slipping my mind 15:46
Altreus I quite like the new rules for interpolation. They make it very simple to separate the parts
m: my $word = 'word'; say "{ $word }.uc() is" ## just text
camelia word.uc() is
Altreus none of this ${ symbol name }, or maybe it was @{ symbol } or oh I've gone crosseyed
codesections indeed. And they make is easy to decide when to create new scopes 15:47
Altreus m: say "{[ <what does this do> ]}"
camelia what does this do
Altreus ehehe
codesections m: for 0..5 { say "$($++) | {$++}" } 15:48
camelia 0 | 0
1 | 0
2 | 0
3 | 0
4 | 0
5 | 0
Altreus that'll presumably be the values of $0, $1 etc? 15:49
or just the value of a variable literally called $++?
m: my $'$++' = ':('
camelia 5===SORRY!5=== Error while compiling <tmp>
Name must begin with alphabetic character
at <tmp>:1
------> 3my $7⏏5'$++' = ':('
expecting any of:
constraint
infix
infix stopper
postfix
Altreus phew
codesections it's the $ variable in scalar context 15:50
Altreus why is the second half always 0 though 15:51
codesections because {...} creates a new scope, and resets $
gfldex Quote constructs dont share scope.
codesections m: for 0..5 { say "$($++) | {++$}" } 15:52
camelia 0 | 1
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
Altreus oh, it's not the $ from the for
gfldex m: for 0..5 { say ($($++) | {++$}) }
camelia any(0, -> ;; $_? is raw = OUTER::<$_> { #`(Block|74173264) ... })
any(1, -> ;; $_? is raw = OUTER::<$_> { #`(Block|64390616) ... })
any(2, -> ;; $_? is raw = OUTER::<$_> { #`(Block|64390688) ... })
any(3, -> ;; $_? is raw = OUTER::<$_> { #`(Bloc…
Altreus it's a "block" within the string with its own $
gfldex m: for 0..5 { say ($($++) | {++$}() }
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3for 0..5 { say ($($++) | {++$}() 7⏏5}
expecting …
gfldex m: for 0..5 { say ($($++) | {++$}.() }
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3for 0..5 { say ($($++) | {++$}.() 7⏏5}
expecting…
gfldex m: for 0..5 { say ($($++) | {++$}.()) } 15:53
camelia any(0, 1)
any(1, 1)
any(2, 1)
any(3, 1)
any(4, 1)
any(5, 1)
codesections Altreus yep, exactly
Altreus okay, so how come the first one maintains state and the second one doesn't :x
apologies if this is raku 101
I feel like it's more likely to be 301 though 15:54
gfldex i agree
andinus second one is its own block {}
gfldex But then, I'm a Raku beginner since 2008.
Altreus :D
codesections because $(…) *doesn't create a new scope — which makes $(...) handy for things that want to access the outer scope
it's a context, not a block
(like @ or %) 15:55
Altreus ooohh $() *is* the $ from the for block, but {} is a new block each iteration
and that's where the state of $ is held
gfldex m: for 0..5 { say ($($++) , {++$}.()) }
camelia (0 1)
(1 1)
(2 1)
(3 1)
(4 1)
(5 1)
Altreus so $ is basically just "A container for this block to make use of"
codesections yeah, exactly 15:56
docs.raku.org/language/variables#The_$_variable
Altreus nodnod
gfldex m: for 0..5 { say ($($++); say {++$} }
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3for 0..5 { say ($($++); say {++$} 7⏏5}
expecting…
gfldex m: for 0..5 { say $($++); say {++$} }
camelia 0
-> ;; $_? is raw = OUTER::<$_> { #`(Block|80142560) ... }
1
-> ;; $_? is raw = OUTER::<$_> { #`(Block|80142848) ... }
2
-> ;; $_? is raw = OUTER::<$_> { #`(Block|80142920) ... }
3
-> ;; $_? is raw = OUTER::<$_> { #`(Block|80142992) ...…
gfldex It's a little more complex in this case because the block is stored as a code object. And {} is the thing that created code objects, unless they are in sink context. 15:57
Altreus oh no, I misunderstood slightly - "Each reference to $ within a lexical scope is in effect a separate variable"
So you have as many of them as times you use them because Raku is somehow magic and can identify a variable by where it's used as well as what it's called 15:58
gfldex Anonymous variables are special cased.
Altreus special octarine case 15:59
octiron?
yes, octiron
gfldex m: for 0..5 { say $($++); put {++$} } 16:07
camelia 0
Block object coerced to string (please use .gist or .raku to do that)

1

2

3

4

5

in block at <tmp> line 1
Block object coerced to string (please use .gist or .raku to do that)
in block at <tmp> line 1
Block…
gfldex Altreus: please note that say is kinda special, thanks to it's `is raw` argument. 16:08
Altreus ah, put is say without gist behaviour? 16:14
gfldex yes
Altreus oh, say is documented as such
have to remember that in future 16:15
gfldex And gist on lists wont return more then 100 elements. If I where to design assignments for Raku hires (one can dream!), I would make sure to have the fine candidate to output a list with 101 elements. :-> 16:16
Geth doc/master: 5 commits pushed by (JJ Merelo)++ 16:18
Altreus I followed a twitter link from the daily and it segfaulted my browser tab 16:21
lizmat Altreus interesting... which one ? 16:22
Altreus this one, but I think it's generically Twitter sucking rather than the link in particular twitter.com/markjgardner/status/14...4619587584
lizmat yeah, looks like
Altreus It might be due to the number of criminally bad takes on climate change that Twitter thinks I want to see 16:23
Apparently a tweet involving the word "uninformed" means I want to see lots of other uninformed people with a platform
gfldex If you must change the climate, please change it back!
I had to get myself a cosy blanket, jut because we had the windows open. 16:24
Altreus lizmat: you have far more patience on Twitter than I do 16:25
lizmat perhaps.. :-)
Geth doc: f5c9535d2e | (JJ Merelo)++ | doc/Type/Cool.pod6
Actually fixing #3929

Thanks @mabiggar for clarification.
16:33
linkable6 Link: docs.raku.org/type/Cool
nine Rakudo 2021.08 is now also available in openSUSE Tumbleweed. Just: zypper in rakudo 18:55
Rakudo 2021.08 is now also available in openSUSE Tumbleweed. Just: zypper in rakudo 18:58
lizmat whee! 19:03
lizmat PSA: I have just transferred the IRC::Client module from raku-community-modules to my account 19:18
I intend to work on it the coming days and release a new version updated to the latest and greatest Raku features
gfldex :o 19:19
codesections lizmat++
lizmat MahBot: hello 19:24
MahBot lizmat, HELLO
El_Che_ lizmat++ nine++ 19:29