Matrix-type-friendly syntax and more
bearophile
bearophileHUGS at lycos.com
Tue Oct 11 01:06:29 PDT 2011
Don:
> That's true, IF you are happy to have it as a feature which can only be
> used in user-defined types. If you want it apply to built-in arrays as
> well, the effort is immense.
This is not wonderful, but for me it's acceptable. Having that syntax support only for user defined types is quite better than having to use a syntax like stride(...) suggested by someone else.
-------------
For a simple but nice usage example of strides in Chapel language see pages 14-33 here:
http://chapel.cray.com/tutorials/SC10/M10-8-Samples.pdf
Strided grid description
var cell_centers = [1..7 by 2, 1..5 by 2];
var vertical_edges = [0..8 by 2, 1..5 by 2];
var horizontal_edges = [1..7 by 2, 0..6 by 2];
var vertices = [0..8 by 2, 0..6 by 2];
(See the slides for more info.)
Bye,
bearophile
More information about the Digitalmars-d
mailing list