Commit Graph
647 Commits
Author SHA1 Message Date
Adrián Arroyo Calle f2940ddfcf Some minor fixes. Thanks to @triska for them! 2022-10-26 23:36:07 -06:00
Markus Triska b2cccab768 ENHANCED: library(crypto): Faster conversion to bytes when the integer is known.
These entailed constraints only affect performance, and can be removed
without affecting the correctness of the code. They speed up scalar
multiplication of a curve point, used for example in Bitcoinolog.
2022-10-26 23:36:07 -06:00
Markus Triska a891cc4edf use (slightly) better variable names 2022-10-26 23:36:07 -06:00
Markus Triska 706ab2ae5b use newly available must_be(chars, ...) for better and shorter type test 2022-10-26 23:36:07 -06:00
Markus Triska 9c1de8e00b ENHANCED: Eliminate the OpenSSL dependency of library(crypto).
This is achieved by using the newly available crrl crate by @pornin
to implement crypto_curve_scalar_mult/4 for secp256k1. Many thanks!
2022-10-26 23:36:07 -06:00
Markus Triska ce313b8a6b correct nth0/4 and nth1/4
As per https://github.com/triska/scryer-prolog/commit/56b430ecaf9bd59fb7bd0b1e56d451ab322c422e#commitcomment-82155379.
2022-10-26 23:36:07 -06:00
Markus Triska 7c96b91663 remove nth1/3, which is now provided by library(lists) 2022-10-26 23:36:07 -06:00
Markus Triska 87e966e185 remove nth1/3, which is now provided by library(lists) 2022-10-26 23:36:07 -06:00
Markus Triska 1e018681de ENHANCED: Much improved nth0/3, taken from #1529.
This also adds nth0/4 and bootstraps nth1/[3,4] from it.
2022-10-26 23:36:07 -06:00
Markus Triska 5b324680ba ADDED: must_be/can_be(not_less_than_zero, ...)
See #1309.
2022-10-26 23:36:07 -06:00
Markus Triska abca5fc405 better implementation of list_si/1
Per discussion in https://github.com/mthom/scryer-prolog/pull/1589.
2022-10-26 23:36:07 -06:00
Markus Triska 6a455d2866 ADDED: chars_si/1, testing for a string
Examples:

    ?- chars_si("hello").
       true.

    ?- chars_si(5).
       false.

    ?- chars_si([a,b,c|Rs]).
       error(instantiation_error,sort/2).
2022-10-26 23:36:07 -06:00
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
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 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
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 b8f384045c fix module resolution in dcgs, call/N (#1539) 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 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
Mark Thom 607c84a79b capture and propagate (=..)/2 errors in phrase/{2,3} (#1460) 2022-06-21 22:47:55 -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 336311ecc8 replace call with $call in more meta-predicates 2022-06-06 09:28:03 -06:00
Mark Thom 4b7c2ba6c8 fix off-by-one error reporting in write_term/3 (#1490) 2022-05-30 23:25:44 -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
Mark Thom b6f77f4e6f check asserta/2, assertz/2, abolish/2 for uninstantiated Module variables (#1475) 2022-05-16 20:45:45 -06:00
Mark Thom b96cd06129 detect character type errors in atom_{chars|codes}/2 (#1472) 2022-05-16 16:32:38 -06: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 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