make commands for adding new requirements
This commit is contained in:
parent
88c2ae30f7
commit
cace6f9569
25
todo.pl
25
todo.pl
@ -28,10 +28,35 @@ list_done :- all_tasks(L, done), print_task_list(L,1).
|
||||
print_list([]).
|
||||
print_list([H|T]) :- write(H),nl, print_list(T).
|
||||
|
||||
new(X) :-
|
||||
task(X, todo),
|
||||
write("task already exist"),
|
||||
!.
|
||||
new(X) :-
|
||||
asserta(task(X, todo)),
|
||||
write("added task "),
|
||||
write(X).
|
||||
new(X,Y) :- idx(Y, Task), new(X, Task).
|
||||
new(X,Y) :-
|
||||
asserta(task(X, todo)),
|
||||
asserta(requires(X, Y)),
|
||||
write("added task "),
|
||||
write(X),
|
||||
write(" as a subtask for "),
|
||||
write(X).
|
||||
depend(X,Y) :- idx(X, Task), depend(Task, Y).
|
||||
depend(X,Y) :- idx(Y, Task), depend(X, Task).
|
||||
depend(X,Y) :-
|
||||
task(X, todo),
|
||||
task(Y, _),
|
||||
asserta(requires(X, Y)).
|
||||
depend(X,Y) :-
|
||||
task(X, done),
|
||||
task(Y, _),
|
||||
retractall(task(Y, _)),
|
||||
asserta(task(Y, todo)),
|
||||
asserta(requires(X, Y)).
|
||||
|
||||
check(X) :- idx(X, Task), check(Task).
|
||||
check(X) :-
|
||||
task(X, todo),
|
||||
|
Loading…
Reference in New Issue
Block a user