This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
gfldex m:``` 00:15
enum proc-options <one two three four>;
my @opt = qw<one two three four>;
for @opt -> $opt {
when proc-options::{$opt}:!exists {
warn "'$opt' is not a valid option";
}
say $opt;
}
```
m:``` 00:21
enum proc-options <one two three four>;
my @opt = qw<one two three four five>;
for @opt -> $opt {
::{$opt}:exists
?? say $opt
!! warn("'$opt' is not a valid option");
}
```
I didn't know that I can test for existence of symbols like that. 00:22
m:``` 00:27
say ::.EXISTS-KEY('one');
say ::.WHAT;
say ::.^methods(:local);
```
01:33 jaguart left 04:29 razetime joined 06:14 razetime left 06:27 jaguart joined
jaguart an App::Mi6 question - README.md says to tweak using dist.ini - where would I look for this file - is it really ``~/.zef/store/App-Mi6-2.0.6/DC88AB1B036FB0C7945474C27E84C7235C82C45D/dist.ini`` 08:06
Hmmm - I am guessing this is ``dist.ini`` in module's root - so mi6 probably won't initialise a new module with dist.ini options... because that would break causality 08:09
08:19 Guest15 joined, Guest15 left
lizmat it refers to the dist.ini in the module's root 09:42
jaguart lizmat++ thanks :) 11:38
looking for recommends on how to introspect the Match result from Grammar.parse 11:57
lizmat programmatically, or visually ? 12:12
13:29 frost left 14:13 jaguart left
Anton Antonov Is it possible to use `deepmap` (or similar function) up to certain level? Say, for a given nested list or hash, it seems `deepmap` applies its argument to the very bottom elements. 15:17
18:07 jaguart joined
jaguart both - visually to understand what's happening and programatically to use the things found... :) 18:08
interesting that multi-line comment using #`<> does not work as well as #`() 18:09
m: #`< for @l -> $l { $l.say; } > 18:12
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$l' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> #`< for @l -> ⏏$l { $l.say; } >
jaguart m: #`( for @l -> $l { $l.say; } ) 18:13
camelia ( no output )
jaguart the for -> seems to be interpreted as end-of-comment
Quibono Maybe a silly question, but how friendly is the raku community? 18:24
lizmat Quibono: that's not a silly question at all 18:25
we value kindness 18:26
but then I'm prejudiced :-)
Quibono How are you prejudiced lizmat? 18:30
Nahita jaguart: isn't ">" in "->" ending the comment, matching "<"? 18:32
lizmat Quibono well, being a Raku Steering Council member sorta implies that :-) 18:34
Quibono Haha gotcha. I'm just kinda burned on unfriendly communities.
lizmat yeah, so am I, so that's why I'm sticking to the Raku community, and try very hard to keep it a friendly place 18:36
Camelia, our butterfly mascot, is an effective filter against people with the biggest egos 18:37
gfldex I believe it helps that one can't tell what The One True Way is. 18:39
Quibono Because raku is multiparadigm? 18:40
lizmat that's one reason, I guess :-)
but even within a single paradigm, there are several ways 18:41
m: .say for (^10).grep: * %% 2
camelia 0
2
4
6
8
lizmat m: .say for (^10).map: $_ if * %% 2
camelia ===SORRY!=== Error while compiling <tmp>
Missing semicolon
at <tmp>:1
------> .say for (^10).map: $_ ⏏if * %% 2
lizmat m: .say for (^10).map: { $_ if $_ %% 2 } 18:42
camelia 0
2
4
6
8
lizmat :-)
Quibono How does the raku community feel about fixed point decimals/ratio types?
lizmat I'd say the community likes the accuracy of Rats in general 18:43
and that fixed point decimals are another way of keeping accuracy, which is currently not supported by Raku
but could be provided in module space if necessary
Quibono So raku has support for rational numbers out the box? 18:44
lizmat yup
Quibono Yaay. Um does the optional static typing impact interpreter perf at all? 18:45
lizmat m: say (4.2).WHAT
camelia (Rat)
lizmat well, you know, under the hood, there's *always* type checking, so generally, any additional type constraints won't affect performance 18:46
of course, if you're going to use constraints like:
m: subset Prime of Int where *.is-prime; sub foo(Prime $a) { say $a }; a(43); a (42) 18:47
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
a used at line 1
lizmat m: subset Prime of Int where *.is-prime; sub foo(Prime $a) { say $a }; foo(43); foo(42) 18:48
camelia 43
Constraint type check failed in binding to parameter '$a'; expected Prime but got Int (42)
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat it is going to have to do a primality check for each check, so that *could* become costly
Quibono Right. Hrm okay so if I want to write a language in raku probably AOT compiling my language to a subset of raku would be the fastest from a run time perspective, or? 18:51
lizmat well, good question 18:53
I'd say, first make it work, then look at where the bottlenecks are, and the make a plan to make things faster 18:54
*then
Quibono What sort of profiling/benchmarking facilities does raku have? 18:55
lizmat there's --profile which will create a HTML file with profiling info 18:57
there's also an IDE called Comma commaide.com
which has a lot of profiling / async timeline options 18:58
Quibono Noice. And where would be a good channel to get feedback on ideas for stuff I want to write in/using raku? 18:59
lizmat well, #raku I guess :-) 19:00
or here :-) 19:01
Quibono Thanks
lizmat you're welcom! 19:02
*welcome :-)
Quibono Thanks. 🙂 19:03
—profile seems like a dream. 19:05
I love that it’s embedded in html
And I could use grammars to build a parser it seems 19:36
lizmat yup, that's how the Raku compiler is built :-) 19:41
afk&
20:36 jaguart left