- Hello,

I am trying to code a planner whose base input is a type:

type 'a problem = {

goal : 'a ;

initially : 'a ;

always : 'a list ;

operator : 'a list

}

The idea is that 'a may be either described using propositional

or predicate logic. So that it can be used to defined:

type prop_problem = Prop.expr problem

type pred_problem = Pred.expr problem

However the predicate version of the problem requires additional

fields (domain and range).

My question is: is their a way to use a "base" type and extend it

so that I can still use the "." to access all fields:

let p1 = make_pred_problem input in

let g = p1.goal in

let d = p1.domain in

...

Any other suggestion on how best to deal with this?

TIA,

Hugo F. - On Thu, Jul 31, 2008 at 08:21:44AM +0100, hmf@... wrote:
> My question is: is their a way to use a "base" type and extend it

What would be the type of a function which accessed the extended

> so that I can still use the "." to access all fields:

fields?

let f p = ignore (p.range)

val f : ?? -> unit

versus a function which didn't need to access the extended fields?

I think you should use objects for this.

Rich.

--

Richard Jones

Red Hat - Richard Jones wrote:
> On Thu, Jul 31, 2008 at 08:21:44AM +0100, hmf@... wrote:

Two functions one for each type.

>> My question is: is their a way to use a "base" type and extend it

>> so that I can still use the "." to access all fields:

>

> What would be the type of a function which accessed the extended

> fields?

>

> let f p = ignore (p.range)

>

> val f : ?? -> unit

>

> versus a function which didn't need to access the extended fields?

>

Come to think of it... I seem to gain nothing

by "extending" the structure. Base types are

different anyway.

Back to the drawing board 8-(

> I think you should use objects for this.

Don't want to use the object system because I don't know it.

>

Take way too long to learn it.

Thanks for the feedback.

Hugo F.

> Rich.

> - -----BEGIN PGP SIGNED MESSAGE-----

Hash: SHA1

On Thursday 31 July 2008 03:21:44 am hmf@... wrote:

> Hello,

>

> I am trying to code a planner whose base input is a type:

>

> type 'a problem = {

> goal : 'a ;

> initially : 'a ;

> always : 'a list ;

> operator : 'a list

> }

>

Out of curiosity, what is "always" and what is "operator"? Are they your

actions? Because if they are, I would expect them to be ('a -> 'a) list...

Peng

-----BEGIN PGP SIGNATURE-----

Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFIkZV7fIRcEFL/JewRAk3HAKCn1RwClnbtTkqDzty/ZwpmN1Nx8ACgyMdR

AQLuxpIG4HitPLYhf7V0H2k=

=rta/

-----END PGP SIGNATURE----- - Hi,

Peng Zang wrote:> -----BEGIN PGP SIGNED MESSAGE-----

The 'a are either propositional logic formula or first order logic formula.

> Hash: SHA1

>

>

> On Thursday 31 July 2008 03:21:44 am hmf@... wrote:

>> Hello,

>>

>> I am trying to code a planner whose base input is a type:

>>

>> type 'a problem = {

>> goal : 'a ;

>> initially : 'a ;

>> always : 'a list ;

>> operator : 'a list

>> }

>>

>

> Out of curiosity, what is "always" and what is "operator"? Are they your

> actions? Because if they are, I would expect them to be ('a -> 'a) list...

>

Always - consists of a set of 'a formula (must always be true),

Operator - set of operators (encoded as state transitions). Each

operator is nothing but an 'a formula.

These formula are then used to "solve" the planning problem.

Hugo F.

> Peng

http://www.connettivo.net/cntprojects/ocaml_beginners/

> -----BEGIN PGP SIGNATURE-----

> Version: GnuPG v2.0.7 (GNU/Linux)

>

> iD8DBQFIkZV7fIRcEFL/JewRAk3HAKCn1RwClnbtTkqDzty/ZwpmN1Nx8ACgyMdR

> AQLuxpIG4HitPLYhf7V0H2k=

> =rta/

> -----END PGP SIGNATURE-----

>

> ------------------------------------

>

> Archives up to December 31, 2007 are also downloadable at

> The archives of the very official ocaml list (the seniors' one) can be found

at http://caml.inria.fr

> Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo!

Groups Links

>

>

>

>