Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8651735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:08:36+00:00 2026-06-12T14:08:36+00:00

I understand that some Prologs support dictionary-like associative data structures out of the box.

  • 0

I understand that some Prologs support dictionary-like associative data structures out of the box. For the implementations that do, do they support some notion of partial unification with another structure that doesn’t actually contain all of the keys?

For example, in the syntax of core.logic/miniKanren:

(run* [q]
  (== {:foo 1 :bar 2} (partial-map :foo q)))

This would return a single result where q is bound to 1.

Do Prologs give this operation or this partial structure a name?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:08:38+00:00Added an answer on June 12, 2026 at 2:08 pm

    Some Prolog systems such as Eclipse have a record notation. This can be used
    when you know in advance the possible keys of your map. But it needs
    a type declaration. The record notation is also found in Prolog decendant
    languages such as Erlang.

    The idea is very simple. You first declare
    a record type (some syntax invented here):

    :- rectype T{K1,...,Kn}.
    

    Now you can use inside your Prolog program
    records, just write (again some syntax invented here):

    ... T{F1 = V1, .., Fn = Vm} ...
    

    At compile type the record will be converted into a compound
    and can then easily be used in normal unification. The conversion
    reorders the key value pairs according to the record type
    declaration, then drops the keys and uses the positions only.
    Unused positions are replaced by annonymous variables or
    by default values if the record type declaration also
    covers this.

    ... T(W1, ..., Wn) ...
    

    Your example would work as follows:

    :- rectype myrec{foo, bar}
    
    ?- myrec{foo=1,bar=2} = myrec{foo=q}
    

    The latter query would be internally executed as:

    ?- myrec(1,2) = myrec(q,_).
    

    For more details how Eclipse does it, see for example here:
    http://www.eclipseclp.org/doc/bips/kernel/syntax/struct-1.html

    For dynamic maps where the keyset is not static you can implement
    dynamic data structures as the other post about SWI-Prolog AVL
    trees shows. Or ask your Prolog system for a handle to a specific
    data structure. Implement these with a FFI (Foreign Function Interface)
    or access these which are already bundled with the Prolog system.
    Eclipse for example bundles a couple, see “Description” section
    in the below article:
    http://www.eclipseclp.org/doc/bips/kernel/record/index.html

    Bye

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble understanding the delegate/data source methodology. I understand that they exist
i understand that some files get published to this folder in my application. i
On most common platforms (the most important being x86; I understand that some platforms
I understand that System.DirectoryServices is a layer above System.DirectoryServices.Protocols and abstracts some of the
From my reading of some android forensic articles i understand that sqlite records can
I'm translating some C# code to Delphi, I understand that(msg = TMsg): (int)msg.LParam is
This is a short question. At some point my thread understand that it should
For some reason that I don't understand, video websites do not play when using
i have some code that i am trying to recompile and understand, but i
I've in inherited some code that I'm trying to understand and any searching I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.