Commit c366cc4d authored by Paul Lesur's avatar Paul Lesur

Add readme.md

parents
### Member
```prolog
member(X, [X|_]).
member(X, [_|Tail]) :-
member(X, Tail).
```
### Append
```prolog
append([],X,X).
append([X|Y],Z,[X|W]) :- append(Y,Z,W).
```
### Reverse
```prolog
reverse([],[]).
reverse([X|Xs],YsX) :- reverse(Xs,Ys), append(Ys,[X],YsX).
```
### Length
```prolog
len([], 0).
len([_ | Tail], Length) :-
len(Tail, Length1),
Length is Length1 + 1,!.
```
### Nième élément
```prolog
element_n(1,[X|Q],X):-!.
element_n(N,[T|Q],X):-M is N-1, element_n(M,Q,X).
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment