[eclipse-clp-users] structures - how would you implement associations between different 'types' of structures.

From: Samuel Bayliss <samuel.bayliss_at_...6...>
Date: Tue, 24 Feb 2009 18:23:31 +0000
Dear All.

Newbie question.

I'm a bit bewildered as to style when building some data structures in my
first eclipse program...

I have a list of 'command' structures defined with the

            :- export struct(
                    command(type,time,bank)
                ).

Early in the program, the type and bank variables for structures contained
in my command list are grounded and no backtracking occurs over these. The
time variable remains unbound (this is a scheduling program).

Some of the command variables in my program have additional information
attached to them - i.e. read commands are commands, but have associated
information (which row and column to start reading from and how long a burst
to read for), activate and precharge commands have row information, but no
burst length information.

Essentially these command variables have types, I'm trying to associate
extra information with each variable according to it's type. It's akin a
problem I'd solve with inheritance in an object oriented imperative
language. I'm guessing this is a pretty common pattern people face.

How do people go about implementing this kind of pattern in Prolog/Eclipse -
I suspect that the inherited structures syntax in eclipse nearly does what I
want, but will create a lot of unbound variables I don't care about and the
attributed variable implementation sounds similarish, but seems overkill.

Thanks in advance.

Sam
Received on Tue Feb 24 2009 - 18:23:42 CET

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