Did you know ... Search Documentation:
Profile for user LogicalCaptain

Tags by LogicalCaptain

arraysSec. 5.4
backquotesatom_codes/2
bit_operationxor/2, \/1, /\/2, \//2, <</2, >>/2
bit_shift_operation<</2, >>/2
caretbagof/3
character_classesSec. 4.24
command_line_argumentsSec. 2.4
comment_is_obsoleteSec. 3, atom_number/2, pack_install/1
compare_stringy_thingsatom_string/2
concatenation_of_stringsatomics_to_string/2
coroutinesSec. 4.9
cut!/0
datatypesSec. 4.5
deprecatedlibrary_directory/1, reconsult/1
destructuring_a_term=../2
detect_whitespacechar_type/2
doc-needs-helpis_of_type/2, assertion/1, , memberchk/2, cyclic_term/1, [wiki] Wiki page at "FAQ/reconsult.txt", ?=/2, dif/2, ==/2, Sec. A.63, [wiki] XPCE: the SWI-Prolog native GUI library, [wiki] Fix incomplete installation due to missing dependencies, [wiki] SWI-Prolog future directions, [wiki] Program Development Tools, call/1, format/2, Sec. 2.12, Sec. 2.15.1, writef/2, Sec. 2.15.1.3, Sec. 1.1, pengine_event_loop/2, Sec. 4.14, Sec. A.34, float/1, Sec. A.24, end_tests/1, Sec. 6.1, setup_call_cleanup/3, Sec. A.47, open/3, \=/2, \==/2, meta_predicate/1, Sec. 12.3, PL_register_foreign_in_module(), PL_get_atom_chars(), number/1, keysort/2, predicate_property/2, clause/2, Sec. G, atomic/1, Sec. 5.3.3, compound_name_arity/3, compound_name_arguments/3, get_dict_ex/3, Sec. 7.6, atom_string/2, acyclic_term/1, is_list/1, Sec. 5, Sec. 2.2.5, string_chars/2, Sec. 8.1, ord_intersection/2, expand_file_name/2, Sec. 12.4.13, Sec. 12.4.12, Sec. 12.4.18, Sec. 12, Sec. 12.3.1, Sec. 12.8.1, Sec. 12.4.19, Sec. 12.8.2, abolish/1, Sec. A.44, Sec. 4.9, Sec. 4.17.1, load_test_files/1, !/0, reset/3, write_canonical/1, numbervars/3, Sec. 2.10.1, Documentation, order_by/2, op/3, ./2, **/2, foldl/4, pairs_keys_values/3, random_member/2, [wiki] Wiki page at "howto/PackInfo.txt", predicate_name/2, consult/1, Sec. 6.14, Sec. 15, atom_length/2, digit//1, file_directory_name/2, file_base_name/2, uri_file_name/2, PL_new_atom(), Sec. 6.1, Sec. 6, encoding/1, term_to_json/3, pengine_create/1, Sec. 3.1.4, , format_time/3, Sec. 2.15.1.7
docs-needs-helpSec. 4.1, Sec. 5.4.1, read_stream_to_codes/3
dollar_var_notationnumbervars/3
exceptionsSec. A.16, throw/1, catch/3, Sec. 4.10.3, assertion/1
execute_shell_commandshell/2
failure_driven_loopforall/2
floundering\+/1
fluentsSec. 11
foldrfoldl/4
functionality_needs_helpclumped/2
hashesSec. 5.4
here_documentsSec. A.53
if_then_else->/2
ifdefif/1
input_from_stringopen_string/2
interactorsSec. 11
intersperseatomic_list_concat/3
intersperse_to_atomatomic_list_concat/3
intersperse_to_stringatomics_to_string/3
joinatomic_list_concat/3, atomics_to_string/3
limit-solutionsonce/1
listlengthlength/2
mapsSec. 5.4
mode-indicatorsSec. 4.1
modesSec. 4.1
multiline-stringsSec. 5.3
naf\+/1
negation\+/1
plunit
predicate-modesSec. 4.1
search-in-listnth0/3
semicontext_dcgcall_dcg/3
single_quoted_characterinteger/1
soft-cut*->/2
splitatomic_list_concat/3
stream_aliasesSec. 4.17.1
stripsplit_string/4
taking_apart_a_term=../2
toplevel_result_bufferSec. 2.9
trimsplit_string/4
try_finallysetup_call_cleanup/3
type_assertionmust_be/2
typesSec. 4.5
typetreeSec. 4.5
unit-tests
univ=../2
webengines

Comments by LogicalCaptain

