saludo(X):- nl, write('Hola '), write(X), nl.
name:- write('Anote su nombre:'), read(Nombre), 
    nl, write('Hola '),write(Nombre).

alumno(moises,fecha(14,10,1974)).
alumno(moises,matricula(8900318,g)).
alumno(angel_medina,fecha(24,04,1991)).
alumno(angel_medina,matricula(0906227,x)).

suma(A,B,C):-C is A+B.
resta(A,B,C):-C is A-B.
mul(A,B,C):-C is A*B.
div(A,B,C):-C is A/B.
modulo(A,B,C):-C is A mod B.

%ciclos, tabla de multiplicar
tabla(M, N,X):- M<N, nl, write(M), write(' x '),write(X),
    R is M*X,write(' = '),write(R),
    NuevoM is M+1, tabla(NuevoM, N,X).
tabla_de:-read(X),tabla(1,10,X).

% LISTAS imprimir es equivalente a recorrer una lista
imprimir( [A | B] ):- write(A),nl, imprimir(B). 

agregar([A | ColaA], B,[A|ColaC]):- agregar(ColaA, B, ColaC).
concatena([], L, L).
concatena([X|L1], L2, [X|L3]):-concatena(L1, L2, L3).

