fix foreach
This commit is contained in:
parent
9b6bcdde16
commit
5b19e9546a
@ -809,23 +809,23 @@ index(I..J, _M, [I|O] ) :- !,
|
|||||||
index(I:J, _M, [I|O] ) :- !,
|
index(I:J, _M, [I|O] ) :- !,
|
||||||
I1 is I, J1 is J,
|
I1 is I, J1 is J,
|
||||||
once( foldl(inc, O, I1, J1) ).
|
once( foldl(inc, O, I1, J1) ).
|
||||||
index(I+J, _M, O ) :- !,
|
index(I+J, M, O ) :- !,
|
||||||
index(I, M, I1),
|
index(I, M, I1),
|
||||||
index(J, M, J1),
|
index(J, M, J1),
|
||||||
add_index(I1, J1, O).
|
add_index(I1, J1, O).
|
||||||
index(I-J, _M, O ) :- !,
|
index(I-J, M, O ) :- !,
|
||||||
index(I, M, I1),
|
index(I, M, I1),
|
||||||
index(J, M, J1),
|
index(J, M, J1),
|
||||||
sub_index(I1, J1, O).
|
sub_index(I1, J1, O).
|
||||||
index(I*J, _M, O ) :- !,
|
index(I*J, M, O ) :- !,
|
||||||
index(I, M, I1),
|
index(I, M, I1),
|
||||||
index(J, M, J1),
|
index(J, M, J1),
|
||||||
O is I1*J1.
|
O is I1*J1.
|
||||||
index(I div J, _M, O ) :- !,
|
index(I div J, M, O ) :- !,
|
||||||
index(I, M, I1),
|
index(I, M, I1),
|
||||||
index(J, M, J1),
|
index(J, M, J1),
|
||||||
O is I1 div J1.
|
O is I1 div J1.
|
||||||
index(I rem J, _M, O ) :- !,
|
index(I rem J, M, O ) :- !,
|
||||||
index(I, M, I1),
|
index(I, M, I1),
|
||||||
index(J, M, J1),
|
index(J, M, J1),
|
||||||
O is I1 rem J1.
|
O is I1 rem J1.
|
||||||
@ -1387,4 +1387,3 @@ ints(A,B,O) :-
|
|||||||
( A > B -> O = [] ; O = [A|L], A1 is A+1, ints(A1,B,L) ).
|
( A > B -> O = [] ; O = [A|L], A1 is A+1, ints(A1,B,L) ).
|
||||||
|
|
||||||
zero(_, 0).
|
zero(_, 0).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user