Markus Triska
70da818101
use new domain names from library(error): octet_character, octet_chars
2022-10-26 23:36:07 -06:00
Markus Triska
5ec837acb4
ADDED: octet_character and octet_chars, testing for strings that represent bytes.
2022-10-26 23:36:07 -06:00
Markus Triska
76e33d051c
rely on the built-in DCG expansion, per discussion in #1577
2022-10-26 23:36:07 -06:00
Markus Triska
7c5318b784
ENHANCED: Use '$skip_max_list'/4 for greater efficiency of nth0/3.
...
This is now possible due to 4c7e2eb8614da9c04f2286f6116b468017fb442c.
See #1529 for the suggestion by @UWN.
2022-10-26 23:36:07 -06:00
Markus Triska
47892bf24a
ENHANCED: Improve determinism of ... //0 and seq//1.
...
Example:
?- phrase(..., "hello").
true.
This addresses #1577 .
2022-10-26 23:36:07 -06:00
Markus Triska
0ab355eada
use a DCG to describe the path
2022-10-26 23:36:07 -06:00
Markus Triska
44825826df
remove entailed must_be/2 goals
2022-10-26 23:36:07 -06:00
Markus Triska
612f09893c
use newly available ... //0 from library(dcgs)
2022-10-26 23:36:07 -06:00
Markus Triska
e9f507b868
add meta_predicate/1 declaration for phrase_to_file/3
2022-10-26 23:36:07 -06:00
Markus Triska
c7caf6b7a9
ENHANCED: CLP(ℤ): Reduce redundant propagator invocations during all_distinct/1 filtering
...
First, the current propagator is now logged and not re-triggered
during filtering. Second, and more significantly, all neq_num/2
constraints are scheduled and processed before more global constraints
are invoked. In this way, all the distilled information can be taken
into account by subsequently invoked global constraints.
These changes yield a 3-fold improvement in several Sudoku instances,
and a significant runtime reduction in social golfer instance 8-4-9.
2022-10-26 23:36:07 -06:00
Markus Triska
4422ffe39f
add meta_predicate/1 declarations
2022-10-26 23:36:07 -06:00
Markus Triska
6b49653754
use in_character
...
This addresses one aspect of #1472 .
2022-05-22 23:04:27 +02:00
Markus Triska
d5fa8cc211
ADDED: must_be(in_character, ...) and can_be(in_character, ...)
2022-05-22 23:04:27 +02:00
Markus Triska
47a6b498e3
ENHANCED: "f" on toplevel to report answers up to the next multiple of 5.
...
This makes counting solutions easy.
2022-05-21 18:20:08 +02:00
Markus Triska
18c52e076f
indent enumerations
2022-05-15 10:55:56 +02:00
Markus Triska
1810dabc14
clarify the representation
2022-05-15 10:55:27 +02:00
Markus Triska
609a3a229f
strengthen and improve type checks
2022-05-15 10:51:00 +02:00
Markus Triska
dff56643f0
clarify comment
2022-05-15 10:23:00 +02:00
Markus Triska
77f8d52271
use phrase_from_file/2 directly on the file name
2022-05-15 10:19:00 +02:00
Markus Triska
1e9821ec0c
document atom and predicate completion with TAB
...
This feature, added via
https://github.com/mthom/scryer-prolog/pull/1467 , makes the toplevel
interaction a lot more convenient in many cases.
Many thanks to @euanlacy!
2022-05-15 10:05:30 +02:00
Markus Triska
a5e72679bc
prioritize type errors over instantiation errors
...
Example:
?- must_be(chars, [a,X,cc]).
error(type_error(character,cc),can_be/2).
See https://github.com/mthom/scryer-prolog/pull/1474#issuecomment-1126664368
2022-05-14 09:53:21 +02:00
Markus Triska
15cc916333
FIXED: can_be(chars, [a,X]), i.e., if variables occur as elements
...
This should simplify 2f3de51e55 and
other cases like it.
2022-05-14 08:39:20 +02:00
Markus Triska
d58dd7cc91
ADDED: sign/1
2022-05-05 22:51:49 +02:00
Markus Triska
7e06abebd5
remove comment that seems no longer valid
2022-05-05 22:51:49 +02:00
Markus Triska
eea83d9474
ADDED: can_be(term, ...) and must_be(term, ...)
...
This terminology is a bit harder to understand than that of the other
type checks.
Scryer Prolog comprises two individually consistent but incompatible
notions of terms, namely terms and rational trees (which are also
called "cyclic terms"). This leads to a confusion in terminology,
because cyclic terms are not terms in the former sense even though
they also contain the word "term" in their name.
This terminological confusion is not restricted to terms: We also find
it for example in the notion of lists. Lists are defined inductively:
- The empty list (written as "" or [], called 'nil') is a list.
- A term with principal functor '.'/2 is a list if its second argument
is a list.
Note that a list may contain cyclic terms as elements, and still be
called a list. However, if we post:
?- Ls = [_|Ls].
then Ls is not a list, because it does not fit the inductive
definition. Still, it is sometimes referred to as a "cyclic list" or
"circular list", even though it is not a list. Even Prolog
implementors that aim for strict conformance to the Prolog ISO
standard and are deeply familiar with the standard use this
terminology when talking about such terms, see for example:
https://github.com/ichiban/prolog/pull/198
Consequently, must_be(list, Ls) raises a *type error* in this case.
Terms are distinguished from cyclic terms completely analogously. This
leads to the counterintuitive consequence that *cyclic lists are not
terms*. The reason for this apparent contradiction in terminology is
the mutual incompatibility of different notions of terms. The notion
of "term" precludes rational trees, similar to the notion of "list"
which precludes cyclic lists.
We therefore introduce:
* must_be(term, Term)
- raises an instantiation error if Term contains variables (since
it could still become a rational tree)
- raises a type error if Term is a rational tree
* can_be(term, Term)
- raises a type error if Term is a rational tree
Note that using the notion of "cyclic term" and "acyclic term" in this
terminology would not be a good idea, because this confusion is
precisely what we want to eliminate: must_be(term, Term) should be
usable as a test that reliably determines whether Term can be treated
as a term with the logical properties we expect from terms.
This addresses #1428 .
2022-04-20 22:15:32 +02:00
Markus Triska
1fa8a0a969
ENHANCED: more memory efficient call_nth/2 ( #1264 )
...
I hope that this will allow more extensive tests of Scryer Prolog. Enjoy!
2022-04-02 17:42:45 +02:00
Markus Triska
f7e31fceac
as --> is
2022-03-30 21:33:46 +02:00
Markus Triska
1a7992e524
ENHANCED: use newly available must_be(chars, ...), which is very fast
2022-03-26 19:09:54 +01:00
Markus Triska
69e52d1ed8
ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0.
...
This addresses #1307 .
2022-03-07 23:38:30 +01:00
Markus Triska
c6264cf098
ADDED: library(simplex), for solving linear programming problems.
2022-03-06 21:49:52 +01:00
Markus Triska
8ad4f188f2
DOC: Better explanation of strings and partial strings.
2022-03-06 11:05:31 +01:00
Markus Triska
9f864574de
ADDED: "f" to enumerate the next 5 solutions, similar to GUPU.
2022-03-02 21:05:49 +01:00
Markus Triska
102adb3544
ADDED: "a" to enumerate all solutions
...
Example:
?- member(X, "hello").
%@ X = h <-- press "a"
%@ ; X = e
%@ ; X = l
%@ ; X = l
%@ ; X = o
%@ ; false.
2022-03-01 23:52:51 +01:00
Markus Triska
1bec1b7002
FIXED: load_html/3: use str_loc_as_cell! to store attribute structures
2022-03-01 20:21:08 +01:00
Markus Triska
8fb673e93e
use newly available get_n_chars/3 from library(charsio)
2022-02-23 00:03:36 +01:00
Markus Triska
d1372d9b3b
FIXED: library(sgml): load_html/3 and load_xml/3 now both work again.
...
This addresses #1249 .
2022-02-23 00:03:27 +01:00
Markus Triska
2e57789d10
ENHANCED: Make toplevel output a Prolog term that can be read back also for "...".
...
This addresses #1240 .
2022-01-28 18:47:55 +01:00
Markus Triska
b703303dd4
omit module prefix, because the goals are already module-qualified
2022-01-20 00:48:30 +01:00
Markus Triska
0da9d1c036
ENHANCED: more specific warning when initialization/1 fails ( #1149 )
2022-01-20 00:04:09 +01:00
Markus Triska
6a610ac57d
FIXED: toplevel to use (newly renamed) read_from_chars/2
2022-01-18 01:12:47 +01:00
Markus Triska
516ed1fd5b
ENHANCED: library(crypto): Retain a compact internal representation of the ciphertext throughout decryption.
...
This allows efficient decryption also of very large files and long
strings.
It is usually highly advisable to stick to common and portable library
predicates such as append/3. However, since append/3 does not yet
recognize this opportunity for improvement, I apply it manually in
this case, so that also very large files can be efficiently decrypted
using the compact internal string representation.
Without this change, decrypting a 1 GB file takes 48 GB of RAM,
whereas with this change, it only takes 2 GB (one for the string, one
for its copy with the appended tag).
2022-01-17 23:02:56 +01:00
Markus Triska
23adfef281
MODIFIED: library(charsio): read_n_chars/3 is now called get_n_chars/3
...
This is because "read" is associated with general Prolog terms.
2022-01-17 20:37:55 +01:00
Markus Triska
20b6816562
MODIFIED: library(charsio): read_term_from_chars/2 is now called read_from_chars/2
...
This is for compatibility with SICStus Prolog and GNU Prolog.
2022-01-17 20:21:18 +01:00
Markus Triska
177c98fa95
correct reference to '$working_directory'/2
2022-01-16 23:20:43 +01:00
Markus Triska
11d504e8f4
retain the string "[]" as is, instead of converting it to '[]' (i.e., "")
...
This addresses #1215 .
2022-01-16 17:50:20 +01:00
Markus Triska
91aa0f200e
add links to the rebis-dev branch and its announcement
2022-01-13 08:46:24 +01:00
Markus Triska
cfbb05fb1b
deterministic --> semi-deterministic
2022-01-12 21:58:23 +01:00
Markus Triska
2889a4438b
ADDED: format specifier ~NL to limit the number of digits per line
...
Example:
%?- format("~65L", [2^1000]).
%@ 10715086071862673209484250490600018105614048117055336074437503883_
%@ 70351051124936122493198378815695858127594672917553146825187145285_
%@ 69231404359845775746985748039345677748242309854210746050623711418_
%@ 77954182153046474983581941267398767559165543946077062914571196477_
%@ 686542167660429831652624386837205668069376 true.
2022-01-10 17:52:42 +01:00
Markus Triska
f5952088e3
ADDED: format specifier ~NU, using underscores to separate groups of digits
...
Example:
?- format("~2U", [10^12]).
%@ 10_000_000_000.00 true.
2022-01-10 16:07:05 +01:00
Markus Triska
57d15936cb
ENHANCED: Use newly available fast chars test from library(error).
2021-12-12 17:43:17 +01:00
Markus Triska
12c561cee0
report time with "s" instead of "seconds", in analogy to time(1)
...
This addresses https://github.com/mthom/scryer-prolog/pull/1131#issuecomment-988670049 .
2021-12-08 16:13:54 +01:00
Markus Triska
f79b8a1ca5
ENHANCED: support full layout text sequence (also comments) in integers with underscores
...
Example:
?- X = 1_/**/2.
%@ X = 12.
Following the comment in https://github.com/mthom/scryer-prolog/pull/1112#issuecomment-981540485
2021-12-08 10:42:19 +01:00
Markus Triska
637daa5bda
remove redundant test: '\n' is a layout char.
2021-12-08 10:37:37 +01:00
Markus Triska
dc5e935ecd
use newly available predicates from library(tls) for HTTPS
2021-12-05 18:16:47 +01:00
Markus Triska
538085169a
ADDED: library(tls), providing all predicates for TLS connections.
...
The currently available predicates for TLS-connections can be extended
with predicates to load and reason about certificates etc.
2021-12-05 18:16:47 +01:00
Markus Triska
7e8a635e7e
implement tls_client_negotiate/3 for explicit negotiation
2021-12-05 17:39:22 +01:00
Markus Triska
74e76b6f97
MODIFIED: Remove TLS-related predicates from library(sockets).
...
They will become available in a new library, library(tls).
2021-12-05 17:39:22 +01:00
Markus Triska
cb6309d370
walltime --> CPU time
2021-12-05 00:56:16 +01:00
Markus Triska
77c04c3a14
ADDED: Support for creating TLS servers.
...
The new predicates tls_server_context/2 and tls_server_negotiate/3 can
be used to negotiate TLS connections with clients for encrypted and
authenticated communication.
2021-12-03 16:45:27 +01:00
Markus Triska
48cea6efdf
FIXED: retract/1 issues due to module qualification
...
This addresses #1125 .
2021-12-01 21:46:12 +01:00
Markus Triska
89a90d9522
ENHANCED: Better reporting for time/1.
...
This addresses #378 .
2021-12-01 21:23:00 +01:00
Markus Triska
0026f3fdef
use anonymous variable
2021-12-01 20:54:06 +01:00
Markus Triska
ee054fd99c
several corrections to test cases
2021-12-01 19:45:36 +01:00
Markus Triska
79a50de697
ENHANCED: Correct type error for char_type/2.
...
This addresses #905 .
2021-11-29 19:33:22 +01:00
Markus Triska
fc8205d375
ENHANCED: indicate failed initialization/1 goal
...
This addresses #1109 .
2021-11-28 14:50:42 +01:00
Markus Triska
5e55732cb0
ENHANCED: Character type checks for get_char/[1,2].
...
This addresses #906 .
2021-11-28 10:49:40 +01:00
Markus Triska
45cfa6c8d8
use seq//1
2021-11-27 16:32:45 +01:00
Markus Triska
25a06b0bea
use seq//1 and ... //0 which are now available in library(dcgs)
2021-11-27 16:32:44 +01:00
Markus Triska
91af72e8b1
use seq//1
2021-11-27 16:17:45 +01:00
Markus Triska
fd9b354c70
use seq//1 which is now available in library(dcgs)
2021-11-27 16:17:15 +01:00
Markus Triska
1647e67dd4
ENHANCED: Support '_' followed by layout text sequence in integers.
...
This is handy for writing large integers, for example in cryptographic
applications.
This addresses #994 .
Examples:
?- X = 1_000_000.
%@ X = 1000000.
?- X = 1_
000_
000.
%@ X = 1000000.
2021-11-27 10:09:39 +01:00
Markus Triska
803e120a51
use must_be(list, ...) earlier, since it is now faster
2021-11-26 17:11:51 +01:00
Markus Triska
6ba374c62b
ENHANCED: use '$skip_max_list'/4 for fast list tests in can_be/2 and must_be/2
...
This also (partially) addresses #1108 .
2021-11-26 17:11:35 +01:00
Markus Triska
0d4c38138a
use newly available must_be(chars, ...) for fast string tests
2021-11-22 20:00:06 +01:00
Markus Triska
fe291e90f0
use newly available must_be(chars, ...) for fast string tests
2021-11-22 19:58:36 +01:00
Markus Triska
220e1e8d83
ADDED: must_be(chars, ...) and can_be(chars, ...) for string tests.
...
Internal features of Scryer Prolog are used to make these tests fast.
2021-11-22 19:55:34 +01:00
Markus Triska
faf74519dc
use round brackets for meta_predicate/1 declaration
2021-11-20 22:43:53 +01:00
Markus Triska
66becaf91c
FIXED: meta_predicate/1 declaration of cond_t/3.
2021-11-20 22:43:33 +01:00
Markus Triska
6610ba67c4
FIXED: meta_predicate/1 declaration of (',')/3 and (;)/3.
2021-11-20 22:43:07 +01:00
Markus Triska
e05dd5ebb5
FIXED: meta_predicate/1 declaration for tfilter/3.
2021-11-20 22:39:38 +01:00
Markus Triska
cf77f29988
FIXED: meta_predicate/1 declaration for tmember_t/3.
2021-11-20 22:38:27 +01:00
Markus Triska
2be8ed886b
FIXED: meta_predicate/1 declaration for tmember/2.
2021-11-20 22:37:59 +01:00
Markus Triska
21e5b0ab52
FIXED: meta_predicate/1 declaration for tpartition/4.
...
This addresses #1101 .
2021-11-20 22:37:31 +01:00
Markus Triska
d72cb74ffa
mention phrase_to_file/3 which is being prepared in #1100
2021-11-17 21:33:15 +01:00
Markus Triska
3c988d555f
'f' --> f
2021-11-17 21:20:40 +01:00
Markus Triska
5981a65cc2
better layout
2021-11-17 21:20:40 +01:00
Markus Triska
9900762747
use newly available seq//1 from library(dcgs)
...
I am using seq(Ls) instead of plain Ls so that DCGs can be debugged
declaratively, by generalizing away nonterminals in rules.
2021-11-17 21:20:40 +01:00
Markus Triska
bd75e9c184
more elegant solution for parsing numeric arguments, using a DCG
2021-11-16 18:25:35 +01:00
Markus Triska
23df16ecf9
mention the format("~s", [Ls]) pattern and new library(pio) predicates
2021-11-16 18:20:58 +01:00
Markus Triska
57877107d8
use functional notation for all meta_predicate/1 directives
2021-11-11 19:29:32 +01:00
Markus Triska
e9b4a99c8f
FIXED: meta_predicate/1 directive for call_nth/2.
...
This addresses #1021 .
2021-11-11 19:26:27 +01:00
Markus Triska
3045f327d5
FIXED: instantiation errors for alias(Var) in open/4 options
...
This addresses #1030 .
2021-11-08 22:41:04 +01:00
Markus Triska
2d1f182c49
FIXED: instantiation errors for type(Var) in open/4 options
...
This addresses #1030 .
2021-11-08 22:37:46 +01:00
Markus Triska
0677f51717
add motivation and comments about library(pio) predicates
2021-11-08 22:18:30 +01:00
Markus Triska
a9bfeb0e96
use newly available library predicate read_n_chars/3
2021-11-08 21:51:03 +01:00
Markus Triska
c44d27fb7f
mention pure output predicates in the README
2021-11-08 20:29:39 +01:00
Markus Triska
a0a01b8ba7
ADDED: library(format): DCG nonterminal portray_clause_//1, in analogy to format_//2.
2021-11-07 17:47:05 +01:00
Markus Triska
e32215e19a
express format/3 and portray_clause/2 in terms of phrase_to_stream/2
2021-11-07 17:47:05 +01:00
Markus Triska
893fb0e3cc
ADDED: phrase_to_stream/2, writing a list of characters to a stream.
2021-11-07 17:44:45 +01:00
Markus Triska
52af955463
import also partial_string/3 (used in #1071 )
2021-11-04 18:50:40 +01:00