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.
00:03 Kaiepi left 02:09 frost joined 04:16 samebchase joined
Util deoac: According to github.com/rakudo/rakudo/blob/mast....nqp#L3964 , "Some things can't be done to our vars". 04:29
I am not clear on why "type constraint" is one of those things, though. 04:30
Could be a necessity of the fundamental language design that I just am not seeing,
or it could just be a limitation of the current implementation (as in "Not Yet Implemented").
Two old issues are mainly about the LTA error: github.com/Raku/old-issue-tracker/issues/4677 , github.com/Raku/old-issue-tracker/issues/5778
The docs, at docs.raku.org/language/variables#T...declarator , suggest that `our Int $foo` should work:
"our variables work just like my variables, except that they also introduce an alias into the symbol table."
05:35 Kaiepi joined 06:07 deoac left
pelevesque Anyone know if there is a difference under the hood between these two lines. I see know difference over the hood. 06:53
```
my @seq = 1, 2, 4 ... ∞;
my @seq = 1, 2, 4 ... *;
```
Anyone know if there is a difference under the hood between these two lines. I see no difference over the hood.
```
my @seq = 1, 2, 4 ... ∞;
my @seq = 1, 2, 4 ... *;
```
Nemokosch There is no difference in this case, indeed
pelevesque Thanks. 06:54
Nemokosch * is the so-called whatever star, it depends on the context what it will mean
in a sequence or a range, it will mean Inf
pelevesque Ah, I see... and here it means to whatever which is the same as infinity. 06:55
Makes sense, thanks.
Nemokosch since these sequences are lazy, often it's possible to not think of them as "to infinity" but "to what I demand"
m: (a .. z) Z~ (1, 2, 4 ... *) andthen .say; 06:57
oops, wrong line
m: ('a' .. 'z') Z~ (1, 2, 4 ... *) andthen .say
so yes, it's actually the same as Inf here but it may look nice in a context like this 06:58
pelevesque Ah true - I like that - to what I demand idea. 06:59
Nemokosch do we have something like splice in Javascript? 07:34
oh we do have splice
pelevesque I'm having a problem and not sure how to solve it. 07:57
I have the following code in a module (.rakumod). If I use my module in a raku.main and try test(4) it will fail. I'm realizing it does not like the fact that I use my,
```
my @powers2 = 1, 2, 4 ... 5.7896045e+76; # 2⁰ → 2²⁵⁵
subset Pow2 of UInt where * ~~ any @powers2;
sub test (Pow2 $n) is export { say $n; }
```
If I do this, I have no problem:
```
subset Pow2 of UInt where * ~~ any 1, 2, 4 ... 5.7896045e+76;
sub test (Pow2 $n) is export { say $n; }
```
I can use our instead, but then @powers2 becomes available in my raku.main
Nemokosch I wonder if you can export anything with internal variables in it 08:04
I'm not a module guru but I have the impression that exporting a function that has variables only accessible in the exporting module, would require some sort of "module-level closure" to work 08:05
Nahita `my constant` instead of `my`? 08:06
Nemokosch but then I'm thinking: if modules are a unit of compilation, that shouldn't be a problem, right?
pelevesque Nahita, I'm going to try.
Nahita makes it compile time thing right
pelevesque Nahita, it worked. 08:08
Thanks!
Nahita oh, glad
idk why it didn't work without it though 08:18
btw, you can do `2 «**« ^256` for @powers2 but maybe you already know that
pelevesque I did not know that. 08:19
Nemokosch _hyper hyper_ 08:20
Nahita hyped here: docs.raku.org/language/operators#H..._operators
it's a good way to say good bye to `.map` in cases i think 08:21
Nemokosch but don't forget that the hyper meta-operator is not lazy 08:22
pelevesque I know nothing... I have everything to learn... so thanks!
Nemokosch I think this is hard to get right at first, even though it can really look clever at times 08:23
pelevesque Raku feels really nice to learn.
and use!
Nemokosch This is a phase 😅 08:24
something to talk about in my presentation at the raku conference 😛
pelevesque Coming from JS, it feels like someone gave me a Samurai sword instead of a butter knife.
Nemokosch And I'd say JS isn't even bad 08:25
pelevesque not bad at all... I love that language too... but Raku makes some things much easier. 08:26
Nemokosch But yes, Raku is still bigger... some argued that it's bigger than C++
pelevesque and the gradual typing is amazing.
Nemokosch The gradual typing will bite you sooner or later
this is not a wish, just experience...
there are still serious issues with it, simply put
khm, khm, trying to pass an array literal as a typed array 08:27
well, typed arrays in general 08:28
that's yucky stuff
still, a lot of things can be done by clever coercions 08:30
the design of Raku leans towards "operator implies type" instead of "operator implies some abstract operation"
if you have the + sign, that will be numeric addition and that's that
pelevesque I'm gonna try to wrap my head around that! 08:31
Are you in asia? Or are you up super late like me?
Nemokosch you can of course overload it but why would you when you can just _invent new operators if need be_
negative, Europe
pelevesque I invented 2 operators for the module I am working on. 08:32
What kind of things are you building with raku?
Nemokosch I'm mainly just scripting around. I don't like shell. 08:33
pelevesque nice 08:34
Nemokosch automation stuff 🤖
my biggest "flex" is that I have used an HTTP client already xD
pelevesque How long have you been a Rakoon? 08:35
Nemokosch roughly a year 08:36
so yes... I thought last time I only watched the conference, this time I will participate
draw the conclusions of this year
trynna give something back, feedback at least 08:37
pelevesque I'm watching a Ruth Halloway talk and she said something inspiring... I quote - "Do it, release the code... let the code out"
Did you come from Perl or straight into Raku? 08:39
Nemokosch I started with Raku
Sometimes I check Perl stuff but I'm not actively using it for anything longer than 5 lines
pelevesque I never did Perl. Coming from JS. I'd probably just get confused if I did Perl after learning a bit of Raku.
My sleeping hours became messed up because of Raku. 08:43
It's hard to stop coding since it's so much fun.
Nemokosch 😂
have you tried the weekly challenge?
pelevesque No. I have specific projects keeping me busy. But, I should at one point. 08:44
I bought some books and learned a lot from those, and have a kind of mentor that is good in Raku who helps me too... and you and Nahita! 08:45
Nemokosch the weekly challenge is usually something that you can solve with < 10 lines of code, often something arithmetics related 08:47
and I agree - the availability and enthusiasm is a strong point of the community
also, something that shouldn't be overlooked: the language itself is developed in a transparent and comprehensible manner 08:50
if you know the essentials of Raku, you have a chance to understand the internals, since it's NQP all around 08:51
and NQP is a subset of Raku
pelevesque Ya, that is super cool actually.
Maybe one day I'll get there and can contribute,
Nemokosch Same 😄 08:52
The tough nut to crack is still performance... 08:53
pelevesque ya - I keep reading that. 08:54
Nemokosch And this is not something to overlook if you need a lot of calculations quickly put together. Of course you could just trust C with the computations and invoke it from a dynamic library but yes, it would be important to catch up to the potential competitors like Python 08:57
pelevesque I looked at Rakudo's commit history, and there only seems to be a few people working on it. 08:58
Nemokosch It's like you can get to know them one by one 08:59
Again, lizmat, vrurg and jhnthn will surely hold presentations on the conference 09:00
lizmat conf.raku.org/2022/talks
Nemokosch what does snip do, exactly? 09:10
lizmat m: use v6.*; dd (^10).snip(* < 5, * < 8) 09:21
camelia ((0, 1, 2, 3, 4), (5, 6, 7), (8, 9)).Seq
lizmat it cuts up an Iterable into lists depending on given condition 09:22
(s)
Nemokosch can it be used in a way that only takes some middle part of a sequence? 09:24
lizmat no, but there's a PR for that: github.com/rakudo/rakudo/pull/5008 09:29
say (^20).skip(0,5,3); # (5 6 7)
Nemokosch that operates on "indices", though, not predicates 09:32
I know there is toggle but honestly, it's a really cumbersome state machine that often doesn't give the right value around the boundaries because of that
pelevesque When is 6.e due? Is there a release schedule... or it's whenever things are ready? 09:33
Nemokosch ~~is there a release schedule for Perl6~~ 09:35
lizmat 6.e will be released after RakuAST has been merged 09:39
that's about the schedule that we have
Nemokosch How many tests pass for RakuAST? 🙂 09:41
and especially what percentage
lizmat I think it was just below 50% last time I checked
but that's fully passing files 09:42
pelevesque Is there a way to create a symbol in raku. 09:53
I want to write a note name like G#4 without any quotes or anything of possible and when I write that it is the same as if I had written the associated MIDI note number. Possible?
Nemokosch the hash is not a good idea 09:57
lizmat # is a character that is not acceptable in an identifier, so alas, no 09:58
you *could* probably create the symbol, but then you wouldn't be able to use it 09:59
Nemokosch there is the musical sharp sign though
also not allowed in identifiers but could be used as a very tight operator
and that sounds like a meaningful way to go about it imo 10:00
♯ as a tight infix operator that eats musical note enums and octave numbers
but then the same approach wouldn't work for flat 10:01
wait I messed up the terminology 10:02
lizmat I guess you would have to export C D E F G A B as enums
Nemokosch it wouldn't work for the normal key, whatever the name is
G4
lizmat
.oO( export them all as enums :-)
10:03
that could work
Nemokosch that would "work" but it would be pretty weird, right? having G4 as one thing on its own and G♯4 as G and 4 composed 🙂 10:04
lizmat the ♯ infix op could just be a hash lookup really 10:05
Nemokosch but then how to do G4
other idea: flat and sharp as tight postfix, that's semantically more correct 10:06
lizmat would be an enum
Nemokosch and the letters would be functions
lizmat that could work oot
too
Nemokosch so G 4 would be a function call 😄
and G♯ 4 a different function call 10:07
but then of course you'd need to pay attention to the precedence still
eventually, it will always have to be something compound, apart from G4, B6 stuff 10:08
12:26 Kaiepi left 12:31 frost left 13:41 Kaiepi joined 15:13 Kaiepi left, Kaiepi joined
pelevesque Thanks, you both gave me a lot to think about! 17:00
17:14 MasterDuke left 18:59 Kaipei joined 19:02 Kaiepi left
Is there a default .gitignore recommended for Raku projects? 20:18
I see that it created lib/.precomp/* so I should probably ignore that.
SmokeMachine pelevesque: probably not the best way… but a way… glot.io/snippets/gcbpxggou0 20:25
Another way: glot.io/snippets/gcbql1t0vf 20:51
pelevesque OMG SmokeMachine... that is gold! 20:57
SmokeMachine I think I prefer the 2nd way… 20:58
pelevesque Me too... I think... Thanks a bunch! 20:59
21:31 Kaiepi joined 21:33 Kaipei left