i am new with apple dylan and I can't find in the net what is the syntax of Arrays and Dylan.I'll be glad, if you give me some examples too. Thank you very much for your attention!
Asked
Active
Viewed 191 times
1 Answers
2
It's defined in the Dylan Reference Manual (Expressions): #[1, 2, 3]
for a literal vector (in Dylan, the class <vector>
is a one-dimensional array).
The literal syntax is only valid if there are literal values inside, otherwise:
let foo = 20;
let arr = vector(foo, foo, foo);
or
let arr = make(<vector>, size: 10, fill: 200);
Access for a specific element is done with the generic function element
, which has some syntactic sugar:
let 1st-element = arr[0]; // equivalent to let 1st-element = element(arr, 0)
arr[1] := 10; //equivalent to element-setter(10, arr, 1)

Chris Page
- 18,263
- 4
- 39
- 47

Hannes
- 96
- 1