I am struggling with levels and #
, if I understand this I think I will be able to grasp the entire concept.
Apply[#1 &, {envelope[1, order["sku1", 5, 10, 4.98]],
envelope[2, order["sku2", 3, 67, 98]]}, {1}]
{1,2}
This makes perfect sense.
Keeping everything els equal but changing the slot to #2
:
{order["sku1", 5, 10, 4.98], order["sku2", 3, 67, 98]}
This makes also perfect scence.
Then I am going back to #1
but now at level 2
{envelope[1, "sku1"], envelope[2, "sku2"]}
Why do I get this output I was only expecting Sku1
and Sku2
.
I also wonder why Depth in this case equals 4, but if I put level 3 I get the entire list?
I know this is very simple but I have been struggling with seeing the logic.
I have spent quite a lot of time trying to grasp this so please try make it as clear as possible. And If you do not understand the question or think it is poorly explained give me a comment before downgrading the question.
Apply
than theLevels
which is well answered by Murta. $\endgroup$