Mark Thom
26d483f2d7
place cut after infinitely expanding VarList in write_term_to_chars/3 ( #476 )
2020-05-10 13:30:30 -06:00
Mark Thom
dc5626f34d
Merge pull request #474 from triska/radix
...
ADDED: ~Nr and ~NR are now available for radix conversions
2020-05-09 15:09:14 -03:00
Mark Thom
2717ec2759
Merge pull request #471 from triska/master
...
ADDED: Initial version of library(crypto).
2020-05-09 14:33:58 -03:00
Mark Thom
b0ae44bc25
Merge branch 'sockets-develop'
2020-05-09 14:26:29 -06:00
Mark Thom
0c94124fdf
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-05-09 14:26:22 -06:00
Mark Thom
6f927b9941
add set_stream_position/2
2020-05-09 14:20:32 -06:00
Markus Triska
d75449ea63
ADDED: ~Nr and ~NR are now available for radix conversions
2020-05-09 19:19:25 +02:00
Mark Thom
034f5b16bd
add at_end_of_stream/{0,1}
2020-05-09 01:38:23 -06:00
Mark Thom
5be771842f
add stream_property/2
2020-05-09 00:56:17 -06:00
Markus Triska
a131c93a14
ADDED: Initial version of library(crypto).
2020-05-08 22:33:49 +02:00
notoria
47f5223c37
Enhanced shift/1
2020-05-07 19:10:21 +02:00
Mark Thom
b8c50eb0fe
add peek_char/{1,2}, peek_byte/{1,2}, peek_code/{1,2}
2020-05-06 01:05:03 -06:00
Mark Thom
fe05082ddc
add sockets library, use new type_error function from sockets system calls
2020-05-05 22:57:06 -06:00
Mark Thom
414acda9e0
add put_code/{1,2}, get_code/{1,2}, improve get_* predicates
2020-05-05 22:42:35 -06:00
Mark Thom
47e3a5e75a
add put_byte/{1,2}, put_char/{1,2}
2020-05-05 17:42:18 -06:00
Mark Thom
573df892bc
cleanup on reading predicates, add get_char/{1,2}
2020-05-05 16:54:40 -06:00
Mark Thom
bfced59949
clean up stream error handling, add get_byte/{1,2}
2020-05-05 16:09:17 -06:00
Mark Thom
53ae8b9bd1
add flush_output/{0,1}, past_end_of_stream
2020-05-05 14:10:49 -06:00
Mark Thom
ab62603c5a
add close/{1,2}, better EOF action handling in read_term
2020-05-05 00:38:21 -06:00
Mark Thom
dd247cd541
adapt write_term family, add handling for EOF actions.
2020-05-04 21:17:06 -06:00
Mark Thom
0d7a9f32d6
add open/3, write_term/3
2020-05-04 14:50:26 -06:00
Mark Thom
8e9273a96a
test
2020-05-04 11:18:13 -06:00
Markus Triska
2dfdaaa4ba
disable goal expansion until #445 is resolved
2020-05-04 18:55:52 +02:00
Mark Thom
a49230c0e1
Merge branch 'master' into sockets-develop
2020-05-03 23:09:13 -06:00
Mark Thom
b5368207d6
merge with master
2020-05-03 18:49:15 -06:00
Markus Triska
605c233753
do not project queue/2 attributes to residual goals
2020-05-04 00:54:43 +02:00
Mark Thom
848425418b
Project goals of query variables ( #362 )
2020-05-02 22:27:32 -06:00
Mark Thom
99f66200f7
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-05-02 18:47:53 -06:00
Mark Thom
b642bd2cfd
add term_attributed_variables/2 ( #422 )
2020-05-02 18:46:29 -06:00
Mark Thom
c062b7c9da
Merge pull request #443 from notoria/arithmetic
...
Implemented expmod/4
2020-05-02 12:00:44 -03:00
notoria
7df7901532
Implemented expmod/4
2020-05-02 14:56:07 +02:00
Mark Thom
9dabce819a
remove now unnecessary dependencies, correct ordering of ! in (;)/3
2020-05-01 23:38:44 -03:00
Mark Thom
a019109857
Merge pull request #440 from notoria/arithmetic
...
Enhanced number_to_rational/2 and number_to_rational/3
2020-05-01 21:48:55 -03:00
Mark Thom
fd5ff20b68
Merge branch 'master' of https://github.com/mthom/rusty-wam
2020-05-01 21:40:45 -06:00
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
notoria
9df2df0f9f
Enhanced number_to_rational/2 and number_to_rational/3
2020-05-02 02:36:23 +02:00
Markus Triska
ec6d725587
use ℤ
...
This is now possible thanks to the great contribution by @matt2xu.
Many thanks!
2020-05-02 00:06:16 +02: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
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
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
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
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
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
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