-->

Visual Prolog Program to append two list.

Visual Prolog Program to append two list.

    Here the two list are taken by the predicate “append” and returns the appended list. To append two list a list is broken continuously until the last empty list is encountered and finally the other list is appended or joined at the end of first recursively. The code to append is given as follows:

    DOMAiNS
    int_list = integer*

    PREDICATES
    append(int_list, int_list, int_list)

    CLAUSES
    append([],L,L).
    append([H|L1], L2, [H|L3]):-append(L1,L2,L3).

    GOAL
    append([1,2,3,4],[5,6,7,8],Z).

    fardi zayden
    @مرسلة بواسطة
    كاتب ومحرر اخبار اعمل في موقع دراسات تقنية .

    إرسال تعليق