egison-2.3.10: sample/array-test.egi
(define $ass [|[~1 2 3~]
[~4 5 6~]
[~7 8 9~]
[~10 11 12~]|])
(test (array-dimension ass))
(test (array-size 1 ass))
(test (array-size 2 ass))
(test (array-range ass))
(test (array-ref [2 2] ass))
(test (array-ref [2 3] ass))
(test (array-range? [2 3] ass))
(test (array-range? [2 4] ass))
(test (generate-array (lambda [$i1 $i2] (* (array-ref [i1 i2] ass) 2)) (array-range ass)))
(define $bss (generate-array (lambda [$i1 $i2] (* (array-ref [i1 i2] ass) 2)) (array-range ass)))
(test (array-ref [2 3] bss))
(test (match ass (Array Integer)
{[(& <cons ,[2 2] $n> <cons ,[2 3] ,(+ n 1)>) <ok>]
[_ <ko>]}))