🦋 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.
hythm :m say v0.2.1 cmp v0.2 08:58
tellable6 2023-08-12T14:55:15Z #raku <tbrowder__> hythm thanks! i’ll try that
hythm m: say v0.2.1 cmp v0.2 08:59
camelia More
hythm m: v0.2.1 ~~ v0.2 ## is this intentional?, no need for `+` like v0.2+ 09:00
camelia ( no output )
hythm m: say v0.2.1 ~~ v0.2
camelia True
jdv www.youtube.com/watch?v=9J0vCQ36020 (again) 12:36
nemokosch see, immediate mumbling about Perl in the comment section 12:42
but who is this moustache showman? 12:44
saw a reference to Dreamberd in the chat, that's not a good sign xd 12:48
tbrowder__ tis me again, asking about best practice for raku and zef on a mult-user system 17:06
can anyone see any reason for root to need zef? 17:11
or even raku? 17:13
i can see using them for scripts for managing the system (in place of bash scripts). 17:16
so, then how is the best way to set the paths for root? 17:29
gfldex tbrowder__: gist.github.com/gfldex/463657030fc...078243fb80 18:21
Xliff How can I type the key of the hash as a type object? 18:36
Especially if I want to type a $ sigiled hash value...
lizmat m: my %h{Str:U} = ::("Str") => 42; dd %h 18:38
camelia Hash[Any,Str:U] %h = (my Any %{Str:U} = (Str) => 42)
lizmat m: my %h{Any:U} = ::("Str") => 42, ::("Int") => 666; dd %h 18:39
camelia Use of uninitialized value of type Int in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at <tmp> line 1
Use of uninitialized value of type Str in string context.
Me…
lizmat m: my %h{Any:U} = ::("Str") => 42, ::("Int") => 666; dd %h.keys
camelia (Int, Str).Seq
Xliff And if I need it as $h?
^^ lizmat 18:41
lizmat m: my $h := Hash[Any,Any:U].new( ::("Str") => 42, ::("Int") => 666 ); dd $h.keys
camelia (Int, Str).Seq
Xliff Ah! Thanks! 18:42
m: Hash.HOW.^name.say
camelia Perl6::Metamodel::ClassHOW+{<anon>}
lizmat my Int %h{Str} is just short for my %h := Hash[Int,Str].new
Xliff So is Hash a Parametric Role masquerading as an object, then? 18:43
lizmat no, actually it has a ^parameterize method in its HOW
which does the correct mixins 18:44
Xliff Ah!
So you can have parametric classes in Raku if you know the right secret ingredients?
lizmat github.com/rakudo/rakudo/blob/main...#L436-L478
nemokosch is this parametrisation role-only? 19:06
lizmat see: github.com/rakudo/rakudo/blob/main...h.pm6#L486 19:09
Xliff Wait... Pairs are immutable? 19:17
m: my $a = Pair.new('a', 0); $a.value = 1; $a.gist.say 19:18
camelia Cannot modify an immutable Int (0)
in block <unit> at <tmp> line 1
Xliff What's a Mutable pair?
Is there a Mutable version of Pair? 19:19
teatwo that error message makes it sound like it's the Int not the Pair that is immutable; not that I understand it 19:20
Xliff m: DateTime.now.Date.succ.say 19:21
camelia 2023-08-21
teatwo I guess because "It is worth noting that when assigning a Scalar as value of a Pair the value holds the container of the value itself. This means that it is possible to change the value from outside of the Pair itself:" and you have a literal 0 19:22
?
nemokosch Pairs aren't strictly immutable 19:28
they are as immutable as a List, basically
the key is immutable, the value can be a container
tbrowder__ gfldex: thanks so much 19:31
nemokosch so teatwo is on the right track
lizmat teatwo: correct so Pairs are not value types, just likes Lists aren't, as nemokosch noted 19:52
tbrowder__ another raku inst question (for rakudo-pkg installations): what is the purpose of the var/zef/bin/zef executable? 20:00
librasteve I often like to refer to the typegraph - this one shows how Pair and Map and Hash relate via the Associative role, but that Pair does not do Iterable docs.raku.org/assets/typegraphs/Associative.svg 20:42
tbrowder__ one more raku inst question: anything wrong with making a symlink from /opt/rakudo-pkg/bin/raku to /usr/local/bin/raku? 21:54
my questions are from discussions on debian users list about how to best handle raku and paths for a normal user as well as root 21:57
Voldenet I simply add /opt/rakudo/bin to my PATH 22:01
works on debian
has nice added bonus of also providing nqp and moar