<HTML> <HEAD> <!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 --> <LINK rel="stylesheet" href="ciao.css" type="text/css"> <TITLE>The Ciao Prolog System - Dictionaries</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_67.html">previous</A>, <A HREF="ciao_69.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC297" HREF="ciao_toc.html#TOC297">Dictionaries</A></H1> <P> <A NAME="IDX4291"></A> <P> <STRONG>Author(s):</STRONG> The CLIP Group. <P> <STRONG>Version:</STRONG> 1.9#240 (2003/12/22, 18:52:17 CET) <P> This module provides predicates for implementing dictionaries. Such dictionaries are currently implemented as ordered binary trees of key-value pairs. <UL> <LI><A HREF="ciao_68.html#SEC298">Usage and interface (dict)</A> <LI><A HREF="ciao_68.html#SEC299">Documentation on exports (dict)</A> </UL> <H2><A NAME="SEC298" HREF="ciao_toc.html#TOC298">Usage and interface (<CODE>dict</CODE>)</A></H2> <div class="cartouche"> <UL> <LI><STRONG>Library usage:</STRONG> <CODE>:- use_module(library(dict)).</CODE> <LI><STRONG>Exports:</STRONG> <UL> <LI><EM>Predicates:</EM> <A NAME="IDX4292"></A> <CODE>dictionary/5</CODE>, <A NAME="IDX4293"></A> <CODE>dic_node/2</CODE>, <A NAME="IDX4294"></A> <CODE>dic_lookup/3</CODE>, <A NAME="IDX4295"></A> <CODE>dic_lookup/4</CODE>, <A NAME="IDX4296"></A> <CODE>dic_get/3</CODE>, <A NAME="IDX4297"></A> <CODE>dic_replace/4</CODE>. <LI><EM>Properties:</EM> <A NAME="IDX4298"></A> <CODE>dictionary/1</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC299" HREF="ciao_toc.html#TOC299">Documentation on exports (<CODE>dict</CODE>)</A></H2> <P> <A NAME="IDX4299"></A> <A NAME="IDX4300"></A> <DL> <DT><span class="define">PROPERTY:</span> <B>dictionary/1:</B> <DD><A NAME="IDX4301"></A> <P> <STRONG>Usage:</STRONG> <CODE>dictionary(D)</CODE> <UL> <LI><EM>Description:</EM> <CODE>D</CODE> is a dictionary. </UL> </DL> <P> <A NAME="IDX4302"></A> <A NAME="IDX4303"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dictionary/5:</B> <DD><A NAME="IDX4304"></A> <P> <STRONG>Usage:</STRONG> <CODE>dictionary(D, K, V, L, R)</CODE> <UL> <LI><EM>Description:</EM> The dictionary node <CODE>D</CODE> has key <CODE>K</CODE>, value <CODE>V</CODE>, left child <CODE>L</CODE>, and right child <CODE>R</CODE>. </UL> </DL> <P> <A NAME="IDX4305"></A> <A NAME="IDX4306"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dic_node/2:</B> <DD><A NAME="IDX4307"></A> <P> <STRONG>Usage:</STRONG> <CODE>dic_node(D, N)</CODE> <UL> <LI><EM>Description:</EM> <CODE>N</CODE> is a sub-dictionary of <CODE>D</CODE>. <LI><EM>Calls should, and exit will be compatible with:</EM> <CODE>D</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) <CODE>N</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) </UL> </DL> <P> <A NAME="IDX4308"></A> <A NAME="IDX4309"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dic_lookup/3:</B> <DD><A NAME="IDX4310"></A> <P> <STRONG>Usage:</STRONG> <CODE>dic_lookup(D, K, V)</CODE> <UL> <LI><EM>Description:</EM> <CODE>D</CODE> contains value <CODE>V</CODE> at key <CODE>K</CODE>. If it was not already in <CODE>D</CODE> it is added. <LI><EM>Calls should, and exit will be compatible with:</EM> <CODE>D</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) </UL> </DL> <P> <A NAME="IDX4311"></A> <A NAME="IDX4312"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dic_lookup/4:</B> <DD><A NAME="IDX4313"></A> <P> <STRONG>Usage:</STRONG> <CODE>dic_lookup(D, K, V, O)</CODE> <UL> <LI><EM>Description:</EM> Same as <CODE>dic_lookup(D,K,V)</CODE>. <CODE>O</CODE> indicates if it was already in <CODE>D</CODE> (<CODE>old</CODE>) or not (<CODE>new</CODE>). <LI><EM>Calls should, and exit will be compatible with:</EM> <CODE>D</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) </UL> </DL> <P> <A NAME="IDX4314"></A> <A NAME="IDX4315"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dic_get/3:</B> <DD><A NAME="IDX4316"></A> <P> <STRONG>Usage:</STRONG> <CODE>dic_get(D, K, V)</CODE> <UL> <LI><EM>Description:</EM> <CODE>D</CODE> contains value <CODE>V</CODE> at key <CODE>K</CODE>. Fails if it is not already in <CODE>D</CODE>. <LI><EM>Calls should, and exit will be compatible with:</EM> <CODE>D</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) </UL> </DL> <P> <A NAME="IDX4317"></A> <A NAME="IDX4318"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>dic_replace/4:</B> <DD><A NAME="IDX4319"></A> <P> <STRONG>Usage:</STRONG> <CODE>dic_replace(D, K, V, D1)</CODE> <UL> <LI><EM>Description:</EM> <CODE>D</CODE> and <CODE>D1</CODE> are identical except for the element at key <CODE>K</CODE>, which in <CODE>D1</CODE> contains value <CODE>V</CODE>, whatever has (or whether it is) in <CODE>D</CODE>. <LI><EM>Calls should, and exit will be compatible with:</EM> <CODE>D</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) <CODE>D1</CODE> is a dictionary. (<CODE>dict:dictionary/1</CODE>) </UL> </DL> <P><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_67.html">previous</A>, <A HREF="ciao_69.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>