Prolog if/else-Anweisung mit "oder" - Bedingung

Ich bin neu in Prolog, und ich bin versucht zu schreiben, eine if/else-Anweisung mit einer "oder" - Bedingung. Also, um zu demonstrieren, möchte ich etwas wie:

 gothrough([H|T], B, C):-
    (  T == [] or H == 'then'  %if either the tail is an empty list or if H == "then", do the following%
    -> append(H,B,B), outputs(B,C)
    ;  append(H,B,B), gothrough(T, B, C) %else%
    ).

Diese Umsetzung nicht funktioniert, aber; ist es eine offensichtliche Weg, dies zu tun, ich bin nicht immer?

Dank!

InformationsquelleAutor pauliwago | 2013-02-18

Schreibe einen Kommentar