[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: append 3 lists in the same time

From: Lindsey Spratt
Subject: Re: append 3 lists in the same time
Date: 29 Mar 2002 08:24:52 -0600

On Fri, Mar 29, 2002 4:36 AM, Gurvan Le Guernic <mailto:address@hidden>
>instead of typing: append(A,B,L1), append(L1,C,L).
>we could type something like: L=A o B o C.

Here is one approach.

If you'd be willing to type: A o B o C o L, where L is the "result" list,
then this can be implemented in standard prolog using an operator.

A possible implementation:

:- op( 900, xfy, o).

o( A, o( B, C)) :- append(A, B, X), o(X, C).
o( X, X) :- X \= o(_, _).

'A o B o L.' -> 'append( A, B, L).'
'A o B o C o L.' -> 'append(A, B, X), append(X, C, L).'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]