/*
Concatentate strings, using append. If the below is asked,
?-append( "ABC", "DEF", X ), append( "123", X, Y ), append( Y, "XYZ", Z ),
printstring( Z ).
you will get: Z = "123ABCDEFXYX", printed out as a list of ASCII codes. */
append( [], L, L ).
append( [Z|L1], L2, [Z|L3] ) :- append( L1, L2, L3 ).
printstring( [] ).
printstring( [H|T] ) :- put( H ), printstring( T ).
lips(L) :- rev( [1,2,3,4,5,6,7,8,9,0,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30], L ).
lip(L) :- rev( [1,2,3,4], L ).
l(L) :- rev( [1,2], L ).
l1(L) :- rev( [1], L ).
rev( [], [] ).
rev( [H|T], L ) :- rev( T,Z), append( Z, [H], L ).
J'ai trouvé ça a quelque part...
C'est donc ben laid?
Les profs devraient tous utiliser Java pis nous calisser patience.
|