#Visual Prolog
Visual Prolog: Insertar un elemento al final de una lista
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
% Copyright Richard Cotrina ©2015 | |
class main | |
open core | |
domains | |
lista = integer*. | |
predicates | |
classInfo : core::classInfo. | |
insFinal : (lista, integer, lista) procedure (i, i,o). | |
predicates | |
run : core::runnable. | |
end class main |
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
% Copyright Richard Cotrina ©2015 | |
implement main | |
open core | |
constants | |
className ="main". | |
classVersion = "". | |
clauses | |
classInfo(className, classVersion). | |
insFinal([], E, [E]). | |
insFinal([Cabeza|Resto], Elemento, [Cabeza|Lista]):- | |
insFinal(Resto, Elemento, Lista). | |
clauses | |
run() :- | |
console::init(), | |
insFinal([1,2,3,4],5, NuevaLista), | |
stdio::write("Salida---> Nueva Lista = ", NuevaLista), | |
stdio::nl, | |
programControl::sleep(4000), | |
succeed. | |
end implement main | |
goal | |
mainExe::run(main::run). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment