local reference(+Name)

From: Ulrich Scholz <ulrich.scholz_at_eml-d.villa-bosch.de>
Date: Wed 16 Mar 2005 03:33:20 PM GMT
Message-ID: <20050316153320.GC1466@eml-d.villa-bosch.de>
Hi everybody.

I have two suggestions about references:


1) Currently, one can create a named reference with

    local reference(+Name).

that holds a reference to a term in the same way as a logical variable.  I
would appreciate a local reference that can be used by handle.

Background: My program creates (something very similar to) Prolog clauses.
Some predicates of these clauses have results that are collected and used by
the final predicate of the clause.  As the generated clauses use disjunction
and their structure and complexity is arbitrary, it is hard (although not
impossible) to generate variables and code in order to collect the single
results.  It is much simpler to use a handle to a logical variable.

Example: Instead

    p(Result) :- p1([], L1), (p2(L1, L2) ; p3(L1, L2)), finalize(L2, Result).

where L1, L2, ... are lists and the p1, p2, ... append their result to this
list, I write

    p(Result) :- setup(L), p1(L), (p2(L) ; p3(L)), finalize(L, Result).

where L is a logical reference that gets read and overwritten by the
predicates p1, p2, ...

As the number of generated clauses is arbitrary, I cannot use predefined
named references.

By now, I use a hash table with a single entry.


2) Maybe you should separate the description of named references from the
description bags and stores in the user manual because the name of their
"group" refers to non-logical predicates explicitly.


All the best, Uli
-- 
Ulrich Scholz

Personal Memory Group
European Media Laboratory GmbH
Received on Wed Mar 16 16:31:45 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:34 PM GMT GMT