notoria
e3a7f9eb7a
Draft of an implementation of char_type
2020-04-22 12:57:18 +02:00
Markus Triska
20fb6d6669
ADDED: library(format) now provides a rudimentary version of listing/1
...
Example:
:- dynamic(a/1).
a(X) :- X = true, b(X).
Yielding:
?- listing(a/1).
%@ a(A) :-
%@ A=true,
%@ b(A).
%@ true.
listing/1 only works for predicates and DCGs that are declared dynamic/1.
2020-04-22 01:53:20 +02:00
Markus Triska
608d661355
portray_clause/1 now correctly tracks variable names ( #376 )
...
Example:
?- portray_clause((A :- B)).
%@ A :-
%@ B.
%@ true
%@ ; ...
Also, change the indentation from 8 to 3 at the express request of @UWN.
2020-04-20 22:53:15 +02:00
notoria
6d7612ead6
Corrected the error being thrown by sleep/1
2020-04-20 16:36:57 +02:00
notoria
b3e31094ff
Changed the error being thrown by sleep/1
2020-04-20 11:27:28 +02:00
Mark Thom
c9750fab2c
Merge pull request #371 from notoria/sleep
...
Added the sleep predicate
2020-04-19 21:41:33 -03:00
notoria
a7f3dafd81
Undo a workaround
2020-04-19 23:26:16 +02:00
notoria
fb38b4b906
Corrected bound
2020-04-19 23:04:51 +02:00
notoria
f0a1a90b0e
Merge pull request #3 from triska/sleep
...
update comment
2020-04-19 22:44:48 +02:00
notoria
fb331d39a6
Thrown an error if T < 0 or T > 0xfffffffffffffbff in sleep(T)
2020-04-19 22:43:13 +02:00
Markus Triska
7a3e6e19b1
update comment
2020-04-19 22:36:27 +02:00
notoria
5a063c541d
Added the sleep predicate
2020-04-19 21:35:49 +02:00
Markus Triska
7141fb18c1
ENHANCED: time(Goal) now also reports the time if Goal fails
2020-04-19 21:13:15 +02:00
Markus Triska
4693c23a49
ADDED: library(time), providing time/1 for benchmarking
...
sleep/1 and predicates for reasoning about time stamps should also
be added to this library.
2020-04-19 19:18:47 +02:00
Mark Thom
cae0733149
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-04-19 12:58:54 -06:00
Mark Thom
5d6ca7a88e
throw '' whenever an interrupt is made ( #365 , #366 )
2020-04-19 12:58:44 -06:00
Markus Triska
60f1f1cb3d
Restore the type_error, which was implemented correctly by @notoria.
...
This corrects f28e87b240 :
in_character is a valid type by 7.12.2 Error classification!
2020-04-19 02:15:59 +02:00
Markus Triska
ab3c520006
document ~| format modifier to place a tab stop at this position
...
This works best when used in tandem with ~N+, since it is currently
equivalent to ~0| and does not take the actual text position into account.
However, when using relative positions, this works as intended.
2020-04-19 01:59:16 +02:00
Markus Triska
45ed9405b0
use the most recent improvements
2020-04-19 01:34:13 +02:00
Mark Thom
9daf290432
remove SCCCutPolicy panic, revise (;)/2 so that comma'ed cuts are handled properly ( #361 )
2020-04-18 20:10:53 -06:00
notoria
c6a82cbc07
Removed a check in get_single_char
2020-04-18 14:16:46 -06:00
notoria
196d74c3a0
Fixed the predicate name when error is thrown
2020-04-18 14:16:46 -06:00
Markus Triska
f28e87b240
instead of a type error, use a domain error
...
The preceding use of atom_length/2 already ensures that C has the
correct type (i.e., atom). However, its domain may still be wrong,
if its length is greater than 1.
2020-04-18 14:16:46 -06:00
notoria
c24ebaf506
Moved get_single_char from builtins.pl to charsio.pl
2020-04-18 14:16:46 -06:00
notoria
d3a1f11dfe
Added predicate for reading a single character
2020-04-18 14:16:46 -06:00
Markus Triska
16e257ea32
ADDED: list_to_set/2, using the first occurrence of each element
...
Example:
?- list_to_set([B,a,b,a,B,A,b,A], Ls).
Ls = [B,a,b,A]
; false.
2020-04-18 14:16:40 -06:00
Mark Thom
474fa9b3ec
remove underscores in printed variables produced by write_term_to_chars ( #340 )
2020-04-18 14:16:40 -06:00
Mark Thom
7799ed36f0
provide better variable names in write_term_to_chars/3 ( #340 )
2020-04-14 10:39:10 -06:00
Mark Thom
db5ed345bc
improve writeX performance ( #290 )
2020-04-14 10:25:05 -06:00
Markus Triska
237c855f10
ADDED: group_pairs_by_key/2
...
Pairs must be keysorted and may also contain variables as keys.
Examples:
?- group_pairs_by_key([1-a,1-b,2-c], Ps).
Ps = [1-[a,b],2-[c]].
?- group_pairs_by_key([X-a,X-b,2-c], Ps).
Ps = [X-[a,b],2-[c]].
2020-04-14 00:10:33 +02:00
Markus Triska
ab9b604d02
the workaround is no longer necessary, since #336 is now corrected
2020-04-13 11:32:06 +02:00
Markus Triska
f52c9772a7
also include a newline in portray_clause/1
2020-04-13 01:24:15 +02:00
Markus Triska
208927544d
ADDED: provide a rudimentary version of portray_clause/1
...
At the moment, library(format) seems to be a fitting place.
In the eventual library organization, portray_clause/1 and
related predicates may be moved to their own dedicated library.
2020-04-13 01:04:52 +02:00
Mark Thom
0fad2f9953
make write_term_to_chars work with variable terms ( #335 )
2020-04-12 18:10:45 -06:00
Mark Thom
d3a9392421
provide read_term_from_chars/2 ( #334 )
2020-04-12 17:26:11 -06:00
Markus Triska
c9f1a95343
ENHANCED: ~w now supports compound terms, and ~q is now also available
2020-04-12 19:56:01 +02:00
Mark Thom
f2cf0ec459
move write_term_to_chars/3 to src/prolog/lib/charsio.pl
2020-04-12 14:42:39 -06:00
Mark Thom
0380d70a46
add write_term_to_chars/3 to iso_ext.pl ( #288 )
2020-04-12 14:29:28 -06:00
Mark Thom
0499005db5
throw error when trying to use partial lists as DCG terminal-sequence ( #286 )
2020-04-11 22:40:29 -06:00
Mark Thom
abc99c9dd8
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-04-11 21:59:25 -06:00
Mark Thom
92d8642133
do not accept [X|Xs] patterns as DCG non-terminals ( #286 )
2020-04-11 21:52:45 -06:00
Markus Triska
4d32b6976a
add library(freeze) to make zcompare/3 work
2020-04-08 22:09:59 +02:00
Markus Triska
e442fddc66
tuples_in/2 now works
2020-04-08 17:49:06 +02:00
Markus Triska
794ceac440
clpz_monotonic/0 --> monotonic/0
2020-04-06 23:05:57 +02:00
Markus Triska
8b1df2e9ca
ADDED: CLP(ℤ), Constraint Logic Programming over Integers
...
library(clpz) implements declarative integer arithmetic.
The most important predicates for reasoning about integers are:
(#=)/2 equality
(#\=)/2 disequality
(#<)/2 less than
(#>)/2 greater than
(#=<)/2 less than or equal to
(#>=)/2 greater than or equal to
In addition, the library provides several global constraints, such as
all_distinct/1 and global_cardinality/2, and reification predicates
that reflect the truth values of constraints into integer variables.
Enumeration predicates such label/1 and labeling/2 can be used to
search for solutions over finite domains.
Almost all Prolog programs also reason about integers. Therefore, I
recommend to add this library to your .scryerrc configuration file so
that declarative integer arithmetic is available in all your programs.
More information about CLP(ℤ):
https://www.metalevel.at/prolog/clpz
Enjoy!
2020-04-06 01:59:41 +02:00
Mark Thom
d76ae413c4
use fixnums in place of bignums where possible
2020-04-05 20:32:16 -06:00
Mark Thom
141f3bcec3
harmonize partial strings with complete strings ( #276 ), make Addr a copyable type
2020-04-03 10:22:46 -06:00
Markus Triska
f09a3142a6
ENHANCED: format_//2 now supports ~a, ~d, ~Nd, ~D, ~ND, ~Nn, ~i and ~*
2020-03-19 21:51:53 +01:00
Mark Thom
f9c4a40d60
add set_input/1, set_output/1
2020-03-15 23:29:21 -06:00
Mark Thom
325df8a6e3
add provisional max_depth option to write_term, speed printing of non-cyclic terms
2020-03-15 00:09:20 -06:00