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:20
Manifest0 left
03:05
mcmillhj left
03:09
sjn left
03:19
sjn joined
04:19
Summer joined
05:49
Summer left
06:17
Summer joined
06:39
teatime left
06:41
teatime joined
08:12
Summer left
08:55
Manifest0 joined
08:58
Summer joined
09:08
dakkar joined
|
|||
librasteve | m: my @a = 1,2,3; my @b := 1..3; say (@a eqv @b); | 12:46 | |
Raku eval | False | ||
librasteve | m: my @a = 1,2,3; my @b := 1..3; say (@a.list eqv @b.list); | 12:47 | |
Raku eval | False | ||
lizmat | m: my @b := 1..3; dd @b | ||
camelia | 1..3 | ||
librasteve | m: my @a = 1,2,3; my @b := 1..3; say (@a.flat eqv @b.flat); | ||
Raku eval | True | ||
lizmat | m: my @b := 1..3; dd @b.^name | ||
camelia | "Range" | ||
lizmat | librasteve in your examples, @b is *not* an Array, but a Range | 12:48 | |
m: my @b := 1..3; dd @b.list | |||
camelia | (1, 2, 3) | ||
librasteve | yeah - I was using a Range as a shorthand for any lazy generator ... | ||
lizmat | m: my @a = 1,2,3; dd @a.^name | ||
camelia | "Array" | ||
lizmat | m: my @a = 1,2,3; dd @a.list.^name | 12:49 | |
camelia | "Array" | ||
lizmat | .list on Arrays returns the invocant | ||
m: my @a = 1,2,3; dd @a.List.^name | |||
camelia | "List" | ||
lizmat | if you really want a List, you need to coerce to List | ||
m: my @a = 1,2,3; my @b := 1..3; say (@a.List eqv @b.List); | |||
camelia | True | ||
librasteve | m: my @a = 1,2,3; my @b := 1..3; say (@a eq @b); | 12:50 | |
Raku eval | True | ||
librasteve | oh - so eqv does a match on type also | ||
lizmat | that's just comparing stringification of @a and @b | ||
yes, otherwise it's not equivalent | |||
librasteve | xx.List is it then | 12:52 | |
tx! | |||
lizmat | if you're working with large arrays, then you can use @a.List(:view) | 12:58 | |
by which you're saying that you won't change the array for the lifetime of the List | 12:59 | ||
16:00
swaggboi left
16:13
swaggboi joined
17:29
dakkar left
18:30
mcmillhj joined
|
|||
mcmillhj | Can a `sub` that is a class attribute be scoped under that class? i.e. with access to `self` | 18:31 | |
for example, `Direction.new(x => 0, y => -1, bound => sub { self.y > 0 })` | 18:32 | ||
nemokosch | I think it should be declared as a method for starters | 18:33 | |
mcmillhj | yep, that makes a lot of sense. Still not used to methods existing tbf | 18:39 | |
19:28
Summer left,
Summer joined
19:59
Summer left,
Summer joined
20:29
Summer left
20:30
Summer joined
21:00
Summer left,
Summer joined
21:31
Summer left,
Summer joined
21:57
mcmillhj left
22:01
Summer left
22:02
Summer joined
22:32
Summer left,
Summer joined
23:03
Summer left,
Summer joined
23:33
Summer left
23:34
Summer joined
23:57
mcmillhj joined
|
|||
mcmillhj | sorry for the deluge of questions over the past few days. I have another one though :) | 23:57 | |
I have a class called Point that is stored in an Array and then sorted. `my Point @points = [...];`. I know that sort returns a Seq but it looks like all the type information gets erased. Is there someway to get a Seq[Point] from `.sort`? | 23:59 |