Logic Programming

  • Family.

    These questions use the following data base:

    gender(al,male).
    gender(anne,female).
    gender(arthur,male).
    gender(amber,female).
    gender(boris,male).
    gender(barbara,female).
    gender(betty,female).
    gender(buck,male).
    gender(carla,female).
    gender(charles,male).
    gender(cora,female).
    gender(cuthbert,male).
    gender(cecilia,female).
    gender(calvin,male).
    
    father(arthur,buck).
    father(al,buck).
    father(amber,buck).
    father(anne,boris).
    father(barbara,charles).
    father(betty,cuthbert).
    father(boris,charles).
    father(buck,calvin).
    
    mother(al,barbara).
    mother(anne,betty).
    mother(arthur,barbara).
    mother(amber,barbara).
    mother(boris,carla).
    mother(barbara,carla).
    mother(betty,cora).
    mother(buck,cecilia).
    
  • List processing.

    Here is the definition of "append".

    append([], A, A).
    append([A|B], C, [A|D]) :-
            append(B, C, D).