i write a code , to get some specific output (2 List) , and it's work , and give me what i need , but there are unassigned element in the two list ,as shown below ,so my question is : how to delete thess unassigned elements .
Courses = [_G1619, linear, _G1607, physics2, physics1, calculas1|_G1590],
Marks = [_G1622, 78, _G1610, 90, 80, 78|_G1593]
In SWI-Prolog there are some list processing utilities like exclude/3, that allow to specify a predicate to be used on each element. var/1 seems appropriate. For instance
2 ?- exclude(var,[1,A,B,2,3|L],R).
L = [],
R = [1, 2, 3] ;
...
(note: place a cut after the call to get rid of nondeterminism).
I was surprised to find it also removed the unbounded tail - I thought it would require a proper list. Then it should fit your request.