🦋 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 getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
stevied anyone know offhand how I can figure out which version of vim started supporting "raku" for the filetype? 00:26
actually, more specifically, when they dropped support for perl6 fitetypes 00:30
Nemokosch what does it mean that it's supported? 👀
stevied well, here's the issue: 00:31
github.com/kbucheli/p6-Text-VimCol...m_colour.t 00:32
test 7 fails with the newest versions of vim
if I change it to raku, it works with newer versions
so need to figure out when to set it to perl6 for ancient versions of vim and when to set it to raku for newer versions of vim 00:33
sorry, test 4 fails 00:34
tests pass with version 8.2.3489 but fail with 8.2.4100 00:36
I guess easiest thing to do is use perl6 for all versions up to 3489 and raku for all versions after 00:36
but it doesn't seem easy to get at patch version 00:40
8.1 was released in 2018, before raku came out. so I can't use that
[Coke] Do you need to pass things that are so old they don't support raku ? 02:09
(Seems like just changing it to 'raku' is a good first pass) 02:10
D5n9sMatrix Hi all 04:29
D5n9sMatrix develop my project "ably" used language ["Perl6", "Erlang", "Octave", "Gambas"] any your my help ? 04:32
#raku  one pivoting 04:34
D5n9sMatrix sub pivoting($U11, $L21) { my $self = [Coke]+$U11|$L21; } #expression Intel Core 04:40
create one File in Folder /develop/  -> 04:54
# pivtos solver verify the elements
sub pivots($Ut12, $Coke){
    # reflect arguments silent
    my $self = @[$Coke];
    my $sys  = Array.x[$Ut12];
    # type of speech voice commands
    say "look pivots to solver the elements" if $self.x;
    say "look the resolution verify", if $sys.x;
  return $self; # running path car silent
}
D5n9sMatrix # pivtos solver verify the elements 05:01
sub pivots($Ut12, $Coke){
    # reflect arguments silent
    my $self = @[$Coke];
    my $sys  = Array.x[$Ut12];
    # type of speech voice commands
    say "look pivots to solver the elements" if $self.x;
    say "look the resolution verify", if $sys.x;
    return $sys.x[$Ut12[" aitron has left (Read error: Connection reset by peer)"]];
  return $self; # running path car silent
}
move change return to access true connection aitron ... 05:03
D5n9sMatrix create solver problems /develop/ -> 05:14
# k + 1 relfect ah-ha!
sub L21($k + 1){
    my $self = @[$k+1];
    my $detail = &[$k.x[5.5]];
    my $solver = m/$k/;
    say "look detail solver problems", if $self.x;
    say "verify the detail of elements", if $detail.x;
    say "problems resolver" if $solver.x;
    return $self.x;
}
solved here -> 05:16
# k + 1 relfect ah-ha!
sub L21($k){
    my $self = @[$k+1];
    my $detail = $k.x[5.5];
    my $solver = m/$k/;
    say "look detail solver problems", if $self.x;
    say "verify the detail of elements", if $detail.x;
    say "problems resolver" if $solver.x;
    return $self.x;
}
#raku Rook Pivoting 05:17
#raku 3.4.7 Rook Pivoting 05:18
Lu pivoting reference of points in what verify the elements -> 05:34
# Lu pivoting
sub Lu($k, $n) {
    # dialog lie
    my $self = @[$k|$n];
    my $P = Array.x[24, 42, 38, 52,
                    36, 67, 11, 37,
                    13, 72, 36, 48,
                    61, 50, 43, 16];
    my $breakpoints = $P;
    my $verify = $P;
    # verify the lie of elements about error
    say "verify the brekpoints elements", if $breakpoints.x;
    say "verify the elements", if $verify.x;
    say "look breakpoints", if $P.x;
}
D5n9sMatrix verify the debug -> /home/username/project/ably/matrix/bin/client/debug -> 05:52
# then "72" would be identified by complete pivoting
# while "52," "72," or "61" would
sub detail($debug){
    # verify self
    my $self = @[$debug];
    my $pivoting = Array.x["Dialog Pivoting"]; 05:53
    my $World = Array.x["Best Peace"];
    # vector send pow round
    my $vector = Array.x[72, 52, 72, 61];
    # speech ambient integer
    say "verify breakpoints" if $pivoting.x;
    say "verify the Best Peace World" if $World.x;
    say "vector matrix", if $vector.x;
}
D5n9sMatrix create folder -> /home/username/project/ably/matrix/bin/client/debug/perl6/Lu/pivoting -> 06:08
file n.p6 ->
# while develop
while (0 < 1) {
   say "develop debug compiler raku perl6 files";
   last;
}
D5n9sMatrix about the folder -> /home/username/project/ably/matrix/bin/client/debug/perl6/Lu/pivoting -> 06:35
create file rowpiv.p6 -> 06:37
# tehory of loop
my &On2 = sub { say "theory of loop" }
while (0 < 1) {
    say &On2;
    last;
}
personal let go my sleep good morning to all ... 06:41
D5n9sMatrix easy many fasts between specifying document situation-> 09:20
D5n9sMatrix class new attach documentation case professional AOS by guest imaginary spirit professional help will green compare more full lew history lack dis number peer my bill hire lay due or money protected my life business my site pad jack var new order tech home AOS tech problems history. 09:26
business -> 09:27
#!/usr/bin/perl6
# ensure long method bellow
sub colpiv($k){
    # open click do
    my $self = @[$k];
    my $mn   =  m/$k/;
    my $den  = $self;
    # speech country best equip
    say "easy night joy" if $self.x;
    say "mesy send powy" if $mn.x;
    say "look ter" if $den.x;
    # notation en fantastic
    class pivoting {}
    # fantastic markets
    my $pivoting_1 = pivoting.new;
    my $pivoting_2 = pivoting.supply;
    my $pivoting_3 = pivoting.pivoting;
return $self;
#raku 3.4.8 09:29
A Note on U nderdetermined Systems
El_Che D5n9sMatrix: use tools like pastebin.com/ 09:36
D5n9sMatrix &El_Che does not support pastebin.com 10:29
D5n9sMatrix gut night sleep in corporation sign banner tar peer over problems sis peer proffer level new pad change way google books revolution HTTP://z-lib.org 10:33
sou jobs supper ray person supper books way hi quest nobody waits for click server protection. 10:36
D5n9sMatrix sou math tech over day profession -> clicks everyday lack der peer double lay have peer nay stick documents have the software still proffession. 10:41
server comprehend fest ship still nay chef sou beta gates support the family everyday person overblow. 10:43
El_Che \o/ 11:00
:)
moritz thanks El_Che 11:03
El_Che kicking and banning since 1994 :) 11:12
tbrowder yay El_Che 12:01
dynamite hello 12:34
what do you call someone who writes perl? :)
lizmat dynamite: are you on the right channel ? 12:50
Anton Antonov <@549087503735324693> "perlite" maybe... 12:56
dynamite oh, I like perlite! 12:58
Anton Antonov Well, "perlite" is a cheap "industrial mineral", but it does allude to being "literate with perl." 13:00
@lizmat I have a follow-up question related to using `BEGIN`. I have a package Stoichiometry computations, which has a Singleton pattern class for accessing the chemical elements data. The package uses this declarations / instantiations within a few files : `my Chemistry::Stoichiometry::ResourceAccess $resources.instance;` . 13:16
If replace one of them with `BEGIN` block, e.g. `my Chemistry::Stoichiometry::ResourceAccess $resources := BEGIN { my Chemistry::Stoichiometry::ResourceAccess $resources.instance }` this should be sufficient to speed the load at run time, after package installation? 13:17
lizmat you're creating a constant from a variable that hasn't been initialized yet ? 13:20
perhaps a gist with a golf ? 13:21
Anton Antonov @lizmat Let me think on what you said... 🙂 13:25
stevied Not sure what you mean by “pass”. If I have just a 2 year old version of vim, it may not work with “raku”. If I have a new version of it’s broken with perl6. 13:33
Seems some kind of logic is needed to determine what language is supported. 13:35
Ulti out of curiosity the ARM64 builds of MoarVM and Rakudo without any JIT? 15:18
just noticing my benchmarks are a little bit faster than my intel laptop from 2016 on the latest Apple Silicon Mac but wondered if thats just its brute improvement in CPU power accounting for the lack of any JIT implementation 15:19
D5n9sMatrix feels like an emerging AI child attempted to talk to us about its creation 15:21
MasterDuke correct, they are without a jit. however, almost all of the moarvm/nqp/rakudo optimizations recently haven't been jit-related, so a recent rakudo without a jit is comparatively less slow than an old rakudo without a jit
Anton Antonov @lizmat "you're creating a constant from a variable that hasn't been initialized yet ?" -- No, the Singleton class is already defined. So, the variable can initialized. (At seems to work without complains.) 16:17
@lizmat "perhaps a gist with a golf ?" -- I think I finally understood what you are proposing. I can dehydrate/serialize the object with chemical elements data in using `.raku` or `.gist` and use that expression in a `BEGIN` block. 16:18
cognominal Is there in raku a canonical way to test if a file is binary (non textual file), like -B (I think) for Perl ? 17:38
Voldenet perl's -B is not that useful 17:44
[Coke] many of the file operators exist, but not b. 17:49
there is github.com/jnthn/p6-data-textorbinary 17:50
It's 5 years unchanged, but looks decent.
moon-child 'The algorithm will flag a file as binary if it encounters a NULL byte or a lone carriage return (\r)' didn't an old version of macos use lone cr as a newline? 17:51
[Coke] pre OS X, IIRC. 17:53
El_Che [Coke]: Mac Classic what they call it nowadays 17:56
:)
[Coke] +1 17:57
cognominal Thx. Judging by the contributors, it is a good candidate 18:22
Voldenet not sure why p6-data-textorbinary checks 13 and 10 separately 18:36
file(1) treats 10 and 13 as text always 18:37
moon-child it says it's based on git's heuristic
Voldenet \r can be valid text, at least on my typewriter 18:43
dynamite /msg NickServ IDENTIFY dynamite asdf 18:50
wait what
lizmat space before
dynamite ah 18:51
younder Is there a raku module with a interface to ncurses for Linux? 19:04
Never mind: I'ts  NCurses 19:06
moon-child waggles his fist at in-band authentication 19:27
younder: consider using Terminal::Print, unless you absolutely need curses
Voldenet a propos console libs, I wish there was something like github.com/Textualize/rich for raku 19:45
currently i just use Inline::Python for it, but it's enormously ugly 19:46
Anton Antonov @Voldenet What is ugly? Python, "Inline::Python", or both applied together? 20:07
Voldenet both 20:25
for example progress bar from rich uses `with` syntax, which translated into raku with __enter__ and __exit__ methods is a terrible hack 20:27
lucs Raku constructor question: gist.github.com/lucs/387b10ac9576b...db12ce91d0 21:53
Voldenet lucs: ix.io/3MIu 22:05
thowe I need an alternative to fail2ban written in raku. 22:06
El_Che Foo.new(foo => $x/2); #maybe?
lucs Voldenet: Yes, that works, but I'm trying to find a way where only the Foo class knows what to do with the $x argument. 22:07
Voldenet in fact, it returns Foo instead of Bar 22:08
El_Che BUILD?
lucs (I'm testing it...) 22:09
MasterDuke m: class A { has $.foo }; class B is A { method new($x) { self.bless(:foo($x)) } }; say B.new(42).foo 22:10
camelia 42
MasterDuke lucs: is ^^^ what you mean? 22:11
lucs But if the $x needs to be modified (divided by 2 for example), it appears that it has to happen in the B constructor. 22:12
lucs Only the A class knows how to modify the 42. 22:12
MasterDuke m: class A { has $.foo; submethod TWEAK() { $!foo /= 2 } }; class B is A { method new($x) { self.bless(:foo($x)) } }; say B.new(42).foo 22:14
camelia 21
lucs Yes, closer to what I'm looking for. 22:15
I'll beef up my abstraction.
gfldex m: class A { has $.foo }; class B is A { method new($x) { my $self := self.CREATE; use nqp; nqp::bindattr($self, A, '$!foo', $x / 2); $self } }; say B.new(42).foo; 22:16
camelia 21
gfldex <-- cheater
lucs Yow! ;)
MasterDuke m: class A { has $.foo }; class B is A { method new($x) { use nqp; nqp::p6bindattrinvres(nqp::create(self), A, '$!foo', $x / 2); } }; say B.new(42).foo;   # another take on gfldex's cheat 22:22
camelia 21
lucs I really need to go with nqp to solve this?
grenzo # Maybe try this: 22:22
class Foo {
has $.foo;
submethod BUILD (:$foo) {
$!foo = $foo;
} 22:23
}
class Bar is Foo {}
print Bar.new(foo => 42).foo
lucs Bar should know nothing of Foo's implementation.
MasterDuke dunno. doesn't my version with TWEAK meet that requirement? 22:24
lucs I'll have a better abstract example of what I'm after in a few minutes...
Voldenet lucs: so after previous bad example, this is probably better one ix.io/3MIv 22:35
lucs Yes, thanks, but my example was not clear. 22:36
Revised here:
lucs gist.github.com/lucs/387b10ac9576b...db12ce91d0 22:36
Voldenet BUILD is better than new 22:38
lucs I don't code in Raku enough, I keep forgetting how things work :/ 22:39
I'll read up on BUILD again.
MasterDuke well, and TWEAK is preferred over BUILD if possible
vrurg TWEAK is better than BUILD
El_Che maybe you just want to be too smart :)
vrurg MasterDuke++ :)
Voldenet huh, but why TWEAK is better? Doesn't the value get assigned twice then? 22:40
lucs I've used TWEAK in the past, but I'm not sure how that helps with my problem, that is: how to set up the A part of the B instance so that some-A-method will know about that initial 42 argument. 22:41
That is, given that class B has no idea how A is implemented. 22:42
MasterDuke m: class A { has $.foo; submethod TWEAK() { $!foo /= 2 }; method something() { return $!foo }; }; class B is A { has $.bar = 66; method new($x) { self.bless(:foo($x)) } }; my $b = B.new(42); say $b.foo; say $b.something; say $b.bar 22:43
camelia 21
21
66
lucs That solution has B knowing about A's foo :/ 22:44
MasterDuke it's a subclass, why wouldn't it know about the public members of A?
lucs Again, sorry, my example doesn't quite represent my problem I guess. 22:45
It's not necessarily a public member.
vrurg Voldenet: the default construction protocol depends on BUILD. If it is not specificied it then creates one for you when necessary. If you have a BUILD then much of construction work has to be done manually.
lucs: if it's not a public then subclass must not mangle with it. 22:46
lucs Class A has some-A-method(), and the latter will return something that has to do with the 42 argument passed to the B constructor.
But B doesn't know how that happens.
MasterDuke m: class A { has $.foo; has $!baz; submethod TWEAK() { $!baz = $!foo / 2 }; method something() { return $!baz }; }; class B is A { has $.bar = 66; method new($x) { self.bless(:foo($x)) } }; my $b = B.new(42); say $b.foo; say $b.something; say $b.bar 22:47
camelia 42
21
66
lucs I'll rework my example...
MasterDuke don't actually need the TWEAK in my example, could just be `has $!baz = $!foo / 2;` 22:49
Voldenet vrurg: I see, that makes sense 22:52
lucs "vrurg> lucs: if it's not a public then subclass must not mangle with it." 22:59
Right. I want the parent class to do the mangling, and the subclass to be able to get to the mangled value with for example some-A-method. 23:00
Voldenet lucs: public constructor is part of the contract for subclasses
[Coke] then you need an accessor or method in A that B calls explicitly 23:02
lucs Uh, A doesn't know about B, can it? 23:03
vrurg lucs: re-phrasing [Coke], then you need a public interface for a private entity
vrurg lucs: BTW, A can know about B. 23:03
lucs Yes, I think that's what I want: class A has a some-
oops 23:04
vrurg And on rare occasions A can trust B to provide access to its private members.
lucs Yes, I think that's what I want: class A has a some-A-method() returning the mangled value.
vrurg But this is unrecommended most of the time.
lucs So invoking B.new(42) somehow passes that 42 to the A constructor (or whatever) and later, some-A-method() returns the mangled value. 23:05
MasterDuke i'm not sure how my example doesn't match your description
[Coke] You're trying to make B too aware of A. 23:06
lucs Your example has class B knowing about $.foo, which it shouldn't (except it should, because my example was not precise enough to match what I'm after).
I'll write up a concrete example. 23:07
vrurg lucs: I have a very strong feeling that you have mis-designed or over-engineered your code. :)
But better see the example in first place. 23:08
MasterDuke m: class A { has $!baz; method new($x) { self.bless(:foo($x)) }; submethod BUILD(:$foo) { $!baz = $foo / 2 }; method some-A-method() { return $!baz }; }; class B is A { has $.bar = 66; }; my $b = B.new(42); say $b.some-A-method; say $b.bar    # sounds like this maybe? 23:13
camelia 21
66
lucs Looking... 23:14
gfldex m: class A { has $.foo; submethod TWEAK { $!foo = $*x; } }; class B is A { method new($*x) { self.bless } }; say B.new(42).foo; 23:15
camelia 42
vrurg MasterDuke: you still can use TWEAK in the last example. :foo will arrive into it. 23:16
MasterDuke ah, nice
lucs MasterDuke: Your last example is what I was after (I'll look at the TWEAK in a minute). 23:19
MasterDuke cool
lucs You guys (and gals, eh) are great!
So I really have to read up on the construction process more carefully. 23:20
gfldex If any subclass overloads method new, you are out of luck. 23:21
lucs gfldex: I don't understand the $*x
gfldex :D
lucs Not funny! ;-)
gfldex You want to forward a positional argument into a method call in another class. 23:22
So I put the value into a dynvar and as such onto the call stack.
vrurg would ignore gfldex ;) 23:23
He loves tricks even more than I do... :)
lucs I've read (not necessarily understood) some of his stuff before, I know what you mean. 23:24
But seriously, I love what you figure out gfldex.
gfldex I do agree that Raku is -Ofun. I had loads of that the past couple of years. 23:25
lucs D'oh! $*x. I get it now. I'd completely forgotten about those. 23:28
(I would never have guessed to use them for my problem though, eh.) 23:29
All this to help me build a Wordle solver helper :-) 23:30