🦋 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:10 guifa left 00:11 guifa joined 00:12 [Coke]_ is now known as [Coke] 00:19 [Coke]_ joined 00:21 [Coke] left 00:22 jpn joined
guifa SmokeMachine I saw it. Still trying to work out some of the details. I'm trying to get it to be as tightly integrated as Regex is, and if I can nail the syntax right for calling a logical rule/fact and a logical variable (while still allowing for other random variables) it'll be great 00:22
SmokeMachine guifa: on my suggestion I tried to make it closer to grammars... 00:24
guifa okay I get why this happens but it feels LTA 00:36
m: say so True cmp False; say so False cmp True; say so False cmp False 00:37
camelia True
coleman Warning: docs.raku.org will be rebooted. Expect a minute or two of downtime. 00:38
Coming back up... 00:40
Should be back. Enjoy kernel 5.14, docs site. 00:41
01:07 jaguart joined 01:20 Manifest0 left
guifa I totally forget 01:33
how do I pass a literal whatever?
so I can do foo(2,*)
01:35 itaipu left
guifa huh it's suddenly working now 01:36
SmokeMachine m: my @a = <Bla>; require ::($_) for @a # should this be breaking on compile time? 01:37
camelia ===SORRY!===
lang-call cannot invoke object of type 'VMNull' belonging to no language
01:39 jpn left
Voldenet m: my @a = <Bla>; for @a { require ::($_) } # probably not 01:41
camelia Could not find Bla in:
01:49 ponycat left, ponycat joined
guifa m: my @a = ['a',*,'c']; my @b = [1,2,3]; .say for @a Z @b; 01:52
camelia (a 1)
(a 2)
(c 3)
guifa ^^ something seems to be going on with the zip operator 01:53
cross operator works fine
m: my @a = ['a',*,'c']; my @b = [1,2,3]; .say for @a X @b;
camelia (a 1)
(a 2)
(a 3)
(* 1)
(* 2)
(* 3)
(c 1)
(c 2)
(c 3)
guifa m: say $*COMPILER 02:10
camelia Dynamic variable $*COMPILER not found
in block <unit> at <tmp> line 1
guifa m: say $*RAKU.compiler.version 02:11
camelia v2024.02.110.g.18.abe.8.c.32
02:11 hulk joined
Voldenet * on the end repeats previous element in zip op 02:11
but I'm surprised it returns `c 3`
02:12 kylese left
Voldenet m: my @a = ['a', *, |('c'..'g')]; my @b = 1..10; .say for @a Z @b 02:12
camelia (a 1)
(a 2)
(c 3)
(d 4)
(e 5)
(f 6)
(g 7)
Voldenet m: my @a = ['a', |('b'..'g'), *]; my @b = 1..10; .say for @a Z @b
camelia (a 1)
(b 2)
(c 3)
(d 4)
(e 5)
(f 6)
(g 7)
(g 8)
(g 9)
(g 10)
Voldenet interesting
guifa The thing is that Z and X are behaving differently with respect to it 02:17
Voldenet it's obvious why: X doesn't need to treat * differently, Z does 02:19
m: my @a = ['a', *]; my @b = 1..10; .say for @a Z @b 02:20
camelia (a 1)
(a 2)
(a 3)
(a 4)
(a 5)
(a 6)
(a 7)
(a 8)
(a 9)
(a 10)
Voldenet this makes sense
m: my @a = ['a', *, |('c'..'g')]; my @b = 1..10; .say for @a Z @b # this should behave the same as the above IMO
camelia (a 1)
(a 2)
(c 3)
(d 4)
(e 5)
(f 6)
(g 7)
02:22 ACfromTX left
Voldenet I'm betting it has to do something with how zip iterator is implemented 02:22
it doesn't expect to have * in the middle of the list at all
guifa So the *-as-last-element is only documented for the metaoperator 02:25
But not the operator
The Zip operator interleaves the lists passed to Z like a zipper, taking index-corresponding elements from each operand. The returned Seq contains nested lists, each with a value from every operand in the chain. If one of the operands runs out of elements prematurely, the zip operator will stop.
behavior is distinct: 02:26
The Z operator also exists as a metaoperator, in which case the inner lists are replaced by the value from applying the operator to the list:
Voldenet m: say ["a", [*], |("c".."g")] Z 1..20 02:31
camelia ((a 1) (1 2) (c 3) (d 4) (e 5) (f 6) (g 7))
Voldenet …what?
m: say ["a", ["b"], |("c".."g")] Z 1..20 02:32
camelia ((a 1) ([b] 2) (c 3) (d 4) (e 5) (f 6) (g 7))
Voldenet Something's definitely not right
However 02:33
m: say ["a", [*, *], |("c".."g")] Z 1..20
camelia ((a 1) ([* *] 2) (c 3) (d 4) (e 5) (f 6) (g 7))
guifa for now I'm just doing a manually loop with $i but meh lol 02:39
03:09 jpn joined 03:14 jpn left 03:15 hulk left, kylese joined
guifa Is there any way to clone entangled bindings in a hash? 04:29
m: my %x; %x<a> := %x<b>; %x<a> = 1; say %x; %x<b> = 2; say %x; my %y = %x; %y<a> = 3; say %y; my %z = %x.clone; %z<a> = 4; say %z; 04:33
camelia {a => 1, b => 1}
{a => 2, b => 2}
{a => 3, b => 2}
{a => 4, b => 2}
05:32 Xliff joined
Xliff Getting this when attempting to build a fresh Raku: make: *** No rule to make target '/home/cbwood/.rakubrew/versions/moar-blead/nqp/nqp-m', needed by 'NQPP5QRegex.moarvm'. Stop. 05:32
05:33 jpn joined 05:40 jpn left 06:59 ACfromTX joined 07:23 jpn joined
Xliff Still getting -- make: *** No rule to make target '/home/cbwood/.rakubrew/versions/moar-blead/nqp/nqp-m', needed by 'NQPP5QRegex.moarvm'. Stop. 07:24
I've even nuked my entire rakudo setup and still cannot rebuild
07:28 jpn left 08:18 jpn joined 08:21 Sgeo left 08:23 jpn left 08:29 teatime left 08:31 sena_kun joined
Geth raku.org: andinus++ created pull request #221:
Mowyw replacement
08:58 ptc joined 09:19 jpn joined 09:20 teatime joined 09:34 xinming left 09:35 xinming joined 10:02 jpn left
lizmat Xliff: I just did the same, but don't have an issue ? 10:04
10:05 jpn joined
Xliff lizmat: gist.github.com/Xliff/467fd94ab0ee...ae1c358836 10:10
lizmat Xliff: in my case, no rakubrew is involved. In you case it seems it is? 10:11
xinming when I used rakubrew, How can we make the raku scripts in crontab please? 10:13
I mean for best practises. 10:14
How do you handle raku scripts using rakubrew
lizmat how would that be different from another Raku installation ?
ab5tract my guess is because rakubrew installs into a user directory. I don't think it has a mechanism to install system-wide 10:25
10:29 teatime left 10:30 teatime joined, Manifest0 joined
xinming lizmat: I think it's because the raku PATH is not initliazed in crontab 10:36
We have eval $(/home/xm/.rakubrew/bin/rakubrew init Bash) in .bashrc
What I'm curious is, do we have a transparent way to init the PATH in crontab 10:37
Xliff lizmat: It's either an issue in the repository or with how rakubrew set them up.
The following command fails when I build from the versions/moar-blead directory: /usr/bin/perl Configure.pl --backends=moar --gen-moar=main --gen-nqp=main --make-install --gen-moar --force-rebuild --moar-option="--debug" --git-cache-dir="/home/cbwood/.rakubrew/git_reference" 10:38
lizmat I know MasterDuke changed something wrt to bulding, perhaps a "reboot" of rakubrew is needed? 10:39
Xliff I can nuke the moar-blead directory and restart the build and still it errors out.
My reboot being "rm -rf .rakubrew" and reinstalling from scratch. Same problem. 10:40
lizmat Xliff: weird :-(
still feels related to MasterDuke's work, so maybe they have an idea of what's going on 10:41
Xliff OK. I'm on 2024.02 until then. 10:43
I'm usually on weekly builds, so this is a first in a while.
11:00 teatime left, teatime joined
ab5tract xinming: does this help? stackoverflow.com/questions/847569...run-script 11:02
tl;dr -- `crontab -e` should create/edit a user-specific crontab. I'm not sure how deep the environment setup is, but you should be able setup the environment if you schedule a shell script that does the setup and then calls the raku script 11:05
12:12 jpn left 12:17 jpn joined 12:41 jpn left
antononcube I have to revisit the package / module naming question from yesterday. 12:51
I created, submitted, and deleted the package “Data::Slurps” — I think that name sounds “wrong”. 12:52
I consider resubmitting it with the name “Data::Slurpers” or “Data::Importers”.
12:53 haxxelotto joined
Although, the function slurp is being overloaded in that package, I find “Data::Importers” more “findable” or “intuitive”. 12:55
Xliff cd 13:08
13:11 itaipu joined
xinming ab5tract: definitely not. 13:12
I just now find that the bash init output contains the path. 13:13
I just manullay hard code the PATH in crontab
ab5tract ah, I'm surprised that the system crontab would be allowed to access the contents of a user's home folder 13:14
but I'm glad you've got it working
Xliff Still getting this while attempting to build nqp in main: make: *** No rule to make target '/home/cbwood/.rakubrew/versions/moar-blead/nqp/nqp-m', needed by 'NQPP5QRegex.moarvm'. Stop. 13:15
13:15 teatime left
Xliff This isn't even a rakubrew issue anymore. It may be a git one. 13:15
13:16 teatime joined
Xliff I'm usibng the following in the nqp directory: /usr/bin/perl Configure.pl --prefix=/home/cbwood/.rakubrew/versions/moar-blead/install --make-install --git-protocol=https --no-relocatable --no-ignore-errors --silent-build --force-rebuild 13:16
13:17 perlbot left, simcop2387 left 13:20 simcop2387 joined 13:22 perlbot joined 13:27 jpn joined
Xliff OK, building from my local repository worked, but it took a couple of tries. 13:27
Any ideas? I kinda need the rakubrew setup to keep up with my weekly compiles... 13:28
13:32 jpn left
ugexe fwiw `rakubrew build moar-blead` worked on my system 14:15
Xliff Weird. I created a new account and it worked there, too. 14:25
xinming releasable6: status 14:26
releasable6 xinming, Next release in ≈4 days and ≈4 hours. There are no known blockers. Changelog for this release was not started yet
xinming, Details: gist.github.com/24ab632fc60538217f...f716b62e93
Xliff But if I do it from this account, even removing the .rakubrew directory and reinstalling rakubrew from scratch, I still get the same error.
.tell nine Could use a bit of your time. I'm having trouble with NativeCall crashes. #5534 could use your attention and also, what's the best way from converting a Str to a gpointer and NOT having it freed by C? 14:27
tellable6 Xliff, I'll pass your message to nine
14:37 jpn joined 14:42 jpn left 15:00 jpn joined 15:03 haxxelotto left 15:08 jpn left
guifa how is the `is copy` handled? it's not calling .clone or .copy or anything 16:04
SmokeMachine aruniecrisps, Voldenet: if interested, I’ve added some more prototype code on github.com/FCO/Red/issues/15 16:07
eseyman x 16:20
SmokeMachine m: class Bla { method FALLBACK($name, |) { say $name }; sub bla($bla is copy) { say $bla }; bla Bla.new 16:28
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> ($bla is copy) { say $bla }; bla Bla.new⏏<EOL>
expecting any of:
statement end
statement modifier
SmokeMachine m: class Bla { method FALLBACK($name, |) { say $name } }; sub bla($bla is copy) { say $bla }; bla Bla.new 16:29
camelia Bla.new
SmokeMachine m: class Bla { method FALLBACK($name, |) { say $name } }; bla Bla.new.some-method 16:31
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
bla used at line 1
SmokeMachine m: class Bla { method FALLBACK($name, |) { say $name } }; Bla.new.some-method 16:46
camelia some-method
SmokeMachine m: class Bla { method FALLBACK($name, |) { say $name } }; sub bla($a is copy) { say $a }; bla Bla.new 16:47
camelia Bla.new
SmokeMachine it seems its calling no methods...
16:48 jpn joined
ab5tract m: class Bla { method FALLBACK($name, |) { say $name } }; sub bla($a is copy) { $a.some-method }; bla Bla.new 16:52
camelia some-method
ab5tract ah, I see what you mean
16:53 jpn left
SmokeMachine unless it's calling a parent method, I suppose... 16:53
ab5tract It appears to be calling `Parameter.copy` 16:55
SmokeMachine hum! Parameter! makes sense 16:56
ab5tract ah, no that's not right either!
SmokeMachine m: say Parameter.new(:name<$!bla>, :package(Mu)).copy 16:57
camelia False
ab5tract yeah, `Parameter.copy` just returns whether the copy flag was set 16:58
m: say Parameter.new(:name<$!bla>, :package(Mu), :copy).copy 16:59
camelia False
SmokeMachine m: my $p = Parameter.new(:name<$!bla>, :package(Mu)); say $p.copy; trait_mod:<is>($p, :copy); say $p.copy
camelia False
ab5tract m: use nqp; Parameter.new(:name<foo>, :package<Mu>, :flags(nqp::const::SIG_ELEM_IS_COPY)).copy.say 17:01
camelia True
17:03 teatime left
ab5tract SmokeMachine: so I guess the shallow answer is that no class-defined methods are called for `is copy` 17:05
17:19 Sgeo joined
lizmat I think it's much simpler 17:25
a scalar value parameter is put into a scalar ro container ordinarily 17:26
m: sub a($a) { $a = 42 }; a
camelia ===SORRY!=== Error while compiling <tmp>
Calling a() will never work with declared signature ($a)
at <tmp>:1
------> sub a($a) { $a = 42 }; ⏏a
lizmat m: sub a($a) { $a = 42 }; a(666)
camelia Cannot assign to a readonly variable or a value
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat m: sub a($a) { use nqp; dd nqp::iscont($a) }; a(666) 17:27
camelia 1
lizmat the only thing "is copy" does on a scalar argument, is to make the container writeable
m: sub a($a) { use nqp; dd $a.VAR.^name }; a(666)
camelia "Scalar"
lizmat m: sub a($a is copy) { use nqp; dd $a.VAR.^name }; a(666)
camelia "Scalar" 17:28
lizmat m: sub a($a is copy) { use nqp; dd nqp::iscont($a) }; a(666)
camelia 1
17:43 jpn joined 17:47 vlad__ joined 18:55 jpn left
Xliff m: sub a ($b is copy) { $b = 42 }; my $B = 0; a($B) 19:08
camelia ( no output )
Xliff Note that $B is not $b. They are two different containers. 19:09
if you use "is rw" ONLY THEN is $B =:= $b
lizmat indeed 19:10
antononcube @lizmat There is a keyword export , but there is no keyword import , right? 19:25
Anyone else can confirm my conjecture too. 🙂 19:27
ab5tract m: export 19:28
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
export used at line 1
ab5tract m: import
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
import used at line 1
antononcube @ab5tract Thanks. I searched docs.raku.org and here: raku-musings.com/keywords.html 19:29
ab5tract I’m not sure why ‘import’ failed 19:38
in that way
import is useful when you require a module instead of use it 19:39
m: module M { sub m is export { say “m” }}; import M; m() 19:40
camelia m
guifa lizmat: ah. I'm doing something where I need to clone, and was debating whether to do clone before calling or in my method, and was thinking it would nice if I could do it upon calling
oooh.....that could be a cool trait. is clone
antononcube @ab5tract Thanks -- this was not clear to me from perusing of docs.raku.org. 19:41
But, since I had some doubts about using import as function I held up the Zef ecosystem submission of "Data::Importers" : github.com/antononcube/Raku-Data-Importers 19:42
ab5tract antononcube: I wonder if this can provide some inspiration.. 5ab5traction5.bearblog.dev/i-raku-...structors/ 19:46
That’s the most elaborate export-ery that I’ve personally done 19:48
antononcube @ab5tract Yes, it inspirational to those MS DOS and Windows.
ab5tract The post content, not the trappings :P
antononcube Agh, ok -- thanks for clarifying !!! 19:49
Voldenet SmokeMachine: Schema introspection in sql may be not always possible (e.g. where you don't even have sql installed on dev system), it might be worth using model from previous migration as a source 19:55
with specific sql scripts target 19:56
SmokeMachine Voldenet: in that case you wouldn’t use update, but prepare —to-model (I just thought of that) 19:58
—from-model, sorry
Voldenet makes sense 19:59
SmokeMachine Sorry, I was right… —to-model… it will compare the old model (as originally) with the new model 20:01
Voldenet they both make some sense if you want to generate migration scrips for other sql flavors retrospectively… 20:04
but it's a rare use case
> -from-model=3 -to-model=5 –driver=SQLite 20:06
SmokeMachine :+1
but I think it is a good default (if nothing else was asqued) to get the diff from last/current model's version to current local DB 20:10
and to update your local DB, you edit your model and run `update`, make sense?
20:22 vlad__ left 20:29 merp left
Voldenet I usually make changes in the code first 21:07
so, models -> logic -> migration
migration can be arbitrarily complex
but I don't worry about it when designing the code 21:08
sometimes I even start with logic, so I use the db how I'd like 21:09
then refactor model/schema to what I need
and craft the migration
Geth docker: m-dango++ created pull request #58:
Bump to 2024.02
SmokeMachine Voldenet: so change models > run `update` (it will update you local DB) > write your logic > run `prepare` to write your migrations (SQL)... 21:18
Voldenet: or, if you do not have a local DB: change models > do NOT run `update` > write your logic > run `prepare --from-model-version 42` to write your migrations (SQL)... 21:20
21:20 jpn joined
Voldenet updating local db requires migrating it 21:20
it's tougher than it sounds
so yeah 21:21
`prepare from-model-version` sounds about right
hm, I wonder whether inspecting the schema makes sense at this point 21:26
antononcube Alsways inspect the schema!
greenfork I wonder how does this de-sugar? 21:27
m: (1,2,3).&[+]
camelia ( no output )
greenfork Outputs 3
Voldenet m: say (1,1,1).&infix:<+> 21:30
camelia 3
Voldenet m: say (1,1,1).Int 21:31
camelia 3
Voldenet that's why it becomes "3" 21:32
I'm not sure what'd be the syntax for [+], `postcircumfix:<[ ]>(infix:<+>)` perhaps
but I'm guessing 21:33
greenfork What about this one
m: say (1,1,1).&infix:</>
camelia 3
greenfork m: say infix:</>(1,1,1)
camelia ===SORRY!=== Error while compiling <tmp>
Calling infix:</>(Int, Int, Int) will never work with signature of the proto ($?, $?, *%)
at <tmp>:1
------> say ⏏infix:</>(1,1,1)
greenfork Shouldn't it be equivalent here?
Voldenet nope 21:36
m: say infix:</>((1,1,1))
camelia 3
Voldenet note the additional ()
you pass the list as first argument
greenfork Oh I see, thank you! 21:37
Voldenet m: say (1,2,3).&prefix:<[+]> 21:51
camelia 6
Voldenet greenfork: ^
greenfork Prefix makes sense, thank you 21:52
21:55 jpn left 22:21 jpn joined 22:28 jpn left, [Coke]_ is now known as [Coke] 22:56 sena_kun left