Mark Thom
81f9666e82
cut after compound check in (;)/2 only after semicolon_compound_selector succeeds
2020-05-01 21:40:36 -06:00
Mark Thom
aa8659d5c7
insert cuts where needed into (;)/3 ( #434 )
2020-05-01 18:52:01 -06:00
Mark Thom
6f19649186
Merge pull request #436 from mthom/revert-419-cli
...
Revert "Enhanced command line"
2020-05-01 18:43:37 -03:00
Mark Thom
6a583b9b5b
Revert "Enhanced command line"
2020-05-01 15:43:20 -06:00
Mark Thom
6617b79cd8
Merge pull request #419 from notoria/cli
...
Enhanced command line
2020-05-01 18:32:02 -03:00
Mark Thom
46b695d093
accept any and all characters in comment chars
2020-05-01 16:39:27 -06:00
notoria
de8a017e80
Enhanced command line #2
2020-05-01 18:52:41 +02:00
Mark Thom
b71ec91f57
Merge pull request #432 from triska/master
...
correct overeager CLP(ℤ) goal expansion
2020-05-01 13:41:43 -03:00
Mark Thom
1b7c226779
correct failing character match in compare_pstr_to_string ( #397 )
2020-05-01 10:29:10 -06:00
Markus Triska
ca5a5b4392
correct overeager CLP(ℤ) goal expansion
...
For instance, consider:
t(X) :- X #= 1.
We *cannot* expand this to:
?- listing(t/1).
t(A) :-
( integer(A) ->
A=:=A
; ( var(A) ->
true
; true,
clpz:clpz_equal(A,A)
)
).
Also, a new binding *must not* be dragged outside of disjunctions,
since the code may look for example like this:
i(X) :-
( X #= 3
; X #= 4
).
This commit fixes such issues, and still rewrites CLP(ℤ) expressions
as far as possible already at compilation time.
For example:
n(X) :- X #= 1+3.
This is now compiled to (note that 1+3 is evaluated to 4):
?- listing(n/1).
n(A) :-
( integer(A) ->
A=:=4
; ( var(A) ->
A=4
; B=4,
clpz:clpz_equal(A,B)
)
).
Ideally, it should be compiled to:
n(4).
2020-05-01 18:29:00 +02:00
notoria
6ae7ae0210
Enhanced version
2020-05-01 16:46:31 +02:00
notoria
b911d2fda4
Enhanced command line
2020-05-01 16:19:06 +02:00
Mark Thom
847a92f580
map single character atoms down to characters in constant_index
2020-05-01 01:34:09 -06:00
Mark Thom
a346493de1
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-04-30 18:20:51 -06:00
Mark Thom
efd5d6efab
use slightly better names in indexing functions
2020-04-30 18:20:42 -06:00
Mark Thom
b6df5a4b7f
only add expanded goals to dynamic clause code ( #416 )
2020-04-30 17:53:26 -06:00
Mark Thom
34ae56e319
correct queue_len += queue_len; to queue_len += queue.len(); ( #416 )
2020-04-30 15:31:01 -06:00
Mark Thom
5870824d01
Merge pull request #425 from triska/master
...
enable goal expansion for CLP(ℤ) goals
2020-04-30 18:20:27 -03:00
Markus Triska
1dbadbfc35
enable goal expansion for CLP(ℤ) goals
...
Example:
integer_successor(I0, I) :- I #= I0 + 1.
Yielding:
?- listing(integer_successor/2).
integer_successor(A,B) :-
( integer(B) ->
( integer(A) ->
B=:=A+1
; C is B,
clpz:clpz_equal(C,A+1)
)
; ( integer(A) ->
( var(B) ->
B is A+1
; C is A+1,
clpz:clpz_equal(B,C)
)
; clpz:clpz_equal(B,A+1)
)
).
Thus, fast low-level arithmetic is used whenever possible.
2020-04-30 23:09:15 +02:00
Mark Thom
d3f1cd7411
index atoms with operators against the same atom with no operator ( #387 )
2020-04-30 15:09:05 -06:00
Mark Thom
a821daadd3
Merge pull request #420 from triska/master
...
correct verify_attributes/3 for variables that have no CLP(ℤ) attribute attached (#373 )
2020-04-30 13:32:21 -03:00
Markus Triska
a39f4b4487
correct verify_attributes/3 for variables that have no CLP(ℤ) attribute attached ( #373 )
...
Example:
?- freeze(B, queen_value_truth(C,N,B)), Q #= N #<==> B.
clpz:(Q#=N#<==>B), clpz:(B in 0..1), freeze:freeze(B,queen_value_truth(C,N,B))
; false.
2020-04-30 18:10:09 +02:00
Mark Thom
f7b401b9b6
fix user:goal_expansion
2020-04-30 09:28:11 -06:00
Mark Thom
c342d18f92
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-04-30 00:01:12 -06:00
Mark Thom
e0e52a3090
fix 'drain lower bound was too large', store user-level expansions to modules ( #416 )
2020-04-30 00:01:00 -06:00
Mark Thom
6f92480315
Merge pull request #418 from notoria/mediants
...
Documentation for arithmetic.pl
2020-04-29 18:53:00 -03:00
notoria
490d008edf
Merge pull request #4 from triska/mediants
...
include library(arithmetic) in the overview
2020-04-29 23:48:07 +02:00
notoria
ccee17c573
Merge branch 'mediants' into mediants
2020-04-29 23:47:05 +02:00
Mark Thom
dd4832e40b
add ordsets.pl to README
2020-04-29 18:42:17 -03:00
Mark Thom
ff5b870a9f
Merge pull request #417 from notoria/mediants
...
Implemented predicate mediants/2 with Stern-Brocot tree
2020-04-29 18:33:35 -03:00
notoria
a371580201
Add rational_numerator_denominator/3, number_to_rational/2 and renamed stern_brocot/3 to number_to_rational/3
2020-04-29 23:30:14 +02:00
Markus Triska
b499c575bc
include library(arithmetic) in the overview
...
Many thanks to @notoria for these very useful predicates!
2020-04-29 22:06:49 +02:00
notoria
f5a6268cef
Add rational_numerator_denominator/3, number_to_rational/2 and renamed stern_brocot/3 to number_to_rational/3
2020-04-29 21:52:01 +02:00
Mark Thom
2df4083602
use select to filter variable lists when printing equations of two variables
2020-04-29 11:05:10 -03:00
Mark Thom
2495fb796d
select variable names in write_eq based on whether RHS is a variable ( #326 )
2020-04-29 10:56:17 -03:00
notoria
f7b49740c1
Removed predicate mediants/2 and added stern_brocot/3
2020-04-29 14:18:20 +02:00
Mark Thom
7e765fe726
correct answer substitution order, equating variables to themselves ( #326 )
2020-04-29 01:45:42 -06:00
notoria
1d339f74d1
Implemented predicate mediants/2 with Stern-Brocot tree
2020-04-29 02:44:13 +02:00
Mark Thom
a3bb288f01
check that lower bound on term expansion drain is below the len of the term expansion vector, queue ( #416 )
2020-04-28 19:22:20 -06:00
Mark Thom
0e1226573a
print rational numbers using the rdiv operator when defined ( #413 )
2020-04-28 18:03:04 -06:00
Mark Thom
8151b65d12
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-04-28 17:20:25 -06:00
Mark Thom
eefd36b50d
do length check in PartialString::range_from ( #412 )
2020-04-28 17:20:14 -06:00
Mark Thom
6f4d769187
Merge pull request #414 from triska/master
...
Small corrections, additions and improvements
2020-04-28 16:54:39 -03:00
Markus Triska
20b76a703a
mention portray_clause/1 and listing/1
2020-04-28 18:27:46 +02:00
Markus Triska
dcc09b7bb5
mention backtrackable and non-backtrackable global variables
2020-04-28 18:22:18 +02:00
Markus Triska
4ea0dee90a
use new nth0/3 from library(lists)
2020-04-28 17:59:49 +02:00
Markus Triska
e61116d35a
use singleton variable, correct a mistake in maplist/8
2020-04-28 17:59:49 +02:00
Markus Triska
f7256c75d5
ADDED: nth0/3, relating indices to list elements
2020-04-28 17:59:49 +02:00
Markus Triska
2696fd1291
small typographic corrections
2020-04-28 17:59:49 +02:00
Markus Triska
b139620fba
use new predicates from library(error) to throw type and domain errors
2020-04-28 17:59:49 +02:00