Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "prolog_library_collection"

Title:Prolog Library Collection
Rating:Not rated. Create the first rating!
Latest version:1.0.16
SHA1 sum:cc68bbb8de3bf68caf567d62ad21303dd71758f2
Author:Wouter Beek <wouter@triply.cc>
Maintainer:Wouter Beek <wouter@triply.cc>
Packager:Wouter Beek <wouter@triply.cc>
Home page:https://github.com/wouterbeek/prolog_library_collection
Download URL:https://github.com/wouterbeek/prolog_library_collection/releases/*.zip

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
1.0.294619b7d4dbdec3f1be011fa55894e50cab923271https://github.com/wouterbeek/prolog_library_collection/archive/1.0.2.zip
1.0.38d77a9df84940173f323e9fc19605b61bc4d76231https://github.com/wouterbeek/prolog_library_collection/archive/1.0.3.zip
1.0.4dee72b73a2dc392964ae611369456168fa3e7d7f1https://github.com/wouterbeek/prolog_library_collection/archive/1.0.4.zip
1.0.52ba98bc550aded76ad5ba4de48281351698453b12https://github.com/wouterbeek/prolog_library_collection/archive/1.0.5.zip
1.0.670ad67d7002511a37f9204073029e83f673596ca1https://github.com/wouterbeek/prolog_library_collection/archive/1.0.6.zip
1.0.808c7922ec6a913279fd5a7bd15084c315389b20a169https://github.com/wouterbeek/prolog_library_collection/archive/1.0.8.zip
1.0.98e9703d473234a8954cf70ca611bc8af88931af3123https://github.com/wouterbeek/prolog_library_collection/archive/1.0.9.zip
1.0.10d1c1105e4c11f3d1b305a7c0f85cf3e67c7fffbe5https://github.com/wouterbeek/prolog_library_collection/archive/1.0.10.zip
1.0.122164df6cad6d60d76c8e82ab7bddfdb5f6e1c5872https://github.com/wouterbeek/prolog_library_collection/archive/1.0.12.zip
1.0.133e9cde936a730830293b635cdc0868a30e47dfb318https://github.com/wouterbeek/prolog_library_collection/archive/1.0.13.zip
1.0.14be972c3514cb60930e31f28e085abdc7b4d9184817https://github.com/wouterbeek/prolog_library_collection/archive/1.0.14.zip
1.0.155e630c167844e469115755af6389d73f630a8e8524https://github.com/wouterbeek/prolog_library_collection/archive/1.0.15.zip
1.0.16cc68bbb8de3bf68caf567d62ad21303dd71758f2315https://github.com/wouterbeek/prolog_library_collection/archive/1.0.16.zip

Prolog-Library-Collection

A collection of Prolog libraries that have proven useful in various projects. These libraries are intended to extend the functionality that is already available in the SWI-Prolog standard libraries.

Dependencies

Install SWI-Prolog.

Installation

Install this library:

swipl -g 'pack_install(prolog_library_collection)' -t halt

Use

Once installed, modules from this library are loaded as follows:

:- [library(atom_ext)].

Module overview

Module archive_ext

This module extends the standard library archive:

[97, 114, 99, 104, 105, 118, 101, 95, 101, 120, 116, 101, 110, 115, 105, 111, 110, 40, 63, 69, 120, 116, 101, 110, 115, 105, 111, 110, 58, 97, 116, 111, 109, 41]
Succeeds if Extension is a default file name extension for an archive filter or format, as declared in library [[media_type]].
[97, 114, 99, 104, 105, 118, 101, 95, 109, 101, 100, 105, 97, 95, 116, 121, 112, 101, 40, 63, 77, 101, 100, 105, 97, 84, 121, 112, 101, 58, 109, 101, 100, 105, 97, 41]
Succeeds if MediaType is the Media Type of an archive filter or format.
[97, 114, 99, 104, 105, 118, 101, 95, 111, 112, 101, 110, 40, 43, 73, 110, 58, 115, 116, 114, 101, 97, 109, 44, 32, 45, 65, 114, 99, 104, 105, 118, 101, 58, 98, 108, 111, 98, 41]
Opens an archive over all supported and sensible archive filters and formats. This specifically excludes format mtree, which is a plain text format that is almost never used yet leads to many false positives in practice.

Module assoc_ext

This module extends the standard library assoc:

