implement requirements for checking a task.
This commit is contained in:
parent
e05096734e
commit
88c2ae30f7
19
todo.pl
19
todo.pl
@ -32,15 +32,28 @@ new(X) :-
|
||||
asserta(task(X, todo)),
|
||||
write("added task "),
|
||||
write(X).
|
||||
check(X) :- idx(X, Task), check(Task).
|
||||
check(X) :-
|
||||
task(X, todo),
|
||||
\+ (requires(Y, X), task(Y,todo)),
|
||||
asserta(task(X, done)),
|
||||
retractall(task(X, todo)),
|
||||
write("marked "),
|
||||
write(X),
|
||||
write(" as done").
|
||||
check(X) :- idx(X, Task), check(Task).
|
||||
|
||||
write(" as done"),
|
||||
!.
|
||||
check(X) :-
|
||||
task(X, todo),
|
||||
(requires(Y, X), task(Y,todo)),
|
||||
write("you need to do "),
|
||||
write(Y),
|
||||
write(" before doing "),
|
||||
write(X),
|
||||
!.
|
||||
check(X) :-
|
||||
\+ task(X, todo),
|
||||
write("no such task as "),
|
||||
write(X).
|
||||
|
||||
save_task(Task, Stream) :-
|
||||
task(Task, State),
|
||||
|
Loading…
Reference in New Issue
Block a user