🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left 00:02 reportable6 joined 00:14 Manifest0 left 00:22 jpn left 00:24 jpn joined 00:39 perlbot left 00:40 simcop2387 left 00:43 perlbot joined 00:48 perlbot left 00:56 simcop2387 joined 00:57 perlbot joined 01:04 xinming left 01:06 xinming joined 01:58 jpn left 02:18 tea3po joined 02:21 teatwo left 02:51 andinus` joined
tonyo m: use Test; my \a := Test; dd a::<&output> #leont this seems to work 02:52
camelia Sub output = sub output { #`(Sub|4666691861120) ... }
03:13 andinus` left 03:27 jpn joined 03:28 frost joined 03:32 jpn left 03:34 frost left 04:34 bisectable6 left, reportable6 left, notable6 left, linkable6 left, committable6 left, unicodable6 left, coverable6 left, squashable6 left, quotable6 left, tellable6 left, benchable6 left, evalable6 left, bloatable6 left, statisfiable6 left, shareable6 left, releasable6 left, sourceable6 left, nativecallable6 left, greppable6 left 04:35 bisectable6 joined, reportable6 joined, nativecallable6 joined, linkable6 joined, squashable6 joined 04:36 benchable6 joined, evalable6 joined, coverable6 joined, committable6 joined, greppable6 joined, quotable6 joined, releasable6 joined, tellable6 joined, bloatable6 joined 04:37 unicodable6 joined, statisfiable6 joined, sourceable6 joined, shareable6 joined, notable6 joined 04:52 Tirifto left 04:54 Tirifto joined 05:15 jpn joined 05:21 jpn left 05:32 jpn joined 05:45 jpn left 06:00 reportable6 left, reportable6 joined 06:28 GreaseMonkey left 06:33 MasterDuke left 07:17 jpn joined 07:22 jpn left 07:26 squashable6 left 07:27 squashable6 joined 07:37 sena_kun joined 07:54 jpn joined 08:05 Manifest0 joined 08:10 frost joined 08:11 frost left 08:14 squashable6 left 08:15 jpn left 08:16 squashable6 joined 08:17 jpn joined 08:30 jpn left 08:37 ivan-taipang joined 08:51 ivan-taipang left 09:22 ab5tract joined 09:25 jpn joined 09:30 jpn left 09:34 kaskal left 09:49 Sgeo left, kaskal joined 10:08 greaser|q joined, greaser|q left, greaser|q joined 10:09 greaser|q is now known as GreaseMonkey 10:19 ilogger2 left, ilogger2 joined 10:30 samebchase left 10:31 samebchase joined 11:22 jpn joined 11:27 jpn left 12:00 reportable6 left 12:02 reportable6 joined 12:10 jpn joined 12:14 jpn left
tbrowder__ tonyo: thnx 12:23
i'm trying to use >>. on a hash of hashes and can't quite get the syntax right. i would appreciate anyone's eyes on the gist to see what needs to be done: 12:25
gist.github.com/tbrowder/b59566957...c03cc21db8
got to leave for a while, thans 12:26
*thanks
guifa_ [ a => 1, b => 2] constructs an array of hashes, rather than a hash of hashes 12:35
Nemokosch it's important to note that this is not a hash and that affects the observed behavior radically
guifa_ m: my $h = [a => {:1x, :2y}, b => {:4x, :8y}]; say $h.WHAT;
camelia (Array)
Nemokosch this is an array
guifa_ ANd also, ».map is basically mapping it twice
if you do %foo».bar, it'll run bar on each element of %foo, that is, on each pair. If you do %foo».map(*.bar), it'll run bar on each element of each element of %foo 12:36
and you have %foo».map( *».map( … ) ), which is each element of each element of each element of each element of %foo 12:37
Nemokosch > if you do %foo».bar, it'll run bar on each element of %foo, that is, on each pair not exactly. It will run bar on each value in %foo, regardless of the corresponding key 12:40
oh, and even that isn't accurate because >>.bar might even recurse over that value 12:42
m: my %foo = a => [1, 2], b => 3; %foo>>.say;
Raku eval 3 1 2
12:45 MoC joined
Nemokosch it's safe to say regardless that >>.map is a striking anti-pattern 12:46
12:55 ab5tract left 12:56 simcop2387 left, perlbot left 12:58 simcop2387 joined 13:00 perlbot joined 13:04 MoC left 13:10 jpn joined 13:21 ab5tract joined
Anton Antonov Maybe this was reported already — installing with zef from the 360.zef,pm hangs. 13:26
I noticed that last night; this morning too. 13:27
I found this: vc.ru/u/144173-kirill-belov/685482...peterburge 13:33
(Sorry, for my previous post — wrong channel/forum.) 13:36
13:41 jpn left 13:48 jpn joined 14:16 teatwo joined 14:19 tea3po left 14:36 jpn left 14:54 euandreh1 joined 14:56 euandreh left, euandreh1 is now known as euandreh 15:04 jpn joined 15:09 jpn left
tbrowder__ ref my gist, WOW, the fact that is an array is surprising to me. no wonder i'm having trouble. i have been using that construct for years and not had any problems. i need to buy a lottery ticket! 15:09
i vaguely remember discussions about %() and {} but not how it all ended. 15:10
back to the drawing board. thanks a heap, guifa 15:12
m: %h = [a => {:1x, :2y}, b => {:4x, :8y}]; say $h.WHAT; 15:15
camelia ===SORRY!=== Error while compiling <tmp>
Variable '%h' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏%h = [a => {:1x, :2y}, b => {:4x, :8y}];
tbrowder__ m: my %h = [a => {:1x, :2y}, b => {:4x, :8y}]; say $h.WHAT;
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$h' is not declared. Did you mean '%h'?
at <tmp>:1
------> [a => {:1x, :2y}, b => {:4x, :8y}]; say ⏏$h.WHAT;
tbrowder__ m: my %h = [a => {:1x, :2y}, b => {:4x, :8y}]; say %h.WHAT;
camelia (Hash)
tbrowder__ ok, that's what i've been using, with the % sigil 15:16
whew!
i guess i should ask, when should one use the $ for hashes, i see it all the time 15:17
lizmat m: my %h = a => {:1x, :2y}, b => {:4x, :8y}; # don't need the [ ] 15:18
camelia ( no output )
lizmat m: my %h = a => {:1x, :2y}, b => {:4x, :8y}; dd %h
camelia Hash %h = {:a(${:x(1), :y(2)}), :b(${:x(4), :y(8)})}
15:19 squashable6 left
lizmat a hash contains containers as values: if you have nested hashes, the containers make them itemized because the hash then lives inside a container in a hash valiue 15:19
*value
tbrowder__ thnx, lizmat 15:20
bye for now
lizmat ack
15:21 squashable6 joined 15:27 rf joined
rf morning folks 15:27
lizmat rf almost evening here :-)
rf In your case, good evening :) 15:28
lizmat thank you, good morning ! :-) 15:49
tbrowder__ guifa: going back to my gist $h, and changing it to %h, what is the syntax to multiply each numerical value in the hash/hash by the same factor. that is the structure i have to deal with (not my choice). 15:55
i can do it the easy way, but i would like a shorter solution using map or whatever it requires. 15:58
lizmat m: my %h = :a{:42a, :666b}; dd %h.deepmap({ $_ = $_ * 7 }) 16:05
camelia {:a(${:a(294), :b(4662)})}
tbrowder__ lizmat, cool! 16:11
lizmat docs.raku.org/routine/deepmap
tbrowder__ m: "thank you!".say for 1..10
camelia thank you!
thank you!
thank you!
thank you!
thank you!
thank you!
thank you!
thank you!
thank you!
thank you!
lizmat yw :-)
tbrowder__ some of what's confusing me in the docs is i see reference to map using deepmap somehow and i 16:13
didn't think i needed to look into using it directly. 16:14
lizmat until I looked at optimizing deepmap, I didn't know of its existence either, if that's any consolation :-) 16:15
tbrowder__ yes, but i think both need good, practical examples in the docs. 16:17
back to coding...see y'all later 16:18
lizmat not disagreeing :-)
16:31 perlbot_ joined 16:32 perlbot left, perlbot_ is now known as perlbot 16:34 simcop2387 left 16:36 simcop2387 joined 16:38 perlbot_ joined, perlbot left 16:39 perlbot_ is now known as perlbot 16:45 perlbot left, simcop2387 left 16:46 perlbot joined 16:47 simcop2387 joined 16:52 jpn joined
Nemokosch Frankly, whatever you think of this fact, Raku is a language that invites you to be creative. The language is too big to reasonably write down every combination of features that somebody might find useful. 16:56
16:57 jpn left
and it's definitely not the fault of the documentation that somebody proceeds to think [pair1, pair2, pair3] was a hash. There is no implication of that anywhere, and [...] is described as an "array maker" 16:57
tbrowder__ Nemokosh, I have used that construct for many years. i never thought of it as a "hash maker", i always thought of it as a hash boundary when i created my own hashes, *always* with a % sigil. early on the {} was warned about as not creating a hash, and %() seemed like too much typing for me. i also know arrays and hashes don't usually need () or {} but i still use them often in my code. 17:25
and speaking as a user of raku since 2015, but not an expert, the docs have improved greatly due the hard work of a lot of people, but good examples are always helpful, especially for less-used features such as deepmap and map. 17:28
Nemokosch that's fair enough in that particular case, I just see this discrepancy between the attitude the language basically mandates, and the role several people seem to read into the documentation 17:31
tbrowder__ such as? 17:35
the intentional tmtowtdi feature is alive and well in raku 17:36
fer sure 17:37
imho, much of the docs could be clearer, the examples too "cute" sometime and adding a new twist in the middle of a basic example. see oo for example 17:39
gotta go, good day to all
17:57 evalable6 left, linkable6 left 17:58 evalable6 joined 17:59 linkable6 joined 18:00 reportable6 left 18:03 reportable6 joined
Nemokosch I see people, even fairly familiar with Raku as a language and as a project, thinking that they - or anyone else, for that matter - can learn Raku only/mostly by reading the documentation 18:03
it's not (only) a criticism of the documentation that this is not possible 18:04
By design, Raku is not really a language that you can "document" in that sense 18:05
tbrowder__ i don't disagree, but the docs, along with The Raku Guide are certainly good enough to get one started. but you're right, one must use the code to really learn. and imho that applies to most any language that i have any experience with. 18:09
i'm from the old school when we had to program fortran and alsol with 80-column punch cards, described on paper, handed through a window to "coders" who punched the cards, etc. lucky to get 24-hr turnaround just to find mistakes. 18:12
Nemokosch Yeah well, i don't know because i basically never tried to learn a language "the schoolbook way". Whenever I had to look something up for python, it felt like that could be a language one can just learn like good old written law 18:32
18:32 jpn joined
I guess this part is cultural, too. In the US, at least, common law is like the main paradigm 18:33
18:34 euandreh left 18:36 jpn left
tbrowder__ i would love to have a raku version of the perl cookbook 18:52
o'reilly wouldn't let us create an online version. probably not enough profit potential for a version created by them. 18:54
19:25 Sgeo joined 19:27 euandreh joined 19:47 jpn joined 19:51 jpn left 20:16 ash joined
ash hi hello 20:17
20:17 ash left 20:39 ab5tract left
uzl[m] Hi everyone! 20:54
When I go to sprintf (docs.raku.org/type/Cool#method_sprintf) and then click in "format directives", I'm taken to docs.raku.org/routine/sprintf.html#Directives, however I don't see any directives there.
Are the docs linking to the wrong page? It's the same for fmt and printf
> and imho that applies to most any language that i have any experience with 20:57
Piggybacking on throwder's comment, I think it'd be nice to have a little icon for each code snippet to copy it to the clipboard, same as in Github's code snippets. It's not a problem with a few lines but when you've a long example, highlighting and then copying can get a bit finicky.
tbrowder__: You just mentioned punch cards, and a few months ago I read "Grace Hopper and the Invention of the Information Age" and I think you'll like it. In fact, I recommend it to everyone here 20:59
tbrowder__: 21:01
>i would love to have a raku version of the perl cookbook
What about a crowdsourced one created by the Raku community?
* tbrowder__: 21:02
> i would love to have a raku version of the perl cookbook
What about a crowdsourced one created by the Raku community?
m: say "%15s".sprintf: "hello" 21:05
camelia hello
uzl[m] m: say "-%15s".sprintf: "hello"
camelia - hello
uzl[m] m: say "%-15s".sprintf: "hello"
camelia hello
uzl[m] m: my $length = 10; say "%{$length}s".sprintf: "hello" 21:06
camelia hello
uzl[m] m: my $length = 10; say "%-{$length}s".sprintf: "hello"
camelia hello
21:12 jpn joined 21:17 jpn left 22:10 sena_kun left 22:21 jpn joined 22:26 jpn left 22:46 Geth joined, RakuIRCLogger left 22:48 lizmat left 23:17 donpdonp|z_ left, lizmat_ left, lizmat joined