[109, 101, 114, 103, 101, 95, 97, 115, 115, 111, 99, 40, 43, 78, 101, 119, 58, 97, 115, 115, 111, 99, 44, 32, 43, 79, 108, 100, 58, 97, 115, 115, 111, 99, 44, 32, 45, 77, 101, 114, 103, 101, 58, 97, 115, 115, 111, 99, 41]
Merges two assocs into a new one. If the same key exists in New and Old, the format replaces the latter in Merge. These semantics are inspired by those of the standard library predicate merge_options/3 in library option.
[116, 114, 97, 110, 115, 112, 111, 115, 101, 95, 97, 115, 115, 111, 99, 40, 43, 65, 115, 115, 111, 99, 58, 97, 115, 115, 111, 99, 44, 32, 45, 84, 114, 97, 110, 115, 112, 111, 115, 101, 100, 58, 97, 115, 115, 111, 99, 41]
Turns an assoc of (key,value) pairs into one with(value,key) pairs.

Module atom_ext

This module provides additional support for working with atoms:

[97, 116, 111, 109, 95, 99, 97, 112, 105, 116, 97, 108, 105, 122, 101, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 67, 97, 112, 105, 116, 97, 108, 105, 122, 101, 100, 58, 97, 116, 111, 109, 41]
Succeeds if Capitalized is a copt of Orginal where the first character is in upper case (if applicable).
[97, 116, 111, 109, 95, 101, 108, 108, 105, 112, 115, 105, 115, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 77, 97, 120, 76, 101, 110, 103, 116, 104, 58, 98, 101, 116, 119, 101, 101, 110, 40, 50, 44, 105, 110, 102, 41, 44, 32, 63, 69, 108, 108, 105, 112, 115, 101, 100, 58, 97, 116, 111, 109, 41]
Succeeds if Ellipsed is like Original, but has ellipsis applied in order to have MaxLength.
[97, 116, 111, 109, 95, 112, 111, 115, 116, 102, 105, 120, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 80, 111, 115, 116, 70, 105, 120, 58, 97, 116, 111, 109, 41]
[97, 116, 111, 109, 95, 112, 111, 115, 116, 102, 105, 120, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 76, 101, 110, 103, 116, 104, 58, 110, 111, 110, 110, 101, 103, 44, 32, 63, 80, 111, 115, 116, 70, 105, 120, 58, 97, 116, 111, 109, 41]
Succeeds if Postfix is a postfix of Original consisting of Length characters.
[97, 116, 111, 109, 95, 112, 114, 101, 102, 105, 120, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 80, 111, 115, 116, 70, 105, 120, 58, 97, 116, 111, 109, 41]
[97, 116, 111, 109, 95, 112, 114, 101, 102, 105, 120, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 76, 101, 110, 103, 116, 104, 58, 110, 111, 110, 110, 101, 103, 44, 32, 63, 80, 111, 115, 116, 70, 105, 120, 58, 97, 116, 111, 109, 41]
Succeeds if Prefix is a prefix of Original consisting of Length characters.
[97, 116, 111, 109, 95, 115, 116, 114, 105, 112, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 63, 83, 116, 114, 105, 112, 112, 101, 100, 58, 97, 116, 111, 109, 41]
[97, 116, 111, 109, 95, 115, 116, 114, 105, 112, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 43, 83, 116, 114, 105, 112, 58, 108, 105, 115, 116, 40, 99, 104, 97, 114, 41, 44, 32, 63, 83, 116, 114, 105, 112, 112, 101, 100, 58, 97, 116, 111, 109, 41]
Succeeds if Stripped is a copy of Original where leading and trailing characters in Strip have been removed.
[97, 116, 111, 109, 95, 116, 101, 114, 109, 105, 110, 97, 116, 111, 114, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 43, 84, 101, 114, 109, 105, 110, 97, 116, 111, 114, 58, 97, 116, 111, 109, 44, 32, 63, 84, 101, 114, 109, 105, 110, 97, 116, 101, 100, 58, 97, 116, 111, 109, 41]
Succeeds if Terminated is a copy of Original which is ensured to end with the Terminator character.
[97, 116, 111, 109, 95, 116, 114, 117, 110, 99, 97, 116, 101, 40, 43, 79, 114, 105, 103, 105, 110, 97, 108, 58, 97, 116, 111, 109, 44, 32, 43, 77, 97, 120, 76, 101, 110, 104, 103, 116, 58, 110, 111, 110, 101, 110, 103, 44, 32, 63, 84, 114, 117, 110, 99, 97, 116, 101, 100, 58, 97, 116, 111, 109, 41]
Like atom_prefix/3, but the Truncated atom is the Original atom in case MaxLength exceeds the Original atom length.

call_ext

meta-predicates

closure

code_ext

This module extends support for working with character-denoting numeric codes:

  • put_codes(+Codes:list(code))
  • put_codes(+Out:stream, +Codes:list(code))

conf_ext

This module introduces a generic way for dealing with external configuration files:

  • cli_arguments(-Args:list(opt)) is det.
  • conf_json(-Conf:dict) is det.

