Jump to content

Multi-dimensional array: Difference between revisions

m
(→‎{{header|Quackery}}: now has nest-of-nest and row-major.)
Line 2,321:
<code>->[a]</code> is the converse operation; it takes a number and a layout, and returns a specifier.
 
To determine the number of items in an array from its layout, use <code>1 swap witheach *</code>
Given a layout rather than a specifier, <code>->[a]</code> will return the number of items in the array. Note that in the nest-of-nests version arrays do not carry their layouts with them, so you would need to keep a note of the layout of an array somewhere if that functionality is required (i.e for the following example use.)
 
Given a layout rather than a specifier, <code>->[a]</code> will return the number of items in the array. Note that in the nest-of-nests version arrays do not carry their layouts with them, so you would need to keep a note of the layout of an array somewhere if thatit functionalitywill isbe required (i.e for the following example use.)
 
An example use for these would be using a <code>times</code> loop to iterate through every item of a multidimensional array without requiring nested <code>times</code> loops.
1,462

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.