Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Very interesting.

So far it looks like there are two possibilities -- store your 'database' in a database, or store it in some kind of HoH & meta-data store. You have the additional complication of 'duplication', re: the book you gave merlyn is later given to kudra.

I'm not that familiar with Prolog but it seems that you would need to specify that the book has the attribute 'real -- cannot be given to more than one person at once' (which reminds me of a software company's license -- but I digress) as opposed to 'imaginary -- can be given to as many people as you like' (directions, blessing, a kiss).

Getting back to the database/data & metadata discussion, I'd probably lean towards the second choice simply because you could model it with OO to enforce a certain way of storing the data .. among other things, this would allow you to enforce the 'can only be given once' rule mentioned in the previous paragraph.

Doing this in some kind of matrix arrangement also seems intuitively obvious .. your example suggests you'd want to check a three-dimensional matrix or take a two dimensional slice of a 3D matrix. Naturally in the implementation you'd want a few more dimensions than that.

Finally, as far as persistence is concerned, it should be possible to dump the 'workspace' (to use an APL term) then be able to load it back up when the next session starts. I haven't used Data::Dumper but it sounds like it would be right for the job.

--t. alex

"Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
--Michael Flanders and Donald Swann

In reply to Re: Choosing a data structure for AI applications by talexb
in thread Choosing a data structure for AI applications by Ovid

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2019-05-21 08:44 GMT
    Find Nodes?
      Voting Booth?
      Do you enjoy 3D movies?

      Results (131 votes). Check out past polls.

      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!