Hi the list,
This appear not to be a GPC relevant question, sorry.
Cannot we define set of record?
type cellule = record x, y : integer; age : integer; end; population = set of cellule;
This does not compilate, is it a language non sens?
According to FPL:
This appear not to be a GPC relevant question, sorry.
Cannot we define set of record?
No.
type cellule = record x, y : integer; age : integer; end; population = set of cellule;
This does not compilate, is it a language non sens?
The Pascal language only allows sets of ordinal types (Integer, Char, Boolean, enumerated types). The best approximation of what you are looking for is probably a dynamic array (schema) of `cellule's:
type cellule = record x, y : integer; age : integer; end;
population ( nmax : integer ) = array [ 1..nmax ] of cellule; population_ptr = ^population;
var cellules : population ( 1000 ); plus_cellules : population_ptr;
...
new ( plus_cellules, 10000 );
GPC, however, allows to redefine the `in' operator to act between, say one `cellule' and a `population_ptr'.
operator in ( c : cellule; p : population_ptr ) = result : boolean;
begin (* cellule in population_ptr *) <some loop which calculates `result'> end (* cellule in population_ptr *);
Have fun,
Peter