use select to filter variable lists when printing equations of two variables
This commit is contained in:
@@ -78,7 +78,7 @@ needs_bracketing(Value, Op) :-
|
|||||||
memberchk(EqSpec, [fx,xfx,yfx])
|
memberchk(EqSpec, [fx,xfx,yfx])
|
||||||
).
|
).
|
||||||
|
|
||||||
write_goal(G, VarList, MasterVarList, MaxDepth) :-
|
write_goal(G, VarList, MaxDepth) :-
|
||||||
( G = (Var = Value) ->
|
( G = (Var = Value) ->
|
||||||
( var(Value) ->
|
( var(Value) ->
|
||||||
select((Var = _), VarList, NewVarList)
|
select((Var = _), VarList, NewVarList)
|
||||||
@@ -94,10 +94,10 @@ write_goal(G, VarList, MasterVarList, MaxDepth) :-
|
|||||||
)
|
)
|
||||||
; G == [] ->
|
; G == [] ->
|
||||||
write('true')
|
write('true')
|
||||||
; write_term(G, [quoted(true), variable_names(MasterVarList), max_depth(MaxDepth)])
|
; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth)])
|
||||||
).
|
).
|
||||||
|
|
||||||
write_last_goal(G, VarList, MasterVarList, MaxDepth) :-
|
write_last_goal(G, VarList, MaxDepth) :-
|
||||||
( G = (Var = Value) ->
|
( G = (Var = Value) ->
|
||||||
( var(Value) ->
|
( var(Value) ->
|
||||||
select((Var = _), VarList, NewVarList)
|
select((Var = _), VarList, NewVarList)
|
||||||
@@ -117,16 +117,16 @@ write_last_goal(G, VarList, MasterVarList, MaxDepth) :-
|
|||||||
)
|
)
|
||||||
; G == [] ->
|
; G == [] ->
|
||||||
write('true')
|
write('true')
|
||||||
; write_term(G, [quoted(true), variable_names(MasterVarList), max_depth(MaxDepth)])
|
; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth)])
|
||||||
).
|
).
|
||||||
|
|
||||||
write_eq((G1, G2), VarList, MasterVarList, MaxDepth) :-
|
write_eq((G1, G2), VarList, MaxDepth) :-
|
||||||
!,
|
!,
|
||||||
write_goal(G1, VarList, MasterVarList, MaxDepth),
|
write_goal(G1, VarList, MaxDepth),
|
||||||
write(', '),
|
write(', '),
|
||||||
write_eq(G2, VarList, MasterVarList, MaxDepth).
|
write_eq(G2, VarList, MaxDepth).
|
||||||
write_eq(G, VarList, MasterVarList, MaxDepth) :-
|
write_eq(G, VarList, MaxDepth) :-
|
||||||
write_last_goal(G, VarList, MasterVarList, MaxDepth).
|
write_last_goal(G, VarList, MaxDepth).
|
||||||
|
|
||||||
graphic_token_char(C) :-
|
graphic_token_char(C) :-
|
||||||
memberchk(C, ['#', '$', '&', '*', '+', '-', '.', ('/'), ':',
|
memberchk(C, ['#', '$', '&', '*', '+', '-', '.', ('/'), ':',
|
||||||
@@ -156,12 +156,12 @@ write_eqs_and_read_input(B, VarList) :-
|
|||||||
( Goals == [] ->
|
( Goals == [] ->
|
||||||
write('true.'), nl
|
write('true.'), nl
|
||||||
; thread_goals(Goals, ThreadedGoals, (',')),
|
; thread_goals(Goals, ThreadedGoals, (',')),
|
||||||
write_eq(ThreadedGoals, NewVarList, NewVarList, 20),
|
write_eq(ThreadedGoals, NewVarList, 20),
|
||||||
write('.'),
|
write('.'),
|
||||||
nl
|
nl
|
||||||
)
|
)
|
||||||
; thread_goals(Goals, ThreadedGoals, (',')),
|
; thread_goals(Goals, ThreadedGoals, (',')),
|
||||||
write_eq(ThreadedGoals, NewVarList, NewVarList, 20),
|
write_eq(ThreadedGoals, NewVarList, 20),
|
||||||
read_input(ThreadedGoals, NewVarList)
|
read_input(ThreadedGoals, NewVarList)
|
||||||
).
|
).
|
||||||
|
|
||||||
@@ -170,12 +170,12 @@ read_input(ThreadedGoals, NewVarList) :-
|
|||||||
( C = w ->
|
( C = w ->
|
||||||
nl,
|
nl,
|
||||||
write(' '),
|
write(' '),
|
||||||
write_eq(ThreadedGoals, NewVarList, NewVarList, 0),
|
write_eq(ThreadedGoals, NewVarList, 0),
|
||||||
read_input(ThreadedGoals, NewVarList)
|
read_input(ThreadedGoals, NewVarList)
|
||||||
; C = p ->
|
; C = p ->
|
||||||
nl,
|
nl,
|
||||||
write(' '),
|
write(' '),
|
||||||
write_eq(ThreadedGoals, NewVarList, NewVarList, 20),
|
write_eq(ThreadedGoals, NewVarList, 20),
|
||||||
read_input(ThreadedGoals, NewVarList)
|
read_input(ThreadedGoals, NewVarList)
|
||||||
; member(C, [';', ' ', n]) ->
|
; member(C, [';', ' ', n]) ->
|
||||||
nl, write('; '), false
|
nl, write('; '), false
|
||||||
|
|||||||
Reference in New Issue
Block a user