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:24 deoac joined
deoac I attempted `zef install Inline::Perl5`. and got the error "Cannot locate native library libp5helper.dylib".  How do I get that library? 00:26
01:06 snonux_ left, snonux left 01:37 NemokoschKiwi joined 01:39 NemokoschKiwi left 03:09 deoac left
:(**@rest, *%rest) m: say 42.WHICH; 06:19
Raku eval Int|42
:(**@rest, *%rest) i thought it gives the address (or id) of the object 06:20
m: 42.WHICH.raku.say;
Raku eval ValueObjAt.new("Int|42")
:(**@rest, *%rest) oh its called WHERE 06:21
m: say 42.WHERE;
Raku eval 6057248994952
:(**@rest, *%rest) m: use MONKEY-TYPING; augment class Mu { method gist { if self.DEFINITE { "<{self.^name} object at {self.WHERE.base(16)}>" } else { "<class {self.^name}>" } } } say Mu.gist; say Mu.new.gist; 06:28
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Package 'Mu' already has a method 'gist' (did you mean to declare a multi method?) at /home/glot/main.raku:4
:(**@rest, *%rest) bruh
m: use MONKEY-TYPING; class A { method gist { if self.DEFINITE { "<{self.^name} object at 0x{self.WHERE.base(16)}>" } else { "<class {self.^name}>" } } } say A.gist; say A.new.gist; 06:29
Raku eval <class A> <A object at 0x5A57C710000>
:(**@rest, *%rest) somehow even monke typing can't allow me to override methods 06:32
m: for [1,2,3,4,5,6,7,8,9] -> $a, $b, $c { say "$a $b $c" } 06:48
Raku eval 1 2 3 4 5 6 7 8 9
:(**@rest, *%rest) til how many elements for gives depends on how many arguments the block has shouldn't be surprising (thats how kv works) but its just interesting that for cares about the number of args of its callback 06:52
m: for [1,2,3,4,5,6,7,8] -> $a, $b, $c, $d { say "$a $b $c $d" } 06:54
Raku eval 1 2 3 4 5 6 7 8
Nahita > shouldn't be surprising (thats how kv works) .kv is yet another Sequence giving thing that happens to produce key-value pairs sequentially. it's again how you form your signature in the following block to receive those. 08:21
:(**@rest, *%rest) yeah, i want to say that for don't just blindly iterate over and give 1 element each to the callback the number of elements for takes depends on the number of args in thr block 08:27
p6steve this is my recipe to build Inline::Perl5 ... first you need to install all the lib and header files ... github.com/p6steve/raku-Dockerfile...Dockerfile and then just go zef install github.com/niner/Inline-Python.git --exclude="python3" 08:48
I think that the header files required are set out in the Inline::Perl5 docs 08:49
08:49 stevied_test left 08:50 stevied_test joined
el gatito (** advocate) can someone explain this inconsistency 08:55
m: say (@(1, 2, 3)).WHAT; my @a = 1, 2, 3; say @a.WHAT; 08:56
Raku eval (List) (Array)
el gatito (** advocate) ^
gfldex You cast a List to a Positional and you get List. You got an Array which ... happens to be an Array. 09:01
el gatito (** advocate) in the assignment i also pass a List why does it become Array 09:02
09:02 snonux joined
m: say (@(1, 2, 3)).WHAT; my @a = (1, 2, 3); say @a.WHAT; 09:02
Raku eval (List) (Array)
09:03 snonux_ joined
gfldex Because the default container type of an @-sigiled symbol is Array. If you assign a List to an Array, the values of the List become the values of the Array. 09:03
09:03 Manifest0 joined
m: my @a := 1,2,3; say @a.WHAT; 09:05
Raku eval (List)
el gatito (** advocate) containers be like 😔 09:06
i was expecting @(1, 2, 3) to return an array so that i have a short way to convert to Array turns out thats not how it works 09:07
gfldex @el gatito (** advocate) these might help: gfldex.wordpress.com/?s=container 09:08
snonux > Array(1,2,3).^name 09:17
Array
m: Array(1,2,3).^name 09:18
camelia ( no output )
snonux m: Array(1,2,3).^name.say
camelia Array
snonux m: Array(1,2,3).WHAT; 09:20
camelia ( no output )
snonux m: Array(1,2,3).WHAT.say;
camelia (Array)
snonux m: my @list = (1,2,3); say @list.WHAT; my @array = Array(@list); say @array.WHAT; 09:22
camelia (Array)
(Array)
el gatito (** advocate) m: {, a => 2, b => 1}
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Preceding context expects a term, but found infix , instead. at /home/glot/main.raku:1 ------> {,⏏ a => 2, b => 1}
snonux uhm! the @list is an array, too! 09:23
m: say (1,2,3).WHAT; my @array = Array(1,2,3); say @array.WHAT; 09:24
camelia (List)
(Array)
09:34 ab5tract joined
Nemokosch I think gfldex cleared it up perfectly 10:03
@(), $(), %() is like contextualization in Perl 10:05
Pretty sure @ turns into a .list call and % turns into a .hash call. 10:07
These methods try to make the least fuss with the input they get 10:08
lizmat $() is a call to .item 10:10
Nemokosch Not surprising, I wasn't sure 10:11
Making Scalar tightly couple two thing (interface to mutation + treating data as one element in iteration) was a mistake imo, even though this one is easy to work around 10:13
10:19 snonux left 10:20 snonux_ left 11:51 raschip joined 12:09 kjp left 12:10 kjp joined 18:35 snonux joined 18:36 snonux_ joined 19:48 Guest2085 joined 19:57 snonux left, snonux_ is now known as snonux 19:58 rantanplan joined 20:48 Guest2085 left 20:54 rantanplan left, snonux left 21:00 raschip left 21:03 rantanplan joined 21:04 snonux joined 21:27 NemokoschKiwi joined 21:40 snonux left, rantanplan left 21:44 Guest2085 joined 21:59 ab5tract left 22:32 NemokoschKiwi left 23:00 ab5tract joined 23:29 Guest2085 left