Sec. A.9.7"Sudoku in Prolog" by Markus Triska: https://www.youtube.com/watch?v=5KUdEZTu06o ...
maplist/5Check out maplist/2 for more notes
Sec. A.9A load of examples at Hakank's (Håkan Kjellerstrand) page on SWI-Prolog: http:// ...
Sec. A.1## 0 vs failure As expected, aggregate_all/3, which uses findall/3, yields 0 if ...
pack/1Pack list is here: https://eu.swi-prolog.org/pack/list
same_length/3See also same_length/2. A comment there contains test code for this predicate.
use_module/1Interestingly, a `:- use_module(ModuleB)` is not needed in `ModuleA` if `ModuleB ...
string_concat/3## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
string_codes/2## See also - atom_codes/2 - atom_chars/2 - string_chars/2 and also - atom_strin ...
is_stream/1These all succeed: ``` is_stream(user_input). is_stream(user_output). is_stream( ...
close/1"If Stream is not open, an existence error is raised." So closing a stream is no ...
Sec. 9.1An directly runnable example from [Stack Overflow](https://stackoverflow.com/que ...
Sec. 9.2.1The syntax from TZom Frühwirth's book (p.
Sec. 2.2.4Note the two ways to do this via a declaration in the =|test/2|= options list: * ...
round/1Funnily, you can round infinity! ``` ?- X is round(-1.0Inf). X = -1.0Inf. ?- X i ...
Sec. 2.15.1.7## Doc needs help The regular expression =|[+-]?\sd+[.]\sd+Inf|= just can't be c ...
atomic_concat/3This nearly the same as atom_concat/3 but it doesn't generate substrings from th ...
char_type/2Bug: What is both in the class "white" and "space"? ``` ?- bagof(Char-Hex, Code^ ...
hex_bytes/2If you want to print a nmuber in hexadecimal though, just ise format/2: 0-padded 4 nibbles: ``` ?- Code=6464, format(atom(T),"0x~|~`0t~16r~4+",[Code]). Code = 6464, T = '0x1940'. ```
string_lower/2See also downcase_atom/2 for the corresponding predicate yielding atoms on argum ...
string_upper/2See also upcase_atom/2 for the corresponding predicate yielding atoms on argumen ...
upcase_atom/2``` ?- upcase_atom('aAbB12',X). X = 'AABB12'. ?- upcase_atom("aAbB12",X). X = 'A ...
downcase_atom/2``` ?- downcase_atom('aAbB12',X). X = aabb12. ?- downcase_atom("aAbB12",X). X = ...
term_variables/2Of course, we are talking about term *as it is at call time*, not *as it syntact ...
subsumes_term/2Some examples: ``` ?- subsumes_term(f(_,_),f(1,2)).
maybe/0When you fail, try, then try again: ``` ?- repeat,format("again!~n"),maybe,forma ...
atomics_to_string/2## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
format_time/3## Doc needs help We read: > The table below gives some format strings for popul ...
nb_setval/2## For example Setting, then getting a list of fresh variables.
goal_expansion/2Of course, goal_expansion/2 is itself Prolog code. Is it compiled first, without a prior application goal_expansion/2?
transpose/2This should probably be found in =|library(lists)|= Program above, with comments ...
Sec. 3.6See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Contr ...
thread_self/1Just my thread: ``` ?- thread_self(Me). Me = main. ``` Another thread without al ...
http_handler/3I suppose the handlers are visible to all web-server threads that are running in the same SWIPL instance.
comma_list/2## Example ``` ?- comma_list((a,b,c,d),X). X = [a, b, c, d]. ?- comma_list((a,b, ...
thread_statistics/2For example, using a dict prettyprinter: ``` ?- thread_self(Me),thread_statistic ...
if/1This is like a flexible version of C's =|#ifdef|= ... An example from file =|sta ...
map_list_to_pairs/3So, if one considers pairs to as =|Key-Value|=, then _Function_ is a predicate o ...
Sec. 7Inline code can also be created by using the markdown-style "triple backticks" ( ...
time/1See comments at time/1
statistics/0See comments at statistics/0
statistics/2## See also The note under [Obtaining Runtime Statistics](https://eu.swi-prolog. ...
Sec. A.52There is some functionality for statistics which is hard to find in the manual. ...
Sec. 4.42The gprof paper can be found here: [Gprof: A call graph execution profiler](http ...
## Doc needs help The TIPC links are outdated.
Sec. 3.1.4What is the link to set_prolog_flag/2 ? Example: ``` ?- rdf_default_graph(G). G ...
Sec. 3.14.4This is old. I last heard from inetd in the early 00's. After that, we got https ...
## A modifiable version of the "PLTP state diagram" Can be found here - [as SVG] ...
term_to_json/3See also the description at: https://eu.swi-prolog.org/pldoc/man?section=prolog- ...
pengine_create/1This creates a "local" pengine if =|option(Server)|= is missing, otherwise a "re ...
encoding/1Compare with XML's entry line, the "XML Declaration", encoded itself in UTF-8 or UTF-16 (only used once, which should really be enough; does one really want to switch to another encoding in the middle of a file, which demands appropriate editor support?).
Sec. 6## Problems with the client example Evidently, =|close(S)|= should be =|close(St ...
Sec. 12.2See notes under https://eu.swi-prolog.org/pldoc/man?section=shlib
PL_term_type()The "type of the term" is embedded in the term_t structure. In file =|pl-fli.c|= ...
PL_succeed()These are not C functions but macros. In =|SWI-Prolog.h|=, we find: ``` #ifndef ...
PL_register_foreign()Declared in SWI-Prolog.h as follows: ``` typedef foreign_t (*pl_function_t)(); P ...
Sec. 12.4.4.7See the note at https://eu.swi-prolog.org/pldoc/man?section=foreign-term-analysi ...
Sec. 12.4.4We read: > CVT_EXCEPTION: If conversion fails due to a type error, raise a Prolo ...
Sec. 12.4.5## Mode indicators? It's a bit unusual to see the C parameter names tagged with ...
Sec. 12.4.10An example from the JPL Java-Prolog bridge: extracts from file ``` packages/jpl/ ...
PL_functor_arity()As documented, this one returns `size_t` but the declaration in SWI-Prolog.h is ...
PL_new_functor()There is also ``` PL_EXPORT(functor_t) PL_new_functor_sz(atom_t f, size_t a); `` ...
PL_atom_wchars()What does it mean for an atom to be marked as "text" (are there others?)
PL_new_atom()Something went wrong in formatting: ``` atom_t ATOM_nil(A) tomic constant that r ...
Sec. 12.4.2.1References: [PL_unify_atom_chars](https://eu.swi-prolog.org/pldoc/doc_for?object ...
min_member/2See also - max_member/2 (with comments) - min_list/2 - max_list/2 (with comments ...
[wiki] Program Development Tools## Doc needs help ### Link to "Prolog Development Tool - PDT" Is actually https: ...
use_foreign_library/1## Putting libraries on swipl's equivalent of LD_LIBRARY_PATH The "foreign/1" ta ...
read_line_to_string/2## See also - read_line_to_codes/2 - read_line_to_codes/3 ## Example Can be used to ask the user as a proper replacement for read/1 ``` ask_user :- format("You must answer 'yes' to accept this offer one cannot refuse!~n"), read_line_to_string(user_input,S1), string_lower(S1,S2), ( member(S2,["yes","1","ok","y","ja","oui"]) -> format("You may proceed, good citizen.~n") ; format("I am sorry to hear that.~n"), fail ).
peek_code/2These are blocking.
fill_buffer/1On the command line, fill_buffer/1 waits for a terminating newline: ``` ?- sleep ...
get_single_char/1## Blocking read This predicate blocks waiting for input and returns -1 on EOF ( ...
print_message/2## Uses stderr > The predicate print_message/2 is used by the system and librari ...
uri_file_name/2## Examples Doesn't like =|http://|= URLs: ``` ?- uri_file_name('http://www.exam ...
uri_components/2 - The original RFC 3986 "Uniform Resource Identifier (URI): Generic Syntax" htt ...
Sec. 15.3See also text & comments at https://eu.swi-prolog.org/howto/Pack.html
pack_list_installed/0This is an "interactive command" in that: - It always succeeds even if there are no installed packages - If there are no installed packages, an _informational_ message is printed to STDOUT using print_message/2 - If there are installed packages, information about them is printed to STDOUT using pack_info.
wildcard_match/2See also the interface to the PCRE library: [library(pcre)](https://eu.swi-prolo ...
when/2For an example see [\+](https://eu.swi-prolog.org/pldoc/doc_for?object=%28%5C%2B ...
[wiki] How to deal with the Prolog dynamic database?See also the main section in the manual: [Database](https://eu.swi-prolog.org/pl ...
file_directory_name/2## See also file_base_name/2 ## Doc needs help The first arg should be named the same as for file_base_name/2: - file_base_name(+Path, ...) Hence - file_directory_name(+Path, -Directory)
file_base_name/2## Doc needs help The second arg should be named BaseName analogous to - file_di ...
help/1This should probably ALSO accept a predicate call as in ``` help(file_base_name( ...
file_name_extension/3## Arg naming "Base" should be called "Core" As in: "Name = CoreName .
process_create/3## See also: Take a look at this pack: https://www.swi-prolog.org/pack/list?p=by ...
absolute_file_name/3This is a bit of a mixture between fish and fowl Nothing on the path needs to ex ...
pack_install/2## Bug The input buffer should be emptied after the first answer ``` Verify pack ...
process_create/3## See also - shell/2 - [process_create∕3](https://eu.swi-prolog.org/pldoc/doc_f ...
-- ## See also: Take a look at this pack: https://www.swi-prolog.org/pack/list?p=by ...
system/2See shell/2
system/1See shell/2
system/0See shell/2
system/1See also: shell/2
integer/1Do not confuse with the type test predicate integer/1
limit/2See also once/1 =|once(Goal)|= should be the same as =|limit(1,Goal)|=
last/2## Unsurprising behaviour for proper lists The behaviour is "semidet": The predi ...
integer//1There is confusing ULR aliasing going on. I'm putting remarks into the comment s ...
digits//1There is confusing ULR aliasing going on. I'm putting remarks into the comment s ...
digit//1There is confusing ULR aliasing going on. I'm putting remarks into the comment s ...
integer//1There is confusing ULR aliasing going on. I'm putting remarks into the comment s ...
digits//1There is confusing ULR aliasing going on. I'm putting remarks into the comment s ...
digit//1 ## "digits" is greedy and does not backtrack Consider this grammar to preferabl ...
code_type/2Example: Taking the code for =|0|= : ``` ?- code_type(0'0,X). X = alnum ; X = cs ...
[wiki] Wiki page at "build/issues/filesex.txt"directory_file_path/3 behaves badly Examples for mode `(+Directory,+File,-Path)` ...
setup_call_catcher_cleanup/4See also: - catch/3 - catch_with_backtrace/3
Sec. 3See also these for related libraries in other languages: - https://perldoc.perl. ...
exists_file/1An example: We have a directory, an actual file, and a symlink to a file and to ...
directory_file_path/3This is of course a purely _syntactic operation_ on atoms (not strings, although strings are accepted).
Sec. 2.4## Doc needs help **What is "home directory"?** It is the directory on which =|s ...
write_length/3Nonground arguments will give arbitrary length: ``` ?- X=foo(bar(baz(_))),write_ ...
write_term/3Sadly, the Stream must be a stream id: ``` ?- write_term(string(S),[a,b,c],[]). ...
Sec. 15## Doc needs help It is not clear what "attaching packs" means and who/what perf ...
[wiki] Creating and submitting extension packages for SWI-Prolog## Naming of file Quite important indeed.
Sec. 7Note that a tabled predicate may well **change the order of solutions** if used ...
Sec. 6.14## Doc needs help 1 The maplist example is typoed ("G" vs "Goal" and calls modul ...
multifile/1Also see this Logtalk blogpost: [Multifile predicates: dos and don'ts](https://l ...
Sec. 6.3## Wrong name, really. use_module/1 is the wrong name for this functionality - i ...
current_module/1## Example ``` ?- setof(M,current_module(M),Modules). Modules = [ansi_term,apply ...
predicate_name/2Example: ``` ?- predicate_name(is_ordset(_),S). S = "is_ordset/1". ``` When is t ...
read/1## Note This corresponds to "serialization/deserialization" in Java and other la ...
Sec. 5.3.1The first footnote is important and extensive should be moved into the text.
Sec. 4.25## See also [Operators and modules](https://eu.swi-prolog.org/pldoc/man?section= ...
make/0This needs an "automake" which performs whatever make/0 does automatically whene ...
[wiki] Wiki page at "howto/PackInfo.txt"**Pack or Package?** "Pack" and "Package" seem to be used alternatingly.
list_undefined/0This predicate (correctly) does not complain for cases like these: What is insid ...
And also: ``` Technical prose is almost immortal. — Frederick P.
sort/4Does this predicate come from ECLIPSE? In the ECLIPSE manual: [sort(+Key, +Order ...
atomics_to_string/3## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
atom_split/3Use atomics_to_string/3 to join again.
random_member/2## Doc needs help Typo: > Fails of List is the empty list.
pairs_keys_values/3## Doc needs help Bad wording: > free or finite lists should be > open or proper lists ("open" including being an unbound variable)
Sec. 5.4.2See comments at https://eu.swi-prolog.org/pldoc/man?section=bidicts
load_test_files/1See the comments under the entry for `load_test_files` under "packages" instead ...
dict_keys/2## Note that This predicate behaves like findall/3 (it "relates to" the empty di ...
clumped/2## Missed opportunity This doesn't run in reverse, doing run-length decoding!?! ...
foldl/4## Doc needs help The example says: > the last two arguments [of foldl/4-7] form a typical difference pair That's definitely not right.
must_be/2## See also "Type tests in Prolog" by Markus Triska https://youtu.be/ZIv0G4b1xBQ ...
Sec. A.48## Note that This implementation seems to be **replaceable** by the built-in [SW ...
Sec. A.4assoc_to_list/2 doesn't take kindly to a mix-up in arguments: ``` ?- empty_assoc ...
call_dcg/3## Doc needs help The second paragraph is about this (I think): call_dcg/3 exist ...
nonground/2Grabbing an unbound variable from the term that appears as argument 1: **Standar ...
Sec. A.47Here is code to query the user with several questions and put the result into a ...
max_member/2## Unify, maybe? Confusingly, the argument order is ``` max_member(Max,List) ``` whereas for max_list/2 it is reversed: ``` max_list(List,Max) ``` This hurts my head.
not/1Note that not/1 is not declared as an operator: == ?- write_canonical(not true). ERROR: Syntax error: Operator expected == whereas \+ is, allowing nicer syntax: == ?- write_canonical(\+ true). \+(true) true. ==
\/1The ISO Standard says on page 124: > '\\'(B1) evaluates the expression B1 with v ...
**/2## Naming This operator is called "power" in the ISO standard of 1995, page 119. ## More on operators: As Wouter Beek says: > Notice that the precedence of (**)/2 is xfx, > which is different from that of (^)/2, which is xfy. These operators also have the same precedence, 200 (pretty strong), same as the precedence of unary `-`.
;/2## Coding guidelines From Covington et al., [Coding Guidelines for Prolog](https ...
./2Does this still exist?
-/1Note that there is a parse difference between `-1` and `-(1)` aka `- 1`: ``` ?- ...
Sec. 7.2.2What is the difference between the "markdown backtick" and the "doxygen backtick ...
-- ## Docs neecs some help maybe? The text > It acts as if defined by the following fact `=(Term, Term).` does not make sense to me.
min_list/2See comments at max_list/2
op/3## Some examples and an explainer [**About Operators**](https://github.com/dtonh ...
permutation/2To (deterministically) select any permutation "at random" use random_permutation ...
random_permutation/2The predicate is indeed symmetric: ``` ?- random_permutation([1,2,3,4],L). L = [ ...
merge_options/3## This one is buggy ``` ?- merge_options( [max_depth(100),quoted(true),portray( ...
random/1See also comments under https://eu.swi-prolog.org/pldoc/doc_for?object=f(random/ ...
random/3See also comments under https://eu.swi-prolog.org/pldoc/doc_for?object=f(random/ ...
random_float/0See also comments under https://eu.swi-prolog.org/pldoc/doc_for?object=f(random/ ...
crypto_n_random_bytes/2The appropriate OpenSSL man page for that would be (I think), "man RAND_bytes": ...
option/2You can use dicts as =|OptionList|=!
call_with_depth_limit/3## Examples true/0 needs depth 1: ``` ?- call_with_depth_limit(true,0,R). R = de ...
\+/1This operator is a hard nut. I have some notes on the Prolog `\+` here: - [**Not ...
sum_list/2As per a remark made on stack overflow, this predicate's name - expresses what i ...
arg/3Also raises type_error if Arg is not compound: ``` ?- arg(1,foo,X). ERROR: Type ...
duplicate_term/2New empty cells (fresh variables) are created for any unbound variable in the or ...
order_by/2The description is mangled... > "Spec is a list of terms, where each element is ...
compare/3See https://eu.swi-prolog.org/pldoc/man?section=standardorder for the "Standard ...
DocumentationThe "paperback version" if for "SWI Prolog Reference Manual 6.2.2" That's too ol ...
read_string/5== ?- open_string("Hello@",Input), read_string(Input, ",@", "\t ", End, String) ...
text_to_string/2This behaves the same as atom_string/2, but only in "string direction" and doesn ...
nb_setarg/3A problem from Stack Overflow: [Unexpected result for predicate nb_setarg/3](htt ...
Sec. D## Some corrections "A Prolog variable is a value that‘is not yet bound'." That ...
Sec. 2.10.1## Needs correction > "which models each predicate in a Prolog program as a stat ...
Sec. 11## For Pengines, see The section on [Pengines](https://eu.swi-prolog.org/pldoc/d ...
[wiki] SWI-Prolog copyrightThis is the https://opensource.org/licenses/BSD-2-Clause with one slight differe ...
numbervars/3## documentation needs help The output has changed: ``` ?- Term = f(X,Y,X), numb ...
numbervars/3## Recap to fight confusion! **numbervars** Rewrites the term.
write_canonical/1## documentation needs help We read: "Equivalent to write_term/2 using the optio ...
Sec. 2.9``` ?- $X. ``` seems to ... evaluate to the value of the previous `X`?
tmp_file_stream/3## Watch out Getting an == Arguments are not sufficiently instantiated == error? Note that there are two tmp_file_stream/3 predicates which take parameters with different semantics!
tmp_file/2This predicate **does not really create a file**, it just creates a unique _name ...
Sec. 4.1## Mode indicator cheat sheet / overview [Get it from here](https://github.com/d ...
sort/2## So many sort predicates! I have gone through the available "sort predicates" ...
Sec. 4.14.1.1This is pretty hot but maybe more adapted to CHR, which is based on a mutable da ...
>>/2Here is some functionality to transform integers into lists of 0,1 and the conve ...
>>/2The underlying bit pattern seems to be 2-complement with an infinite number of b ...
Sec. 4.9The thought arises that Prolog already _has_ continuations but they are not firs ...
reset/3## No matching `Ball` If the argument of shift/1 _cannot_ be unified with any `B ...
Sec. 4.8In this context, the following, though rather old, is highly readable: **Higher- ...
!/0## Doc-needs-help The expression ``` t4 :- \+(a, !, fail). ``` is invalid.
Sec. 4.33Of course, **all** variables of Prolog are **essentially global** (sometimes thr ...
call_with_inference_limit/3Try exceeding the limit: == ?- call_with_inference_limit( bagof(X,between(1,inf, ...
*->/2## In other words... Compared to `->/2` this construct backtracks over the [prem ...
option/3## You can use dicts!
Sec. A.30Note in particular that you cannot backtrack over the list of options via option ...
Sec. 6.1## Modules are objects As noted by Paulo Moura "Prolog Modules" can be seen as " ...
partition/4A partition_freely/4 predicate which partitions into arbitrarily many partitions by accepting a "partitioning closure" as first argument, returning the result as an SWI-Prolog dict where the dict's keys are the partition keys: - [`partition_freely.pl`](https://github.com/dtonhofer/prolog_notes/blob/master/code/heavycarbon/utils/partition_freely.pl) - [`partition_freely.plt`](https://github.com/dtonhofer/prolog_notes/blob/master/code/heavycarbon/utils/partition_freely.plt) Example: Define a partitioning predicate taking 3 arguments == partition_by_length_modulo_m(Modulo,Atom,Key) :- atom_length(Atom,Length), Key is Length mod Modulo. == A "partitioning closure" might then be for exmaple `partition_by_length_modulo_m(5)`: a partially filled in predicate call. Then: == ?- partition_freely( partition_by_length_modulo_m(5), [silent,puffy,left,damaged,fascinated,deafening, wistful,whip,nest,inquisitive,imperfect,jog,unwieldy,provide,locket,reign], result_tag, DictOut). DictOut = result_tag{ 0:[puffy, fascinated, reign], 1:[silent, inquisitive, locket], 2:[damaged, wistful, provide], 3:[jog, unwieldy], 4:[left, deafening, whip, nest, imperfect]}. ==
[wiki] The SWI-Prolog HOWTO collectionThis page does not list all the available howtos tht can presumably be found in ...
Sec. 4.14.1See also the howto page: [How to deal with the Prolog dynamic database?](https:/ ...
[wiki] Issues with gmpMore on GMP at [gmplib.org](https://gmplib.org/) and the [Wikipedia GMP entry](h ...
Sec. 4.17.1## Doc needs help "Initially, these are bound to the same stream as user_input a ...
atom_length/2## See also **string_length/2** for the corresponding predicate for terms that a ...
normalize_space/2As Jan says in the hierarchically-above page (which took me some time to click o ...
atom_number/2See also number_string/2
number_string/2The corresponding "atomikky" predicate, however, is called atom_number/2 Note th ...
crypto_n_random_bytes/2The appropriate man page would be "man RAND_bytes" https://www.openssl.org/docs/ ...
div/2See also divmod/4 (_not_ visible in the function in the header list because it i ...
Sec. A.44## File under "docs need help" _"SyntaxName is the principal functor of the quas ...
with_output_to_chars/2Note that, in spite of the name, the output is a list of (unicode) code points, ...
Sec. A.53## Doc needs help. The given example has a syntax error - the final parenthesis ...
writeq/1Escape sequences are inserted into the ouput as appropriate: ``` ?- writeq('hel\ ...
Sec. 5.3_There does not seem to be a good place to put this remark:_ Multi-line strings ...
var/1## That naming is confusing When you ask == var(X). == you are actually asking w ...
Sec. 4.17.5IRI is an URI, but internationalized: - https://en.wikipedia.org/wiki/Internatio ...
abolish/1We read: "all clauses of a predicate with functor Functor and arity Arity" Howev ...
PL_set_engine()In jpl.c there is a call == PL_set_engine(NULL, NULL); == What does that do?
Sec. 12.8.2"Portable applications" should probably be "consistent/reliable applications", b ...
Sec. 12.4.19The correct format from `SWI-Prolog.h` is ``` int PL_warning(const char *fmt, .. ...
Sec. 12.8.1For `PL_check_data` and `PL_check_stacks` the formulation is incomplete: I suppo ...
Sec. 12.3.1"Creates a new term reference to the same term as the argument.
Sec. 12## For a C++ interface Take a look at this package: [A C++ interface to SWI-Prol ...
Sec. 12.4.18Why can one call `PL_set_prolog_flag` for `PL_BOOL`, `PL_ATOM`, `PL_INTEGER`, bu ...
Sec. 12.4.17The relevant man page for POSIX OS-level signals is - man 7 signal - man 2 sigac ...
Sec. 12.4.12In predicate_t PL_predicate(const char *name, int arity, const char* module) how is the encoding of "name" and "module" specified (is it always UTF-8?) (nit pick: note the inconsistent sidedness of *) In int PL_call(term_t t, module_t m) the link to "figure 8" is dead.
Sec. 12.4.13We read: "See figure 8 for an example." But the link for "figure 8" (i.e.
getenv/2Background reading: https://en.wikipedia.org/wiki/Environment_variable On Linux, the environment variables, as attributes of the process, can be manually inspected by reading file `/proc/$PID/environ` like a normal text file.
read_stream_to_codes/3"creates a difference-list" implies: - creates an open list `Codes` ending in `T ...
expand_file_name/2## References Note that this is based on "csh" filename expansion.
open/4## Resolve the home directory Note that the "~" notation (used on Unix to indica ...
Sec. 11There is also a pack for UUIDs: https://eu.swi-prolog.org/pack/list?p=pluuid Exp ...
ord_intersection/2The first argument is not the/a [PowerSet](https://en.wikipedia.org/wiki/Power_s ...
Sec. 8.1## Explainer & Rewritten code For an explainer and rewritten code, go [**here**] ...
list_to_ord_set/2This predicate should probably be named list_to_ordset/2 instead of list_to_ord_ ...
Sec. 8.1.1Note that you can "put" to an unbound variable: == ?- put_attr(X,module,Y),get_a ...
attr_unify_hook/2"Triska 2016" is right here: https://www.metalevel.at/swiclpb.pdf "The Boolean C ...
put_attr/3On the toplevel, the predicate prints itself.
-- ## See also: The distribution comes with examples Under =|swiplexe_8.3.22/lib/sw ...
Sec. 4.10## My notes Personal notes on exceptions handling: - [About Exceptions](https:// ...
split_string/4## Trim/Strip As said in the examples, this predicate can be used to _trim_ stri ...
Reference manual# Documentation orientation ## Sometimes the documentation website is confusing. Main elements: - [*The SWI-Prolog reference manual*](https://eu.swi-prolog.org/pldoc/doc_for?object=manual), with a subsection: - [*The SWI-Prolog library*](https://eu.swi-prolog.org/pldoc/man?section=libpl) (can also be found via the menu system) - There are more at but they don't appear in the content list (only the libraries that appear in the main doc do so).
[wiki] XPCE: the SWI-Prolog native GUI libraryFor some reason this page shows up in no "list of contents", one finds it throug ...
statistics/0## See also The note under [Obtaining Runtime Statistics](https://eu.swi-prolog. ...
time/1## See also The note under [Obtaining Runtime Statistics](https://eu.swi-prolog. ...
integer/1This doesn't _really_ belong here but: A special way to generate integers is by ...
string_chars/2## See also - atom_codes/2 - atom_chars/2 - string_codes/2 and also - atom_strin ...
atom_concat/3## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
shell/2## Doc needs help > Please note that the CreateProcess() API does not imply the ...
jpl_class_to_classname/2== :- begin_tests(jpl_class_to_classname). instance_ref_to_entity_name(InstanceR ...
Sec. 10See also: - https://en.wikipedia.org/wiki/POSIX_Threads - https://computing.llnl ...
threads/0Example: == ?- threads. % Thread Status Time Stack use allocated % ------------- ...
Sec. 2.2.5The latest output for the test given is: == ?- run_tests. % PL-Unit: test ERROR: /home/user/tests.pl:3: test a: assertion failed Assertion: float(8) ERROR: /home/user/tests.pl:3: test a: assertion failed Assertion: 8==9 A done % 2 assertions failed % 1 test failed % 0 tests passed false. ==
acyclic_term/1See the notes under cyclic_term/1 Note that acyclic_term/1 is ISO, but cyclic_te ...
get_dict/5This predicate is misnamed.
Sec. 4.10.3## ISO standard exceptions The ISO standard ISO/IEC 13211-1 is VERY paywalled (I won't say anything more about the reasonableness/ethics/sustainability of this), so: - The following page substantially _is_ the ISO Standard text: https://www.deransart.fr/prolog/exceptions.html - Ulrich Neumerkel lists the various error classes here: http://www.complang.tuwien.ac.at/ulrich/iso-prolog/error_k - The context is a discussion leading up to the second corrigendum of the ISO standard. ## More info I'm trying to keep [**this opinionated page**](https://github.com/dtonhofer/prolog_notes/blob/master/swipl_notes/about_exceptions/README.md) updated with info on Prolog exceptions. ## About the backtrace How do we get a backtrace and how does the exception term have to look to get one? The backtrace is filled in according to SWI-Prolog conventions because the ISO Standard has nothing to say about this. SWI-Prolog wants the second argument of the `error/2` term (given in the ISO standard as `Imp_def`) to look like `context(Location,Message)`.
type_error/2> Suppose an argument must be a non-negative integer.
-- ## Something for the toolbox: What is a character? == character(A) :- atom(A),at ...
is_list/1## The mode indicator seems wrong The [mode indicator](https://eu.swi-prolog.org ...
reverse/2## The implementation (Click on the :- button in the doc) == reverse(Xs, Ys) :- ...
Sec. 4.21[**This page**](https://github.com/dtonhofer/prolog_notes/tree/master/swipl_note ...
setarg/3The specification should probably be == setarg(+Arg, !Term, +Value) == Position ...
Sec. 2.2The example `customize/init.pl` file is in `lib/swipl/customize/init.pl` in the ...
load_files/2## Load from where? "The specification for a source file is handed to absolute_f ...
Sec. 6.5Noet that this works for complex goals too. For example, in one module: == :- mo ...
load_test_files/1## Doc needs help What are the options?
string_length/2For "anytext", see [this page](https://eu.swi-prolog.org/pldoc/man?section=strin ...
with_output_to/2## If the goal emitting output fails... Evidently, if the goal fails, and you ou ...
run_tests/0This predicate succeeds if all the tests succeed and fails otherwise (i.e.
Sec. 4.39## "The Byrd Box Model" aka.
atomic_list_concat/3## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
ground/1Notice that the anonymous variable stays unground as every new occurrence is rea ...
Sec. 7.6Here is an excellent explanatory paper for Well-Founded Models by Teodor Przymus ...
Sec. 8"In the current system, test units are compiled into sub-modules of the module i ...
get_dict_ex/3This predicate no longer exists (and this page will be removed in a future updat ...
debug/1Please read important note on **debug topics** in the comment section of **[debu ...
Sec. A.14## An important note on topics (I will add this to the manual text later): Jan w ...
Sec. 5.4.1.2## Documentation improvements - The parameter for .put/1 should be called "NewKe ...
Sec. 5.4.1See comments at https://eu.swi-prolog.org/pldoc/man?section=bidicts ## Doc needs help The `New` in `put(+New)`should really be called `NewKeyValuePairs`. I am also recommeding a proper notation for these **method calls** or **dot calls** (which are called **function calls** here, but they really are not, they are method calls): precede the method name with a dot: - `.get/1` (throws if key does not exist) - `.put/1` (evaluates to a new dict with additions/replacements) - `.put/2` (evaluates to a new dict with single addition/replacement) Or maybe - `get./1` (throws if key does not exist) - `put./1` (evaluates to a new dict with additions/replacements) - `put./2` (evaluates to a new dict with single addition/replacement) And pldoc generation would need an update then. ## Some examples using `plunit` [`dict_put_dotcall_testing.pl`](https://github.com/dtonhofer/prolog_notes/blob/master/swipl_notes/about_dicts/code/dict_put_dotcall_testing.pl)
dict_create/3The difference between dict_create/3 and dict_pairs/3 is: - dict_create/3 takes ...
-- Special case: When you create a module to host dict method calls, you don't list those in the "public list" section: Here, just the predicate is listed: == :- module(point, [point_length/2]). M.multiply(F) % Method ".multiply/1" on dict M := point{x:X, y:Y} % Returns a "point" dict :- X is M.x*F, Y is M.y*F.
list_debug_topics/0This is a user-oriented predicate: == ?- list_debug_topics. -------------------- ...
:</2## Naming IMHO, "select" is not the appropriate name here, the more so because " ...
sub_string/5Time for test cases! == :- begin_tests(sub_string). test(find_single_bravo,[true ...
min/2## See also The predicates min_list/2 and max_list/2 from library [library(lists ...
forall/2In particular: Àny binding is rolled back on success because it happens behind t ...
is_dict/2A random atom is not a dict == ?- is_dict(atom,X). false. == A dict tagged "foo" is tagged "foo" indeed == ?- is_dict(foo{},foo). true. == Extracting the tag of a dict == ?- is_dict(foo{},X). X = foo. == An "anonymous dict" is a dict tagged as "foo" (this actually sets the tag of the anonymous dict to "foo" but we will never be able to ascertain this because there is no intruction to the right of the is_dict/2 call). == ?- is_dict(_{},foo). true. == Making another variable to denote the "hole" of an "anonymous dict" == ?- is_dict(Y{},X), X == Y. Y = X. == Setting/Binding/Refining the still fresh tag of the dict?
put_dict/3## Improvement The argument `New` should really be called `Updates` or `NewKeyVa ...
dict_pairs/3## Standard pairs are generated ``` ?- dict_pairs(_{a:1,b:2},T,P). P = [a-1,b-2] ...
random_between/3Note that there is no requirement that either of the args be >= 0. ``` ?- random ...
Sec. 4.32## For those looking for the correct predicate to use: - [Relevant predicates fo ...
Sec. 4.20For those looking for the predicate to use: - [Relevant predicates for generatin ...
debug_message_context/1The flag =message_context= is explained on the page for current_prolog_flag/2
is/2is/2 is **arithmetic function evaluation** from the original Prolog But in SWI-P ...
atomic/1The complement of atomic/1 is compound/1.
compound/1[**This page**](https://github.com/dtonhofer/prolog_notes/tree/master/swipl_note ...
findall/4Useful when you want to append to a list using several calls to findall/4. In th ...
number_codes/2## Getting the number from the list of character codes == ?- number_codes(N,[49, 50, 51]).
## Some references Note that this is based on: - Wikipedia: [PCRE: Perl Compatib ...
number_chars/2This tests whether the "serialized representation" doesn't lose digits: == ?- X ...
atom_chars/2## See also - atom_codes/2 - string_chars/2 - string_codes/2 and also - atom_str ...
debug/3## Topics Please read important note on **debug topics** in the comment section ...
Sec. 4.13## Introduction and tutorials - [DCG Primer](https://www.metalevel.at/prolog/dcg ...
char_code/2Remember that a Prolog "character" is an atom of length 1. However, this predica ...
phrase/3## Example == :- use_module(library(dcg/basics)). :- begin_tests(dcg). % Parsing the (unicode) codepoints in "Codes" with the callable % integer(X) which actually resolves to predicate integer/3, taking % itself "Codes" and "Rest" in addition to "X".
-- ## Doc needs fix "Prolog is described in Schrijvers et al., 2013 (preprint PDF). ...
initialization/1Example for when you want to call =main= of your source file **immediately after the source file has been loaded** (from swipl-devel/man/select.pl): == :- initialization ( catch(main, E, ( print_message(error, E), fail )) -> halt ; halt(1) ). ==
Note the following outcomes of calling a CHR constraint from Prolog: - The call ...
"Committed Choice" very concretely means there is no backtracking over the CHR r ...
The links to "further information" should probably not be as in an academic pape ...
term_expansion/2A simple example to print out whatever is read during consultation. In this case ...
unify_with_occurs_check/2"That is, a variable only unifies to a term if this term does not contain the va ...
dif/2## Needs text improvement We read: _Finally, if A and B can unify, goals are del ...
throw/1I put together some comments on exceptions (especially on ISO standard exception ...
Sec. 2.10## Companion info [**My notes on the Byrd Box model here**](https://github.com/d ...
Sec. 4.14## Also Not a "database" but allows to define "record-like terms": [`library(rec ...
instantiation_error/1The ISO exception term carries no information (it is just an atom) and thus is r ...
module/1This predicate should probably also be able to retrieve the name of the current ...
freeze/2## Some notes I made on `freeze` [**Right here**](https://github.com/dtonhofer/p ...
succ/2In fact, succ/2 is made to order for **natural numbers**. - What is the predeces ...
setof/3See bagof/3 for some commentary. See also: distinct/1 and distinct/2
false/0## Zero-effect clauses Note that writing clauses like == p(1,2) :- false. == has absolutely no effect on the meaning of Prolog program - you might as well leave them out (because everything that is left out is considered false - Closed World Assumption) For example: == p(2,4) :- false. p(A,B) :- between(1,4,A),B is 2*A. == Result: == ?- p(2,4). true. ?- bagof([X,Y],p(X,Y),Bag). Bag = [[1, 2], [2, 4], [3, 6], [4, 8]]. == and it is exactly the same for == p(A,B) :- between(1,4,A),B is 2*A. p(2,4) :- false. == or == p(A,B) :- between(1,4,A),B is 2*A. == ## And now for some inconsistency Using `false` and the cut means you can write Bad and Inconsistent Programs: == f(X,X) :- !, false. f(0,1). == Now you are in trouble: == ?- f(0,1).
Sec. 5.3.2## Compound terms of arity 0 vs.
## Works "out of the box"! As an example, try a few test cases.
retractall/1This predicate never fails. "If Head refers to a predicate that is not defined, ...
clause/2Jan Burse writes: "According to ISO core standard clause/2 is also only allowed ...
retract/1"logical update view" would be more correctly called "transactional update view" ...
dynamic/1See also: [Database Section](https://www.swi-prolog.org/pldoc/man?section=db) wh ...
flag/3From the [Database](https://eu.swi-prolog.org/pldoc/man?section=db) page: "flag/ ...
[wiki] SWI-Prolog downloads## Note The [Windows Release Notes](https://eu.swi-prolog.org/windows.html) are ...
include/3Example: We want the _Keys_ of _Key-Value_ pairs which match a certain _Value_. ...
## Test cases are your track bed through the swampland You do not want to haphaz ...
domain_error/2An example for a "domain error": == ?- catch(length(L,-1),C,true). C = error(dom ...
between/3## Doc needs help > a feature that is particularly interesting for generating in ...
compound_name_arguments/3[**This page**](https://github.com/dtonhofer/prolog_notes/tree/master/swipl_note ...
=../2## A bit surprising perhaps == % works for atoms and strings ?- atom =.. X. X = ...
Sec. A.63## IMPORTANT IMPORTANT IMPORTANT If you have yall expression in your source, mak ...
-- This operator is a hard nut. I have some notes on the Prolog `\+` here: - [**Not ...
[wiki] SWI-Prolog datatypesThe SWI-Prolog documentation has more on SWI-Prolog datatypes test predicates he ...
Sec. 4.5## See also - is_of_type/2 - checks that a variable is bound to a term of a give ...
repeat/0## See also forall/2 as a better alternative to the failure-driven loop ## Alter ...
once/1## "once should be deprecated" https://swi-prolog.discourse.group/t/once-1-shoul ...
-- I put together some comments on exceptions here: [On Exceptions](https://github. ...
length/2## Doc needs fix Maybe change the parameter name from `Int` to `Length`. ## Note ...
atomic_list_concat/2## Your choices Your choice of predicate is as follows: **Two concatenable terms as input (can split)** - atom_concat/3 (ISO) - string_concat/3 **Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)** - atomic_concat/3 **A list of concatenable terms as input (never split)** - atomic_list_concat/2 - generates atom at argument 2.
list_to_assoc/2Missed opportunity: The predicate **fails** if =Assoc= is set but =Pairs= is fre ...
max_list/2## See also - min_list/2 - max_member/2 - min_member/2 ## Unify, maybe? (This re ...
append/3## Bad naming!
keysort/2There should be a link to library(pairs): https://www.swi-prolog.org/pldoc/man?s ...
Sec. A.3I had some fun writing =foldl/4= and =foldr/4=, including an implementation of = ...
mod/2See also divmod/4 (_not_ visible in the function in the header list because it i ...
maplist/4Check out maplist/2 for more notes --- Explainer on maplist/4 and examples for t ...
current_prolog_flag/2## Doc needs help From the DCG page: The flags - [`back_quotes`](https://eu.swi- ...
same_length/2## Example In the same way that length/2 can generate lists of fresh unbound var ...
nth0/3## Doc needs help > type_error(integer, Index) if Index is not an integer or unb ...
-- Powerful append/2 is powerful.
list_to_set/2See also library(ordset) https://www.swi-prolog.org/pldoc/man?section=ordsets an ...
write_canonical/1Quite an interesting predicate to see what syntax tree the parser has created fr ...
functor/3[**This page**](https://github.com/dtonhofer/prolog_notes/tree/master/swipl_note ...
compound_name_arity/3[**This page**](https://github.com/dtonhofer/prolog_notes/tree/master/swipl_note ...
number/1Float Infinity is a number: ``` ?- MinusInf is -1.0Inf, number(MinusInf). MinusI ...
append/2## Bletch This must be one of the worst-named predicates in the entire galaxy. c ...
member/2## Some text vagueness "provides determinism on the last element" should be "pro ...
Sec. 5.1Do not be confused by '[|]'.
Sec. 5.4## Some additional documentation Notes I took.
\==/2Application: membership check in a difference list, to check whether we have rea ...
atom_codes/2## See also - atom_chars/2 - string_chars/2 - string_codes/2 and also - atom_str ...
sleep/1## Example sleeptimes Run: == bagof([Sleep,Delta] ,T_begin^T_end^(member(Sleep,[ ...
random/1Let's make the distinction between the offer of built-in functions and library p ...
get_dict/3## Some demo code [`dict_getting_testing.pl`](https://github.com/dtonhofer/prolo ...
-- I have been looking for a predicate to split a list L into three pieces: - Front (a list) - Element at Index N (0-based) - Back (a list) such that: == append([Front,[Element],Back],L). == Here is one.
nth0/4Replacing an element in a list (with 0-based indexing) from https://stackoverflo ...
foreach/2The "foreach" example is confusing because "dif/2" freezes until a decision can ...
Sec. 2## Errors on reloading source code Note that all the predicates (including helpe ...
Sec. 4.27.2.1Links to the GMP library: https://gmplib.org/ https://en.wikipedia.org/wiki/GNU_ ...
predsort/3This absolutely needs to be extended to `predsort(+Pred, +List, -Sorted, +Flags) ...
Sec. 12.2.3## Help Try ``` swipl-ld -help ``` for help information. This is not a script, b ...
PL_get_atom_chars()Returns 1 ( =|TRUE|= ) on success, 0 ( =|FALSE|= ) on failure (e.g.
PL_register_foreign_in_module()"After this call returns successfully" means it returns with =|TRUE|= (i.e.
Sec. 12.3`atom_t` may point to static memory or garbage-collectable memory if I understan ...
meta_predicate/1Confused by "The argument is a term that is used to reference a predicate with N more arguments than the given argument term.
Sec. 6.5Confused by "The argument is a term that is used to reference a predicate with N more arguments than the given argument term.
nan/0## NaN is a float Note that NaN is a float: ``` ?- X is nan, float(X). X = 1.5Na ...
max/2## See also The predicates min_list/2 and max_list/2 from library [library(lists ...
=:=/2Some examples: Everything must be known at the time of evaluation: == ?- 2*2 =:= X. ERROR: Arguments are not sufficiently instantiated ?- X=4.0, 2*2 =:= X. X = 4.0. ?- cos(X) =\= sin(X). ERROR: Arguments are not sufficiently instantiated % Ok, then! ?- X=pi, cos(X) =\= sin(X). X = pi. == Sadly =:= is a bit fussy.
\==/2For clarity, this should be written with complimentary parentheses: == \+(Term1 ...
copy_term/2It is intuitively clear what "renamed (fresh) variables" means but it's not real ...
\=/2``` X = Y ``` means: "Proceeding down this path of computation, =|X|= and =|Y|= ...
\=/2It would be clearer to write == \+(Term1 = Term2) == rather than than == \+Term1 = Term2 == Although of course: == ?- write_canonical(\+Term1 = Term2). \+(=(_,_)) ==
->/2## Notes For - the if-then-else `->/2` + `;/2` and - the [soft-cut](https://eu.s ...
initialization/2Regarding "main", note that an exit status of 0 indicating "success" is a conven ...
Sec. 2.11.1.1Contra Carlo Capelli's note, the "shebang" is not at all overengineered. As a co ...
Sec. 4.36Also consider library "filesex" ("extended operations on files", damned PhDs doi ...
Sec. A.26For the shebang trick where swipl is started indirectly through =env= == #!/usr/ ...
Sec. A.26For the "initialization" directive, see: https://www.swi-prolog.org/pldoc/doc_fo ...
open/3Question: What does an empty option list assume about the encoding of the file?
setup_call_cleanup/3## If you come from other programming languages If you come from other programmi ...
deterministic/1Example: == ory :- format("1st clause:\n"), deterministic(D1), format(" Det at ( ...
atom/1See also: https://www.swi-prolog.org/pldoc/man?section=text-representation Atoms ...
Note that contrary to the statement in the text: "Installing from source is ofte ...
Sec. 6.2## For those looking for the "module qualification mechanism" It's here: [defini ...
Sec. GThis above just the list of references that appear in the Documentation. I have ...
get_time/1Returns a float! Compare with Unix `date` command's "seconds since 1970-01-01 00 ...
begin_tests/1Note that if you add tests from the command line using [user]., you can do so on ...
end_tests/1What is the rationale behind having to repeat the test name in the block termina ...
consult/1## Doc needs help You can actually also pass a series of files (is this inoffici ...
Sec. A.24I would also point the user to https://www.swi-prolog.org/pldoc/man?section=ords ...
predicate_property/2This may not be directly clear from the description: ## Calling predicate_proper ...
[wiki] Eat Your Own Dog FoodThis should really be linked from the "Documentation" intro page.
Sec. 3ISO Prolog only defines the "% ..." comments and the "/* ... */" comment block i ...
maplist/2## Explainer Explainer including examples for the use of maplist/2 (and maplist/ ...
float/1"When used around the 2nd argument of is/2, the result will be returned as a flo ...
Sec. A.34This needs more explanation on the attached "database file". Is it a text file w ...
pengine_event_loop/2## See also ignore/1: Calls Goal as once/1, but succeeds, regardless of whether ...
Sec. 1.1The link = http://www.swi-prolog.org/pldoc/doc/home/vnc/prolog/lib/swipl/library ...
catch/3## Problematic Naming While the `Goal` argument is correctly named, `Catcher` is a confusing name for what is the exception term against which a thrown exception shall be against.
float/1## See also - [`float/1`](https://eu.swi-prolog.org/pldoc/man?function=float/1) ...
Sec. 2.15.1.3This section applies to Strings, too == ?- format(">\c | hello<"). >hello< true. == Jan Wielemaker writes: "Although incomplete in the implementation, the overall idea is that predicates that require text input accept all text representations and produce the documented type as output." ---- The \uXXXX encoding (really, NAMING of a glyph in the Unicode BMP) is called "UCS-2" https://en.wikipedia.org/wiki/Universal_Coded_Character_Set More on Unicode here: https://en.wikipedia.org/wiki/Unicode#Architecture_and_terminology ---- Note that the unicode escapes are meant to be used in the context of strings, atoms or chars (atoms of length 1).
writef/2As noted on the page of format/2, the escape sequences one uses in practice are ...
format/2## Print hex codes 0-padded 4-nibbles: ``` ?- Code=6464, format(atom(T),"0x~|~`0 ...
atom_string/2## This also is the "comparison operator for stringy things" Suppose you have re ...
-- This corresponds to "serialization/deserialization" in Java and other languages. You CAN but shouldn't use this for reading input typed in by the user. Example: == ?- with_output_to( string(Buf), write_term(a(b,c,[1,2,3],var(ZZ)),[])), % serialize a term as string to "Buf" read_term_from_atom(Buf, T, []).
maplist/3Check out maplist/2 for more notes --- Explainer on maplist/3 and examples for t ...
Sec. 4.6Note that "==" and "\==" are really tests about the current state of the computa ...
Sec. 2.1"Getting started quickly" should point the user to a description/tutorial/howto ...
Sec. 2.15.1.9See also: https://eu.swi-prolog.org/pldoc/man?section=widechars
Sec. 2.15.1The title of this section is "ISO Syntax Support" but should probably be "Extens ...
Sec. 2.15.1.5This is not ISO Prolog, but quite useful. Compare with Java where this trick is ...
findall/3## Notes about findall [**Notes about findall/3**](https://github.com/dtonhofer/ ...
Sec. 2.12I'm always looking for the way make the ### Prolog Toplevel printer print lists ...
Sec. 5.2.2## See also - library(strings): https://eu.swi-prolog.org/pldoc/man?section=stri ...
call/1## Backtracking works as expected == ?- call(member(X,[1,2,3])). X = 1 ; X = 2 ; X = 3. == ## Doc changes The text should probably be changed from > Note that clauses may have variables as subclauses, which is identical to call/1. to > Note that clauses may have variables as goals.
[wiki] Program Development ToolsCurrently trying "ProDT"... Trying with Eclipse Oxygen (Eclipse 4.7, 2017-12) on Linux Fedora with JDK 1.8.0 The original site is http://prodevtools.sourceforge.net/ - the instructions on that site are a bit stale.
[wiki] SWI-Prolog future directionsIt might be helpful to indicate when this entry was written.
[wiki] Fix incomplete installation due to missing dependenciesDead link in the line "Redo the build.
[wiki] Wiki page at "build/issues/xpce.txt"Compiling on Fedora: At first sight, the error log seems to indicate that there ...
[wiki] XPCE: the SWI-Prolog native GUI librarySadly, the link "The design of the XPCE/Prolog interface (Publication in Worksho ...
bagof/3## See also [library(aggregate)](https://eu.swi-prolog.org/pldoc/man?section=agg ...
^/2## Something weird If SWI-Prolog has not been compiled with GMP, then ^/2 perfor ...
==/2Confusingly, the explanations uses two adjectives: "equivalent" and "identical".
?=/2I think the text "Succeeds if the syntactic equality of Term1 and Term2..." shou ...
[wiki] Wiki page at "FAQ/reconsult.txt"The link to "Initialising and Managing.." has to be changed to http://www.swi-pr ...
cyclic_term/1Note that acyclic_term/1 is ISO, but cyclic_term/1 is not. Consider the evolutio ...
memberchk/2This predicate **does not backtrack** (which is why it exists). Use this predica ...
Sec. 5See also [SWI-Prolog's page on predicate descriptors](https://eu.swi-prolog.org/ ...
Sec. A.4.3Actually missing a way to get the number of elements in the association list...
Reference manual#### SWI-Prolog Wiki entry There is a [wiki entry at the SWI-Prolog Discourse Gr ...
assertion/1## Not an ISO Standard exception assertion/1 throws a non-ISO Standard error ter ...
file_search_path/2Thanks @Jan.
[wiki] Representation and printing of floating point numbersAnd here is the [reference for floating-point notation](http://www.dcc.fc.up.pt/ ...
[wiki] Representation and printing of floating point numbersHere is a another link of interest that predigests the "What Every Computer Scie ...
file_search_path/2The definition should be "file_search_path(?Alias, ?Path)" as the following work ...

Packages by LogicalCaptain

Pack
tot: 2
Version
(#older)
Downloads
tot: 102
(#latest)
Rating
(#votes/
#comments)
Title
scasp1.1.4291014
Goal directed ASP solver
onepointfour_basics0.91
Some basic predicates that may be useful. Includes a replacement of must_be/2 and a dict prettyprinter
This list contains packages whose author name, e-mail or homepage url matches the profile information.