Skip to content
Discussion options

You must be logged in to vote

Okay, it is a bit convoluted, but I was able to achieve the same behavior as using a named predicate in the following manner:

?- Res+\(Schedule=[t1/1/2/4,t2/1/0/2,t3/2/0/2,t4/1/6/20,t5/2/6/20,t6/3/2/11,t7/3/13/11],
         N=1,
         TaskN=(\A^Goal^T^(Goal=_/B/_/_,=(A,B,T))),
         Tn=(\Goal^T^(call(TaskN, N, Goal, T))),
         tfilter(Tn,Schedule,Res)
        ).
%@   Res = [t1/1/2/4,t2/1/0/2,t4/1/6/20].


?- Res+\(Schedule=[t1/1/2/4,t2/1/0/2,t3/2/0/2,t4/1/6/20,t5/2/6/20,t6/3/2/11,t7/3/13/11],
         N=1,
         tfilter(taskn(N),Schedule,Res)
        ).
%@   Res = [t1/1/2/4,t2/1/0/2,t4/1/6/20].

The world makes sense again! The advantage of using a named predicate is that ther…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jjtolton
Comment options

Answer selected by jjtolton
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants