array

@

create array from given block, by reducing/calculating all internal values


Parameters

array source :any

Attributes

of:integer, :blockinitialize an empty n-dimensional array with given dimensions

Returns

  • :block

Examples

copy
none: @[] ; none: [] a: @[1 2 3] ; a: [1 2 3] b: 5 c: @[b b+1 b+2] ; c: [5 6 7] d: @[ 3+1 print "we are in the block" 123 print "yep" ] ; we are in the block ; yep ; => [4 123]

copy
; initializing empty array with initial value x: array.of: 2 "done" inspect.muted x ; [ :block ; done :string ; done :string ; ]

copy
; initializing empty n-dimensional array with initial value x: array.of: [3 4] 0 ; initialize a 3x4 2D array ; with zeros ; => [[0 0 0 0] [0 0 0 0] [0 0 0 0]]

Related