Commit Graph
2659 Commits
Author SHA1 Message Date
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
Mark Thom 8a9cd7779c offset into complete strings with '$skip_max_list'/4 (#1529) 2022-10-26 23:36:07 -06:00
Mark Thom d4c0277065 don't return ops with priority 0 when building set for current_op (#1571) 2022-10-26 23:36:07 -06:00
Mark Thom 069e132c0e treat functors with PI '.'/2 as lists (#1570) 2022-10-26 23:36:07 -06:00
Mark Thom 4e6c138099 introduce expand_call_goal/3 to expand goals in control meta-predicates (#1568) 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
Mark Thom 78278c804f strip modules from GRBody in phrase/3 (#1565) 2022-10-26 23:36:07 -06:00
Mark Thom b51460a59a fail on non-list solutions in setof/3 (#1553) 2022-10-26 23:36:07 -06:00
Adrián Arroyo Calle 181be5be3f HTTP Server 2.0 2022-10-26 23:36:07 -06:00
Mark Thom 91d4e91f53 prefix inlined goals with module names in expand_subgoal/5 (#1551) 2022-10-26 23:36:07 -06:00
Mark Thom ad3ae7991b try to invoke '$call_inline' a second time in call/N (#1543) 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
Mark Thom 1ff52f70aa resolve phrase modules internally (#1541) 2022-10-26 23:36:07 -06:00
Mark Thom fce45167a5 fail when exception caught from subgoal expansion (#1535) 2022-10-26 23:36:07 -06:00
Mark Thom b8f384045c fix module resolution in dcgs, call/N (#1539) 2022-10-26 23:36:07 -06:00
Mark Thom ea95a7900c deduplicate index ptr inlining for 0-arity atoms (#1538) 2022-10-26 23:36:07 -06:00
Mark Thom edea1273c8 trim get_structure and put_structure arities when last arg is an index ptr (#1536) 2022-10-26 23:36:07 -06:00
Mark Thom ec9c763211 print index_ptr offset (#1534) 2022-10-26 23:36:07 -06:00
Mark Thom 5a08117e75 use separate predicate for findall cleanup 2022-10-26 23:36:07 -06:00
Mark Thom 0aec980aa8 inference count call_inline, fail on undefined index 2022-10-26 23:36:07 -06:00
Mark Thom 6b05ee5130 streamline assertz/1, asserta/1 2022-10-26 23:36:07 -06:00
Mark Thom 1ffbf63d20 inline metacalls 2022-10-26 23:36:07 -06:00
Manos Pitsidianakis b905d2758d fix type_error with instantiated EOF -1 byte literal in get_byte/2
According to ISO Prolog, get_byte/2 predicate can receive an
instantiated input byte:

http://www.gprolog.org/manual/html_node/gprolog037.html#sec156

    get_byte(+stream_or_alias, ?in_byte)

Since in_byte can be -1 if EOF is reached, instantiating it with -1
should work but does not because the implementation is trying to convert
it to a u8 which is unsigned:

?- open("/dev/null", read, S, [type(binary)]), get_byte(S, -1).
   error(type_error(in_byte,-1),get_byte/2).

This commit adds an extra check for -1 before checking for a valid u8
instantiated value if in_byte is an input:

?- open("/dev/null", read, S, [type(binary)]), get_byte(S, -1).
   S = '$stream'(0x55601e65c998).

Closes #1625
2022-10-26 13:49:38 +03:00
Mark Thom 311d985145 Merge pull request #1628 from epilys/fix-1626
Fix xor/2 type error reporting wrong argument
2022-10-25 20:46:49 -06:00
Manos Pitsidianakis a9a06b5297 Fix xor/2 type error reporting wrong argument
If first argument n1 in xor/2 is of wrong numerical type, the match
patterns fall through to a catch all case that reports the second
argument in the type error.

Fixes #1626

`xor/2 function reports the wrong argument in type error #1626`

https://github.com/mthom/scryer-prolog/issues/1626
2022-10-24 19:26:43 +03:00
Mark Thom 6b8e620495 Merge pull request #1530 from RossSmyth/FixImports
Fixed imports for num-rug-adapter
2022-07-18 21:36:46 -06:00
Ross Smyth 577f85099d Fixed imports num-rug-adapter 2022-07-17 02:06:37 -04:00
Mark Thom 607c84a79b capture and propagate (=..)/2 errors in phrase/{2,3} (#1460) 2022-06-21 22:47:55 -06:00
Mark Thom 2eec6499ff propagate inference_limit_exceeded errors through the loader (#1298) 2022-06-18 11:26:31 -06:00
Mark Thom cd1150c11d use setup_cal_n_init_goal_info in dynamic_module_resolution 2022-06-15 22:33:13 -06:00
Mark Thom 987bbdecf5 improve efficiency of call/N, replace '$call_with_default_policy' with
'$call_with_inference_counting'
2022-06-12 22:34:07 -06:00
Mark Thom a68394b6f2 simplify detecting undefined goal_ and term_expansion 2022-06-12 22:34:07 -06:00
Mark Thom 3d6fbabc86 Merge pull request #1510 from Skgland/add-gitattributes
add a .gitattributes file
2022-06-12 15:44:14 -06:00
Skgland 1479b5d38c add a .gitattributes file
- this should stop problems such as mthom/scryer-prolog#1491
  by specifying the line ending
  as this should take precedence over the global config
2022-06-12 15:39:55 +02:00
Mark Thom 336311ecc8 replace call with $call in more meta-predicates 2022-06-06 09:28:03 -06:00
Mark Thom e9bb35c895 emit indexing instructions in single clauses of dynamic predicates 2022-06-04 23:43:48 -06:00
Mark Thom ab4f93dcee do not emit indexing instructions for single clause subsequences (#1503) 2022-06-04 15:29:00 -06:00
Mark Thom 140a199805 Merge pull request #1505 from Skgland/optional_rustfmt
make rustfmt optional
2022-06-04 09:56:51 -06:00
Skgland 232b66cfc3 adjust error message on failed formatting 2022-06-03 23:50:17 +02:00
Skgland 11ba7e47fd make rustfmt optional
- when rustfmt is not detected (by attempting to run ``rustfmt --version)
  no formatting will be attempted
- this should resolve issue mthom/scryer-prolog#1504
2022-06-03 23:35:55 +02:00
Mark Thom c36d4a9c9a unmark cells in arith_eval_by_metacall (#1497) 2022-06-01 00:02:11 -06:00
Mark Thom 4b5c22864e don't print superfluous round brackets in curly braces (#1416) 2022-05-31 23:34:55 -06:00
Mark Thom 5e1faeb5d2 fix broken quoting in writeq/1 (#1498) 2022-05-31 18:29:42 -06:00