Closed GoogleCodeExporter closed 9 years ago
Added list syntax to Jiffle grammar. Unit tests for assigning empty or
initialized list to user var.
Original comment by michael.bedward@gmail.com
on 15 Jun 2011 at 12:34
Now have some unit tests where a list var is created with initial values and
then passed to a stats function. Example:
options { outside = 0; }
z = [ src[0,-1], src, src[0,1] ];
dest = max(z);
Next we want a way of adding values to an existing list. I don't want to use
class.member syntax. Could steal the "<<" operator from Ruby...
foo = [];
foo << src; // appends value of src to list foo
Could also steal the c (concatenate) function from R...
foo = c(foo, src);
Though perhaps it would be better to call it "concat"...
foo = concat(foo, src); // appends value of src to list foo
foo = concat(src, foo); // prepends value of src to list foo
Both concat and "<<" seem good to have, the latter being nicely concise.
Example, 3x3 mean filter with Jiffle...
options { outside = null; }
values = [];
for ( dy in -1:1 ) {
for ( dx in -1:1 ) {
values << src[ dy, dx ];
}
}
dest = sum( values ) / 9;
Original comment by michael.bedward@gmail.com
on 15 Jun 2011 at 12:34
Append operator "<<" working. Unit test in jaitools.jiffle.runtime.ListTest,
method appendWithOperator
On trunk (r1472)
Original comment by michael.bedward@gmail.com
on 15 Jun 2011 at 12:34
The "concat" function is working in unit tests. See
aitools.jiffle.runtime.ListTest
On trunk (r1473)
Original comment by michael.bedward@gmail.com
on 15 Jun 2011 at 12:34
Basic lists are working well enough for pixel neighbourhood operations. Later
we can add element indexing etc.
Closing this issue.
Original comment by michael.bedward@gmail.com
on 15 Jun 2011 at 12:34
Original issue reported on code.google.com by
michael.bedward@gmail.com
on 15 Jun 2011 at 12:34