Re: [eclipse-users] Use of structured variables

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Mon, 08 Jan 2007 13:39:46 +0100
Daniel Riera wrote:
> Hello,
> 
> I am working at the moment with a set of variables related to "objects". 
> For instance,
> I can have an object Person, with member variables Age [0..100], weight 
> [1..200],
> height [20..230], etc.
> At the moment I am storing these variables in a list of lists, but I 
> would like to know
> how to do this using a structure (if possible) to improve the program 
> reading.

Hi Daniel,

You can define a structure with

     :- local struct(person(age,weight,height)).

and then access the fields with "with".

You can have a look at the manual page with

	help(struct/1).

Cheers,
Marco


-- 
Marco Gavanelli, Ph.D.
Computer Science Division
Dipartimento di Ingegneria
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel  +39-0532-97-4833
Fax  +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Mon Jan 08 2007 - 12:39:53 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST