Closed JordanCheney closed 9 years ago
I think the issue is that you're trying to modify a global variable. Try it in a local scope:
{
array := ($ 0.f32XY 2)
(array 0) :<- (f32XY 1 2 2 1)
(array 1) :<- (f32XY 1 2 1 1)
array
}
Ok here is an example that has a few issues-
init :=
(mat-1 mat-2) :->
{
mat-1.(set 0.01)
; mat-2.set-zero ; Uncomment this for different results!
}
allocate :=
() :->
{
array := ($ 0.f32XY 2)
(array 0) :<- (f32XY 1 2 2 1)
(array 1) :<- (f32XY 1 2 2 1)
array
}
mre :=
(i) :->
{
array-1 := (allocate)
array-2 := (allocate)
(init (array-1 0) (array-2 0))
(? (< i 2) (array-1 i) (array-2 (% i 2)))
}
Array 1 results
(mre 0)
(mre 1)
Array 2 results
(mre 2)
(mre 3)
So on the initial run array-2 is set to 0.01 even though it shouldn't be set to anything. If you uncomment the line in init you can see that everything is set to 0.
Well I've been able to reduce it down to:
{
a := 0.f32XY.$
a :<- (f32XY 1 2 2 1)
b := 0.f32XY.$
b :<- (f32XY 1 2 2 1)
a.(set 1)
b.(set 0) ; Uncomment this for different results!
a
}
@jklontz I'm on my way to a minimum reproducing example of the array allocation issue and I'm running into a different issue-
This is throwing an error-
Abort trap: 6
I'm sure this is related to a syntax error but I'm not sure what it is. Any insights?