30 Sep 2022
zacque Okay, so an array assignment to an array performs an implicit iteration? Makes sense... 11:10
Nemokosch array assignment calls .STORE
zacque If eager I meant
Nemokosch by definition
Kaiepi neat thing is if you assign a lazy iterable to an array, consume some values, then assign that to another array, it preserves any laziness left
zacque But the state remains right? Make sense...
I meant it'll follow from last "consumption" 11:11
Kaiepi yeah
zacque But I still don't get the "different Scalar containers" part
Nemokosch I'm describing it, hold on 11:12
zacque Ok, thanks
Nemokosch pls <@210313526928080896> also hold on in case I mess something up big time 😅
Kaiepi ok 😛
zacque Please take your time! Gtg, I'll be right back in about an hour... 11:13
Nemokosch 1. `my @pascal = ...` this is an "array assignment, hence calling STORE with the content on the right handside 11:14
2. because the rhs wasn't explicitly marked lazy, the content is traversed eagerly
3. the content is some Iterable that consists of the very same Array container over and over again (let me call this `gathered`
4. STORE allocates Scalar containers, the elements of the @pascal array
5. as it traverses `gathered`, it puts the elements of it (which are the same Array container over and over) into the Scalar containers
1. `my @pascal = ...` this is an "array assignment, hence calling STORE with the content on the right handside
2. because the rhs wasn't explicitly marked lazy, the content is traversed eagerly
3. the content is some Iterable that consists of the very same Array container over and over again (let me call this `gathered`)
4. STORE allocates Scalar containers, the elements of the @pascal array
5. as it traverses `gathered`, it puts the elements of it (which are the same Array container over and over) into the Scalar containers
so you end up with 11:15
@pascal - an Array container on top
the elements of @pascal - Scalar containers that you can mutate
the current contaent of the elements - the same one Array container (for all elements)
so you end up with
@pascal - an Array container on top
the elements of @pascal - Scalar containers that you can mutate
the current content of the elements - the same one Array container (for all elements)
Kaiepi pretty much 11:18
repeated `STORE`s clobber any existing containers within the array, but the wrapper remains
Nemokosch also, from what I understand (and iirc lizmat told me this), Arrays can not be decontainerized 11:21
Kaiepi the `Array` is the container and the value
Nemokosch they are like bundled
a mnemonic/mental aid to it: Scalars do have one identity while Arrays are inherently divided into pieces 11:25
I always imagine something like this for an array:
(array as in the container)
lizmat note you *can* put an Array into a container 11:26
but it will be considered a single object like any other object in a container
m: my $a = [1,2,3]; .say for $a
camelia [1 2 3]
Nemokosch a grid is made a grid by its cells, it's not a thing on its own 11:27
- unless, of course, you put the whole thing into a Scalar container 😄
okay, you were faster 😛
lizmat :-)
Nemokosch the more time you spend with it, the more logically sound it becomes 11:29
but a thorough demostration of it is still on my wanted list 11:31
yes, I know that article and it did help
but still, "more more more"
zacque Hang on, let me digest your messages 😄 12:15