Re: A small problem about PROLOG.

"Richard A. O'Keefe" <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 3/09/2013, at 1:07 AM, pdos_96 wrote:
> 
> I was doing a PROLOG program in which part of the data is very
> time-consuming calculations. So I think now it is cached.
> But I'm looking for the corresponding function did not find the
> appropriate function.

*What* Prolog program?
What do you mean part of the *data* (the words and numbers *given*
to you, "do, dare, dedi, datum; the Latin verb 'to give'") is
*calculations*?
*What* calculations?
Now you think *what* is cached?
Cached *where*?
Cached *by what*?
"Corresponding function": function corresponding to *what*?
> 
> I need to term and cache data binding.

I have a suspicion that you are asking for a "weak hash table",
which Prolog doesn't actually have.

> assert does not comply with my request, because I saved this forever.
> recordz need a KEY, KEY and this can not be a term.

The key given to recordz *must* be a term; there is nothing else
for a data value in Prolog to be. To be an argument of a predicate
is to be a term.
> 
> So I now how to do it?

Do *what*?

You haven't told us anything whatever about the nature of your
calculations.  The odds are high that that a straightforward
reorganisation of the way the data flow will be sufficient to
obtain adequate performance, and that the programming principles
required will be language-independent.

Just yesterday I spent an hour explaining to a student how an
order N**2 query could be reorganised to be order N.  The
language he was using wasn't Prolog, and the technique was
entirely language-independent.

Can you describe what the calculations are *without* using any
programming language?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.