counter

csv_ext

Streamed processing of CSV files.

date_time

dcg

Definite Clause Grammars

In directory `/dcg` you will find a collection of Definite Clause Grammar (DCG) modules.

dcg/dcg_abnf

Advanced Bauckus-Naur Form (ABNF)

While DCGs are nice, they can be a bit verbose for expressing common repetition patterns. To make DCGs that include repetitions less verbose, this module implements variable repetition as defined in [[https://tools.ietf.org/html/rfc5234][RFC 5234: Augmented BNF for Syntax Specifications: ABNF]].

A simple example

Suppose we want to parse sentences, which are non-empty sequences of words:

sentence1([H|T]) -->
  word(H),
  sentece2(T).

sentence2([H|T]) -->
  word(H),
  sentence2(T)
sentence2([]) --> "".

When this module is loaded, the same can be written as follows:

sentence(L) -->
  +(word, L).

definition

##### variable repetition

Variable repetition is a metasyntactic construct which states that at least M and at most N occurrences of `:Dcg_0` must be processed:

'm*n'(?M:nonneg, ?N:nonneg, :Dcg_0)//

##### specific repetition

Specific repetition is a metasyntactic construct which states that exactly N occurrences of Dcg_0 must be processed:

'#'(?N:nonneg, :Dcg_0)//

Specific repetition is a special case of [[variable repetition]], because #(N, Dcg_0) is the same as 'm*n'(N, N, Dcg_0).

##### Kleene

Kleene star is a metasyntactic construct which states that zero or more occurrences of Dcg_0 must be processed:

*(?N:nonneg, :Dcg_0)//

Kleene star is a special case of [[variable repetition]], because *(N, Dcg_0) is the same as 'm*n'(_, _, Dcg_0).

##### Kleene sum

Kleene sum is a metasyntactic construct which states that one or more occurrences of Dcg_0 must be processed:

+(?N:nonneg, :Dcg_0)//

Kleene sum is a special case of [[variable repetition]], because +(N, Dcg_0) is the same as 'm*n'(1, _, Dcg_0).

##### optional sequence

Optional sequence is a metasyntactic construct which states that Dcg_0 should either be processed once or not at all:

?(:Dcg_0)//

Optional sequence is a special case of [[variable repetition]], because ?(Dcg_0) is the same as 'm*n'(0, 1, Dcg_0).

DCGMeaningName
`#(?N, :Dcg_0)//`Process Dcg_0 exactly N times.specific repetition
`*(:Dcg_0)//`Process Dcg_0 0 or more times.Kleene star
`'*n'(?N, :Dcg_0)//`Process Dcg_0 at most N times.
`+(:Dcg_0)//`Process Dcg_0 1 or more times.Kleene sum
`?(:Dcg_0)//`Process Dcg_0 0 or 1 times.optional sequence
`'m*'(?M, :Dcg_0)//`Process Dcg_0 at least M times.
`'m*n'(?M, ?N, :Dcg_0)//`Process Dcg_0 at least M and at most N times.variable repetition

It contains the following modules:

TypeDefinition
mediaA compound term of the form media(Super:atom/Sub:atom,Parameters:list(opt))
optA unary compound term whose predicate letter is an option name and whose argument is a corresponding option value.

dcg/dcg_ext

debug_ext

default

dict

Dictionaries.

dlist

Difference lists.

file_ext

Handling files and directories.

graph/gml

graph/graph_ext

graph/jgf

hash_ext

http/http_client2

http/http_generic

http/http_pagination

http/http_resource

http/http_server

json_ext

This module provides extended JSON support on top of the standard library http/json:

  • json_load(+File:atom, -Structure:dict) is det.
  • json_save(+File:atom, +Structure:dict) is det.

list_ext

math_ext

media_type

nlp/nlp_lang

os_ext

Running external processes, streaming to/from external processes.

pagination

pair_ext

pp

pure

sort_ext

stream_ext

Support for recoding, unpacking, sorting, and hasing streams.

string_ext

task

term_ext

thread_ext

uri_ext

Constructing/decomposing URIs.

xml_ext

This module allows Prolog goals to be called on a stream that encodes an XML DOM:

  • `call_on_xml(+In:stream, +Names:list(atom), :Goal_1) is det.`

The following predicates allow the encoding of an XML file or stream to be determined:

  • xml_encoding(+In:stream, -Encoding:atom) is semidet.
  • xml_file_encoding(+File:atom, -Encoding:atom) is semidet.

xsd

Support for XML Schema 1.1 Part 2: Datatypes.

Contents of pack "prolog_library_collection"

Pack contains 62 files holding a total of 508K bytes.