🦋 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.
tbrowder__ read...as my grandkids would say, "awesome!" 01:13
Geth advent: a8b9c551f5 | (Tom Browder)++ | 2 files
prep for the upcoming season
07:38
advent: 409f774036 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 2 files
Merge pull request #106 from tbrowder/raku-advent-2023

prep for the upcoming season
whatnext hello raku community :D 10:38
quick and very basic question - but something I have neglected to find an answer to and now have become irritated with my ugly workaround 10:39
in perl5 I can do `my ($var1, $var2) = something_returning_an_array();` 10:40
in raku I seem to end up writing `my @array = something_returning_an_arrray();` and then picking `$var1` and `$var2` out of `@array` because the same construction doesn't seem to work 10:42
or does it?
what should I be writing to immediately pick up the list elements after the sub call ? 10:43
thanks for any help :)
lizmat m: sub a() { [1,2,3] }; my ($a,$b) = a; say $a; say $b 10:47
camelia 1
2
lizmat whatnext: this just works ? ^^
whatnext hm... maybe I am returning the value from the sub in the wrong way 10:49
so what is the difference if the return value is in parentheses `(` and `)` ? 10:51
lizmat no difference, you can even leave off the parentheses 10:52
m: sub a() { 1,2,3 }; my ($a,$b) = a; say $a; say $b
camelia 1
2
lizmat as the list builder is the comma, not the parentheses
note, that the single argument rule applies here. If you would return 2 lists, the first would wind up in $a, and the second in $b 10:53
m: sub a() { (1,2,3),(4,5,6) }; my ($a,$b) = a; say $a; say $b
camelia (1 2 3)
(4 5 6)
whatnext hm that's strange... that is what I would expect based on the docs, and obviously it does work in your example 10:55
lizmat maybe you think the something returns an array, but it doesn't? 10:57
whatnext maybe my problem is indirectly resolved by changing the format
well, the error is `Stringification of a Buf is not done with 'Stringy'.  The 'decode' 10:58
method should be used to convert a Buf to a Str.`
which admittedly doesn't look like anything related to arrays at all
lizmat a Buf is not an array. It does do the Positional role, but is *not* Iterable
m: dd Buf ~~ Iterable 10:59
camelia Bool::False
lizmat hmmm... 11:00
whatnext yes... none of the variables are supposed to be Buf though - and if I construct it the second way I mentioned, I don't get an issue 11:01
only the `my ($var1, $var2) = ...` construction seems to result in an issue
lizmat without more clues I cannot tell you what the problem is: could you create a gist of your code somewhere? 11:02
whatnext ok thanks v much for your help 11:05
its a bit tricky to put in a gist because the relevant code spans several modules 11:06
what I will need to do is try and reduce it down 11:07
I will get back to you if/when I manage to do that :)
thanks again
lizmat you're welcome :-) 11:08
lizmat is on a roll: dev.to/lizmat/so-why-is-there-raku...place-5bga 18:44
SmokeMachine I don't know if anyone here have ever used nats (nats.io) or would be interested in this, but I've been playing on writing a Raku client for it. It's very far to be done or good, but would someone like to take a look/critic/help? github.com/FCO/nats 18:46
I've tried to do an API based on Cro as an option to use supplies directly. 18:49
lizmat question: so this is a sort of reversed memcached? 18:50
SmokeMachine lizmat: no, its a "queue" system (like rabbitmq) that also has the option to store the messages (like kafka) and has a simple way to use request-response (so it can "replace" REST/HTTP) and because one subscribes to a subject, it can be used with out need of a service discovery... between other stuff.. 18:56
lizmat: but it also have a key/value store on that, so yes, it can be a replace to memcache
so, for example: gist.github.com/FCO/a366eb93c00859...0cb50558c2 19:01
SmokeMachine lizmat: docs.nats.io/nats-concepts/what-is-nats 19:05
lizmat: make sense? 19:10
lizmat yes, feels a bit like CORBA: en.wikipedia.org/wiki/Common_Objec...chitecture 19:14
afk&
Xliff \o 20:40
A bit off topic, but does anyone here know OpenGL?
librasteve i'm slightly adrift from micro services and go-micro and so on, but I gather that nats is a popular microservices comms framework and it looks as if your module does a very nice, clean mapping to the core raku view of 'react', 'whenever', 'supply' and so on 21:38
i suppose that we should be keen to have a way to do the micro stack set out here blog.micro.mu/2016/04/11/micro-on-nats.html by asim aslan and so to do the stack chart here web.archive.org/web/20160323214006...icro/micro 21:41
so kudos to your module to make raku play (with Go?) and so on in this world - but I wonder how I can set up a raku microservice on eg AWS Lambda 21:43
avuserow I think you can run docker containers on AWS lambda these days. That's probably the easiest way to get everything packaged. 21:44
librasteve holy cow, I thought you had to load in Java or Python source 21:50
so raku + AWS/lambda/dockerfile + nats would be quite a nice cookbook 21:53
SmokeMachine librasteve: thank you. The links you sent didn’t open here… :( 21:55
AWS lambda accepts layers to your lambda where you could add Raku… 21:57
librasteve github.com/micro/micro 21:58
SmokeMachine docs.aws.amazon.com/lambda/latest/...ayers.html
librasteve nats.io/blog/microonnats/ 21:59
is there a general raku layer? 22:00
sorry must sleep 22:04
coleman SmokeMachine: I'm a huge NATS fan 22:50
I have wanted a client for a while 22:52
coleman I will take a look 22:52
SmokeMachine coleman: I’ve never used that… just knew about that… but really liking what I’m seeing. My client is still in very early stages… most of features missing and no tests at all (yet) 23:35
coleman: but, please, take a look! And let me know if there is any suggestion/critic 23:38
uzl[m] > you cannot assign to a sigilless variable, but binding to one doesn't enforce a context
moritz Thanks but I'm still unclear why you can re-assign to a sigilless variable assigned an `Array`. Is it because an `Array` is basically a container?
m: my \a = [1, 2]; say a; a = [3, 4]; say a; 23:39
camelia [1 2]
[3 4]
gfldex m: Array.^can('STORE')».raku.say; 23:41
camelia (proto method STORE (Array:D: |) {*} proto method STORE (List:D: |) {*})
gfldex uzl[m]: looks like it ^^^ 23:42
uzl[m] Got it! Would it be fair to say you can re-assign to a sigilless variable as long as what you declare it with has a container? Case in point, an Array. 23:46
This section (docs.raku.org/language/variables#S...variables) in the docs makes it seem as this shouldn't be possible but that's simply because an Int, which is used as an example, isn't a container:
>Note that sigilless variable do not have associated containers. This means degrees and θ, above, actually directly represent Nums. To illustrate, try assigning to one after you've defined it:
tbrowder__: Thanks for the link :) 23:47
gfldex m: constant const = $; const.say; const = 42; const.say; 23:48
camelia (Any)
42
gfldex m: constant const = $; const := $; 23:49
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to 'const' because it is a term and terms cannot be rebound
at <tmp>:1
------> constant const = $; const := $⏏;
gfldex The binding is constant, not the value that the symbol is bound to.
uzl[m] Ahhh this makes sense! I tend to forget assignment in Raku is driven through containers thus it'd make sense why you can assign to a sigilless variable first assigned an Array. Now the binding is constant as you said 23:53
I was like "why can I do a re-assignment but not a re-binding?" lol
Thanks, this clears things up for me!