yorick banner




Global Index


Quick Reference

Yorick Function Reference

Instancing Data Structures

Any data type type_name - basic or defined by struct - serves as a type converter to that data type. A nil argument is converted to a scalar zero of the specified type. Keywords matching the member names can be used to assign non-zero values to individual members:
type_name() scalar instance of type_name, zero value
type_name(memb_name_1=expr_1,...) scalar type_name

The . operator extracts a member of a data structure. The -> operator dereferences a pointer to the data structure before extracting the member. For example:

struct Mesh { pointer x, y; long imax, jmax; }
mesh = Mesh(x=&xm,imax=dimsof(xm)(1),jmax=dimsof(xm)(2));
mesh.y = &ym;
mptr = &mesh;
print, mesh.x(2,1:10), mptr->y(2,1:10);