(loop with x = (make array 6 :fill-pointer 0)
for i from 0 to 10 by 2 do (vector-push i x)
finally return x)
Actually, the finally clause needs to be (return x) instead.
But if you already assume you know the size of the final array, you can dispense with the fill pointer and extension and just set it directly:
(loop with x = (make array 6)
for val from 0 to 10 by 2
as index upfrom 0
do (setf (aref x index) val)
finally return x)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 374 |
Nodes: | 16 (3 / 13) |
Uptime: | 129:36:55 |
Calls: | 7,956 |
Calls today: | 1 |
Files: | 13,008 |
Messages: | 5,812,854 |