Return-Path: <John.Harrison-request@cl.cam.ac.uk>
Delivery-Date: 
Received: from cs.uidaho.edu (actually ted.cs.uidaho.edu !OR! info-hol-request@cs.uidaho.edu) 
          by swan.cl.cam.ac.uk with SMTP (PP-6.5) outside ac.uk;
          Wed, 7 Jul 1993 10:59:03 +0100
Received: by cs.uidaho.edu (16.6/2.0) id AA25352; Wed, 7 Jul 93 02:53:41 -0700
Sender: info-hol-request@cs.uidaho.edu
Errors-To: info-hol-request@cs.uidaho.edu
Precedence: bulk
Received: from ganymede.inmos.co.uk by cs.uidaho.edu (16.6/2.0) id AA25347;
          Wed, 7 Jul 93 02:53:34 -0700
Received: from frogland.inmos.co.uk by ganymede.inmos.co.uk;
          Wed, 7 Jul 93 10:53:43 BST
From: David Shepherd <des@inmos.co.uk>
Message-Id: <17818.9307070953@frogland.inmos.co.uk>
Subject: Re: automatic con(de)structors ?
To: shaw@cs.ucdavis.edu (Rob Shaw)
Date: Wed, 7 Jul 1993 10:53:14 +0100 (BST)
Cc: info-hol@cs.uidaho.edu
In-Reply-To: <9307070115.AA11787@toadflax.cs.ucdavis.edu> from "Rob Shaw" at Jul 6, 93 06:15:02 pm
X-Mailer: ELM [version 2.4 PL20]
Content-Type: text
Content-Length: 1380

Rob Shaw has said:
> If I define:
> 
> let Vstate_Axiom = define_type 
>     `Vstate`
>     `Vstate = VSTATE registers memory pc`;;
> 
> Is there anyway to get the following automatically? Perhaps something
> undocumented in contrib?
> 
> let get_regs = new_recursive_definition
>     false Vstate_Axiom `get_regs`
>    "get_regs (VSTATE regs mem pc) = regs";;
> 
> let get_mem = new_recursive_definition
>     false Vstate_Axiom `get_mem`
>    "get_mem (VSTATE regs mem pc) = mem";;
> 
> let get_pc = new_recursive_definition
>     false Vstate_Axiom `get_pc`
>    "get_pc (VSTATE regs mem pc) = pc";;
> 
> Just the obvious destructors corresponding the the type definition.

take a look at Phil Windley's datatype library ... (I think) this does
the sort of things you are wanting.

Having said this ... it doesn't seem to be in the contrib directory
at cl.cam.ac.uk ... though, it was posted on this mailing list a few
months back so you could find it by trawling through the info-hol
library. I'm afraid I don't have a copy.

--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk                     tel: 0454-616616 x 625
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
		"They didn't like the rates, they don't like the poll tax,
		 and they won't like the council tax."   - Nicholas Ridley   
