Created
March 9, 2022 10:11
-
-
Save mrsolarius/16d5f6ab60afb51ece719c7517fd140e to your computer and use it in GitHub Desktop.
Comment faire une fonction d'inversion de liste en Erlang ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Implementer : | |
% Spec : inv/1. | |
% inv(L) renvoie la liste inverse de L | |
% | |
% Exemple : | |
% inv([1,2,3]) = [3,2,1] | |
% Analyse | |
% sur L : 2 cas | |
% 1) L = [] : dans se cas renvoie d'une liste vide | |
inv([])->[]; | |
% 2) L =/= [] : L = [Pr|Fin] | |
inv([Pr|Fin])->inv(Fin)++[Pr]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment