CMU Artificial Intelligence Repository
Jean Vaucher's implementation of structures in Prolog.
lang/prolog/code/ext/vaucher/
This package is taken from Vaucher's Software P&E article. It
provides a set of primitive predicates and operators that allow the
arguments of Prolog structures to be accessed by name rather than
position, like Lisp-style property lists. This improves the
readability and maintainability of Prolog programs.
Examples:
---------
?- def_record( person(name,age,address) ).
Define a template for the 'person' structure.
?- inst( person, P ),
field( P..name, 'Matthew Latner Linton' ),
field( P..name, Z ).
Create a 'person' in P, set its name, and unify that name with Z.
?- def_record( address(number,street,town) ).
Template for the 'address' structure.
?- inst( address, A ),
inst( person, P ),
field( P..address, A ),
field( P..age, 25 ),
field( P..address..street, 'St. Peter's Street' ).
field( P..address..town, 'Hanningtown' ).
Create an address A and person P, and set some fields.
?- inst( person, P ),
field( P..name, 'Fred' ), field( P..age, 25 ),
update( P..name, 'Bert', P2 ).
Create a person, and use 'update' to make a modified copy.
Origin:
src.doc.ic.ac.uk:packages/prolog-pd-software/ (146.169.2.1)
as vaucher.tar.Z
Version: 15-AUG-89
Ports: Edinburgh-compatible Prologs
CD-ROM: Prime Time Freeware for AI, Issue 1-1
Author(s): Jean G. Vaucher
De'partement d' informatique et R.O.
Universite' de Montre'al
Keywords:
Authors!Vaucher, Prolog!Code, Prolog!Extensions,
Property Lists, Structures, Univ. of Montreal
References:
Jean G. Vaucher, "Record manipulation in Prolog" Short Communication,
Software -- Practice and Experience 19(8):801-807, August 1989.
Last Web update on Mon Feb 13 10:33:39 1995
AI.Repository@cs.cmu.edu