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:50 jaguart joined 01:47 MasterDuke joined 02:16 tea3po joined 02:17 explorer left 02:20 teatwo left 02:33 MasterDuke left 03:11 deoac joined
deoac In this program, why does is the error reported as being on line 1? 03:12
#! /usr/bin/env raku
use v6.d;
sub MAIN (Str $? where .lc eq 'test', Bool :$test) {
    say 'Hello';
}
Use of uninitialized value of type Str in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at mail.raku line 1
Use of uninitialized value of type Str in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at mail.raku line 1
Usage:
  mail.raku [--test] [<Str where { ... }>]
I understand the error, but not the 'line 1' part 03:13
03:23 Heptite left 04:17 tea3po left, tea3po joined 04:28 tea3po left 04:29 tea3po joined 05:22 jaguart left 06:40 jaguart joined 06:44 jaguart left
Nemokosch What line number do you expect? 07:23
rcmlz Hello, I have a questing related to typing I can not solve. 09:22
m: my @not_typed = ( ("A", "B"), ("X",), () ); my @list_of_list of List = ( ("A", "B"), ("X",), () );
Raku eval
rcmlz works fine, but I can not workout how I can fix not the type of the inner list elements 09:23
m: my constant Universum = "A".."Z"; my @list_of_list_of_elements_of_universum of List of Universum = ( ("A", "B"), ("X",), () ); 09:24
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku List cannot be parameterized at /home/glot/main.raku:2 ------> ements_of_universum of List of Universum⏏ = (
rcmlz Is there a way in Raku to also type data structures like Array of Arrays or List of Lists? Thank you. 09:25
Nemokosch well, as it says, List cannot be parameterized. Array can. 09:27
I'm not sure how much this is an official stance but List is much like just a skeleton type, even though it's not an abstract class 09:30
the same metadata that gives Array the mutability for all items, gives the typing info as well 09:31
having said that, I'm not sure it would work with Array because type deduction doesn't really happen on literals 09:32
and Universum is really just a Range value, not a type. However, these pieces can be put together using custom runtime checks 09:36
rcmlz Thanky ou @Nemokosch for the hint. I am nearly there 09:41
m: my subset Universum of Int where {$_ > 1}; # two steps my @list_of_elements_of_universum1 of Universum = [2, 2]; my @list_of_elements_of_universum2 of Universum = [3, 3]; my @list_of_lists_of_elements_of_universum1 of Array of Universum; push @list_of_lists_of_elements_of_universum1, @list_of_elements_of_universum1, @list_of_elements_of_universum2; # single steps my
@list_of_lists_of_elements_of_universum2 of Array of Universum = [ @list_of_elements_of_universum1, @list_of_elements_of_universum2 ]; # single steps - manual entry my @list_of_lists_of_elements_of_universum3 of Array of Universum = [ [2, 2], [3, 3] ];
Raku eval Exit code: 1 Type check failed in assignment to @list_of_lists_of_elements_of_universum3; expected Array[Universum] but got Array ([2, 2]) in block <unit> at main.raku line 17
Nemokosch m: my constant Universum = "A".."Z"; subset InUniversum of Str where Universum; subset ListOfListOfUniversum of List where { .all ~~ List && .all.all ~~ InUniversum }; my @list_of_list_of_elements_of_universum is ListOfListOfUniversum = ( ("A", "B"), ("X",), () ); 09:42
Raku eval Exit code: 1 You cannot create an instance of this type (ListOfListOfUniversum) in block <unit> at main.raku line 4
Nemokosch bruh 09:43
I was just trying to make a constraint for it 😩
rcmlz The last step is not working - I like to use this sort of direct specification of an array of arrays in tests, so would be handy to be able to do it directly
Nemokosch ^
that is really just an Array with two arbitrary values for all the compiler cares 09:44
rcmlz ok, then I will do that in two steps. I had the hope that the compiler works out that e.g. [2, 2] is an array of elements of the universum. # single steps - manual entry - failing my @list_of_lists_of_elements_of_universum3 of Array of Universum = [ [2, 2], [3, 3] ]; 09:46
Thank you for the help. 09:47
Nemokosch my constant Universum = "A".."Z"; subset ListOfListOfUniversum of List where { .all ~~ List && .all.all (elem) Universum }; this constraint seems to work, it's kinda strict even 09:52
rcmlz Thank you. I guess I will go for the simpler 2-step-Array-approach. 10:08
Nemokosch the assignments perform the type checks, from what I know 10:15
however, sadly they go top-down
without recursing
so "it says Array[Int] but all I see is a literal [1, 2, 3] - nah, that won't cut it" 10:16
10:29 habere-et-disper joined
habere-et-disper How do I seach for a relevant method on the REPL? If I try to grep over what's available I get a mess: 10:43
m: [].^methods.grep( 'lazy' )
camelia Method object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
Method object coerced to string (…
habere-et-disper Okay this seems better: 10:45
m: [].^methods.gist.words.grep( / lazy / )
camelia ( no output )
habere-et-disper m: [].^methods.gist.words.grep( / lazy / ).say
camelia (is-lazy lazy-if lazy)
lizmat ^methods.map(*.name).... 10:51
^methods>>.name 10:52
habere-et-disper Thanks lizmat ! I just discovered that you can chain the sequence operator ! So cool: 10:58
m: ( 0 ... 10 ... 1 ).say
camelia (0 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1)
11:10 Heptite joined 11:41 Heptite left 11:48 Heptite joined 11:58 habere-et-disper left 12:58 habere-et-disper joined 13:33 lizmat left 13:46 habere-et-disper left 14:04 lizmat joined 14:05 Heptite left 14:14 tea3po left, tea3po joined 14:15 tea3po left, tea3po joined 14:16 tea3po left, tea3po joined 14:17 tea3po left, tea3po joined 14:23 tea3po left 14:24 tea3po joined 14:38 deoac left 15:19 Heptite joined 19:40 deoac joined 20:47 deoac left
gfldex m: say "▁" ... "█"; 21:48
camelia (▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
gfldex m: say '🂡' ... '🃞'; 21:49
camelia (🂡 🂢 🂣 🂤 🂥 🂦 🂧 🂨 🂩 🂪 🂫 🂬 🂭 🂮 🂯 🂰 🂱 🂲 🂳 🂴 🂵 🂶 🂷 🂸 🂹 🂺 🂻 🂼 🂽 🂾 🂿 🃀 🃁 🃂 🃃 🃄 🃅 🃆 🃇 🃈 🃉 🃊 🃋 🃌 🃍 🃎 🃏 🃐 🃑 🃒 …
gfldex m: say ('🂡' ... '🃞').pick; # :-> 21:50
camelia 🃌
gfldex Chaining infix:<...> is specced in S03-sequence/misc.t and thus an ENODOC. In fact, that operator deserves it's own website. 21:54
Nemokosch or alternatively, it deserves to be simplified to a level that mere mortals can comprehend 22:00
m: say 3 ... ^6 22:02
Raku eval (3 2 1 0 1 2 3 4 5)
22:42 Heptite left