Bennet Bleßmann
ff546a0f9a
incorporate suggestion by triska
2025-08-01 20:28:07 +02:00
Bennet Bleßmann
97e2e5d7f0
implement process_release/1, process_wait/2, process_wait/3, and process_kill/1
2025-08-01 20:27:27 +02:00
Bennet Bleßmann
8971809c83
adjust errors
2025-08-01 20:21:13 +02:00
Bennet Bleßmann
e321f29b9c
rename pid to process
2025-08-01 20:21:02 +02:00
Bennet Bleßmann
129c80bf16
undo changes to error.pl
2025-08-01 20:20:52 +02:00
Bennet Bleßmann
183761eba4
adjust default cwd
2025-08-01 20:20:41 +02:00
Bennet Bleßmann
6c7833b9c7
restructure option parsing
2025-08-01 20:20:31 +02:00
Bennet Bleßmann
2b052bf8dd
fix more things
2025-08-01 20:20:09 +02:00
Bennet Bleßmann
003e9d4610
get it working
2025-08-01 20:19:54 +02:00
Bennet Bleßmann
ae0baf4893
[WIP] add support to spawn new processes
2025-08-01 20:18:13 +02:00
Bennet Bleßmann
dea43a0244
update docs
2025-08-01 19:42:02 +02:00
Dan Rose
49b30e9f81
Merge branch 'mthom:master' into patch-5
2025-07-08 18:03:16 -05:00
Bennet Bleßmann
725def07cd
fix crash when loading html
2025-07-07 22:39:47 -07:00
Markus Triska
073ec4c1d0
FIXED: invoke correct predicate
...
Noted by Oleg Finkelstein. Many thanks!
2025-07-07 22:38:12 -07:00
Markus Triska
d51cbd67e0
ENHANCED: partial_string/3 no longer creates atoms
...
As a consequence, resulting strings are now quickly reclaimed on
backtracking.
This addresses #2912 .
Test case:
:- use_module(library(iso_ext)).
:- use_module(library(lists)).
ab(a).
ab(b).
Sample query:
?- length(Ls, 1_000_000),
maplist(ab, Ls),
partial_string(Ls, Es0, []),
Es0 == Ls.
Ls = "aaaaaaaaaaaaaaaaaaa ...", Es0 = "aaaaaaaaaaaaaaaaaaa ..."
; Ls = "aaaaaaaaaaaaaaaaaaa ...", Es0 = "aaaaaaaaaaaaaaaaaaa ..."
; Ls = "aaaaaaaaaaaaaaaaaaa ...", Es0 = "aaaaaaaaaaaaaaaaaaa ..."
; Ls = "aaaaaaaaaaaaaaaaaaa ...", Es0 = "aaaaaaaaaaaaaaaaaaa ..."
; Ls = "aaaaaaaaaaaaaaaaaaa ...", Es0 = "aaaaaaaaaaaaaaaaaaa ..."
; ... .
running in constant memory.
2025-07-07 22:38:12 -07:00
Markus Triska
e9bb41f0d6
ENHANCED: use a fast test for the expected case of chars in atom_chars/2 etc.
...
Suggested by Oleg Finkelstein, thank you a lot!
Example, before this change:
?- t+\(length(As, 1_000_000), maplist(=(a), As), time(atom_chars(A, As))).
% CPU time: 0.693s, 7_000_041 inferences
true.
Now:
?- t+\(length(As, 1_000_000), maplist(=(a), As), time(atom_chars(A, As))).
% CPU time: 0.080s, 40 inferences
true.
This also partially ameliorates #2907 .
2025-07-07 22:38:12 -07:00
Markus Triska
bf31d3f9a9
ENHANCED: dedicated faster branches for repositionable streams
...
rebis-dev makes the speed difference especially apparent due to the
linear scan of strings on the heap in partial_string_tail/2 which is
now avoided for repositionable streams, notably files.
This addresses #2888 reported and analyzed by @haijinSk. Many thanks!
2025-07-07 22:38:12 -07:00
Mark Thom
9e1e99f961
Revert "remove Term"
...
This reverts commit 3b5879841aedecba5057c70c71da0ba23e5cd84a.
2025-07-07 22:38:10 -07:00
Mark Thom
3dee07f648
some fixes in response to miri
2025-07-07 22:02:27 -07:00
Mark Thom
ae4d12a123
remove pstr_vec
2025-07-07 22:02:27 -07:00
Mark Thom
c0f72704ec
introduce bespoke Heap type for in-heap partial strings
2025-07-07 21:59:50 -07:00
Mark Thom
1ef681bd21
remove Term
2025-07-07 21:54:08 -07:00
Mark Thom
1cf5de8f5c
Merge pull request #2970 from notoria/clpz
...
Make `(mod)/2` stronger in CLP(Z)
2025-06-16 21:02:38 -07:00
Markus Triska
17377064cf
use nonterminal indicators, correct meta_predicate/1 for higher-order phrase//N
...
Noted by @UWN in https://github.com/mthom/scryer-prolog/discussions/2872 .
Many thanks!
2025-06-14 22:47:29 +02:00
notoria
4b480a7eab
Strengthened (mod)/2 in CLP(Z)
...
?- 8 #= -1 mod #Y.
clpz:(Y in 9..sup), clpz:(-1 mod#Y#=8). % unexpected
Expected: Y = 9
?- 8 #= -12 mod #Y.
clpz:(Y in 9..sup), clpz:(-12 mod#Y#=8). % unexpected
Expected `Y` with finite domain
2025-05-25 13:39:31 +02:00
notoria
4a6f86591c
Strengthened (mod)/2 in CLP(Z)
...
?- 0 #= 2 mod #Y.
clpz:(Y in inf.. -1\/1..sup), clpz:(2 mod#Y#=0). % unexpected
Expected: clpz:(Y in-2.. -1\/1..2), clpz:(2 mod Y#=0)
2025-05-25 13:38:56 +02:00
notoria
37ac5bb3c1
Strengthened (mod)/2 in CLP(Z)
...
?- Z = 8, X = 9, #Z #= #X mod #Y.
Z = 8, X = 9, clpz:(Y in 9..sup), clpz:(9 mod#Y#=8). % unexpected
Expected: false
2025-05-25 13:37:28 +02:00
Dan Rose
e40125ff3a
Document when/2 Condition
2025-05-18 16:46:28 -05:00
Dan Rose
b767e4de25
xor is not a standard operator
2025-05-13 20:32:59 -05:00
Mark Thom
a42a88a2c9
Merge pull request #2802 from adri326/null-stream-safety
...
Fix UB when interacting with Stream::Null(_)
2025-05-01 17:35:30 -07:00
Mark Thom
90f4716cc3
Merge branch 'null-stream-safety' of https://github.com/adri326/scryer-prolog into adri326-null-stream-safety
2025-04-29 23:32:48 -07:00
Mark Thom
3a6289324e
Merge pull request #2901 from matteob8/patch-1
...
Update http_server.pl
2025-04-29 21:41:07 -07:00
Mark Thom
f496abbbef
use loader:strip_subst_module/4 in second module check of retract/1 ( #2891 , #2893 )
2025-04-22 23:28:19 -07:00
matteob8
00a44921db
Update http_server.pl
...
changed top/0 to the more meaningful run/0 name.
2025-04-21 20:54:43 +02:00
matteob8
d79bc199b3
Update http_server.pl
...
Avoid overwriting of predicate and made explicit reference to the loading of library(http/http_server).
2025-04-21 19:13:20 +02:00
Markus Triska
ba9fed3eae
generalize read_from_chars/2 and read_term_from_chars/3 to allow instantiated Term
...
This addresses part of #2871 , raised by @haijinSk. Many thanks!
2025-04-10 08:18:23 +02:00
Markus Triska
14c8fc3e34
move ~w to least prominent position, point to more suitable specifiers
...
In particular, "~q" is a safe better choice.
2025-04-05 10:01:22 +02:00
Markus Triska
3d60094330
ENHANCED: format specifier ~w more faithfully emulates write/1
...
In particular, variables now start with "_".
Example:
?- format("~w", [X]).
%@ _A true.
Found thanks to a discussion initiated by @haijinSk:
https://github.com/mthom/scryer-prolog/discussions/2863
2025-04-05 09:58:06 +02:00
Aman Verma
a45a1f6197
Use backticks when referencing predicate in docs.
...
Trivial change but this prevents the HTML output from being erroneously italicized.
2025-03-27 18:56:38 -05:00
Markus Triska
57bf1ec39b
ADDED: type pair
2025-03-08 14:42:48 +01:00
Markus Triska
32d91449b5
ADDED: call_with_error_context/2
...
See https://github.com/mthom/scryer-prolog/discussions/2839 for more information.
2025-03-08 09:12:17 +01:00
Markus Triska
b8526e0510
FIXED: portray_clause/1 for numbers
2025-02-28 08:41:19 +01:00
Markus Triska
2d4fcf9714
correct handling of floats with N digits (~f and ~Nf)
...
This addresses #2771 . Many thanks to @tmerr for reporting the issue!
The code was posted by @UWN in:
https://github.com/mthom/scryer-prolog/discussions/2805
Many thanks! With additional inputs by @adri326 and @notoria, who also
posted interesting approaches which could help to increase precision
in cases that are currently not ideally handled. Thank you all!
Please see the issue and discussion for more information.
2025-02-28 08:40:53 +01:00
Mark Thom
c9a0f3332e
Merge pull request #2792 from triska/must_be_chars
...
FIXED: instantiation and type check for string arguments
2025-02-27 21:26:40 -08:00
Emilie Burgun
f45b0bcfe8
Remove redundant alias resolution in at_end_of_stream/1, add corresponding tests for null streams
...
Also fixed at_end_of_stream/0 leaving a choicepoint.
2025-02-07 15:05:01 +01:00
Markus Triska
bc0f614bf9
FIXED: instantiation and type check for string arguments
...
This addresses #2790 .
The issue first appeared in an example reported by @ak-1 in #2788 , and
was successfully analyzed by @flexoron. Many thanks!
2025-01-23 20:18:55 +01:00
Emilie Burgun
b76bdd75e4
Fix #2725 by calling load_context/1 in the unspecified branch of strip_module/3
...
This fixes #2725 , by making it so that `strip_module(Pred, M, P), call(M:P)`
doesn't throw an `instanciation_error` when `Pred` isn't in the form `module:predicate`.
Now, `strip_module(hello, M, P)` will call `load_context(M)`, which unifies `M`
with the topmost module (or `user`).
Two new test cases are added: issue2725.pl, which tests the minimal case id(X) --> X.
and the strip_module(P, M, _), call(M:P) scenario, and module_resolution,
which tests the behavior of strip_module in a few scenarios.
2025-01-12 14:08:28 +01:00
Mark Thom
2856cc4371
Merge pull request #2742 from triska/clpb
...
Revert "FIXED: CLP(B): Delay BDD restriction until after the instantiation"
2025-01-04 13:26:08 -07:00
Mark Thom
2257503951
Merge pull request #2743 from triska/crypto
...
atom --> string
2025-01-04 13:23:59 -07:00
Markus Triska
28c386422b
state when the predicates are true
...
"returns" is not used in this way in logic programming. "return"
suggests that something went away and is now coming back, but this is
never the case in these situations. The arguments may be variables or
also fully known at the time of the call in most cases.
2025-01-02 18:54:27 +01:00