YAP
7.1.0
tries.yap
Go to the documentation of this file.
1
/**
2
* @file tries.yap
3
* @author Ricardo Rocha
4
*
5
* @brief YAP tries interface
6
*
7
*
8
*/
9
/****************************************
10
File: tries.yap
11
Author: Ricardo Rocha
12
Comments: Tries module for Yap Prolog
13
version: $ID$
14
****************************************/
15
16
:- module(
tries
, [
17
trie_open/1,
18
trie_close/1
,
19
trie_close_all/0
,
20
trie_empty/1,
21
trie_mode/1
,
22
trie_put_entry/3,
23
trie_check_entry/3
,
24
trie_get_entry/2
,
25
trie_get_first_entry/2,
26
trie_get_last_entry/2,
27
trie_traverse/2,
28
trie_traverse/3,
29
trie_remove_entry/1
,
30
trie_remove_subtree/1
,
31
trie_join/2,
32
trie_intersect/2,
33
trie_count_join/3,
34
trie_count_intersect/3,
35
trie_dup/2,
36
trie_save/2
,
37
trie_load/2
,
38
trie_stats/4
,
39
trie_max_stats/4
,
40
trie_usage/4
,
41
trie_print/1
,
42
open_trie/1,
43
close_trie/1,
44
close_all_tries/0,
45
put_trie_entry/4,
46
get_trie_entry/3,
47
remove_trie_entry/1,
48
print_trie/1,
49
trie_traverse_mode/1,
50
trie_disable_hash/0,
51
trie_enable_hash/0,
52
trie_traverse_first/2,
53
trie_traverse_next/2,
54
trie_to_list/2,
55
trie_to_depth_breadth_trie/4,
56
trie_to_depth_breadth_trie/6,
57
trie_get_depth_breadth_reduction_entry/1,
58
trie_get_depth_breadth_reduction_opt_level_count/2,
59
trie_replace_nested_trie/3
60
]).
61
62
/** @defgroup tries Trie DataStructure
63
@ingroup YAPLibrary
64
@{
65
66
@brief Engine Independent trie library
67
68
The next routines provide a set of utilities to create and manipulate
69
prefix trees of Prolog terms. Tries were originally proposed to
70
implement tabling in Logic Programming, but can be used for other
71
purposes. The tries will be stored in the Prolog database and can seen
72
as alternative to `assert` and `record` family of
73
primitives. Most of these utilities have been implemented in `C`
74
for efficiency. They are available through the
75
`use_module(library(tries))` command.
76
77
78
*/
79
80
81
82
:-
load_foreign_files
([tries], [], init_tries).
83
84
trie_empty(
Trie
)
:-
85
trie_usage
(
Trie
,
0
,
0
,
_
).
86
87
trie_dup(
Trie
,
CopyTrie
)
:-
88
trie_open(
CopyTrie
),
89
trie_join(
CopyTrie
,
Trie
).
90
91
trie_traverse(
Trie
,
Ref
)
:-
92
trie_traverse(
Trie
,
0
,
Ref
).
93
94
trie_to_depth_breadth_trie(
Trie
,
DepthBreadthTrie
,
FinalLabel
,
OptimizationLevel
)
:-
95
integer
(
OptimizationLevel
),
96
trie_dup(
Trie
,
CopyTrie
),
97
trie_open(
DepthBreadthTrie
),
98
trie_depth_breadth(
CopyTrie
,
DepthBreadthTrie
,
FinalLabel
,
OptimizationLevel
,
0
,
_
),
99
trie_close
(
CopyTrie
).
100
101
trie_to_depth_breadth_trie(
Trie
,
DepthBreadthTrie
,
FinalLabel
,
OptimizationLevel
,
StartCounter
,
EndCounter
)
:-
102
trie_depth_breadth(
Trie
,
DepthBreadthTrie
,
FinalLabel
,
OptimizationLevel
,
StartCounter
,
EndCounter
).
103
104
%% @}
105
106
load_foreign_files/3
load_foreign_files( Files, Libs, InitRoutine)
integer/1
integer( T)
trie_check_entry/3
trie_check_entry(+ Trie,+ Term,- Ref)
trie_close/1
trie_close(+ Id)
trie_close_all/0
trie_close_all
trie_get_entry/2
trie_get_entry(+ Ref,- Term)
trie_load/2
trie_load(- Trie,+ FileName)
trie_max_stats/4
trie_max_stats(- Memory,- Tries,- Entries,- Nodes)
trie_mode/1
trie_mode(? Mode)
trie_print/1
trie_print(+ Trie)
trie_remove_entry/1
trie_remove_entry(+ Ref)
trie_remove_subtree/1
trie_remove_subtree(+ Ref)
trie_save/2
trie_save(+ Trie,+ FileName)
trie_stats/4
trie_stats(- Memory,- Tries,- Entries,- Nodes)
trie_usage/4
trie_usage(+ Trie,- Entries,- Nodes,- VirtualNodes)
library
tries.yap
Generated by
1.9.3