LA AYUDA COMPLETA ESTA EN
SWI-Prolog 5.6.10 Reference Manual
LECTURA DE TECLADO
comando salida
----------------------------------------------------------------------------------------
readln(X) Lo que se teclee lo convierte a lista
ESCRITURA DE CADENAS -4.32 Formatted Write-
comando salida
----------------------------------------------------------------------------------------
write('hola mundo'). hola mundo
write("hola mundo"). [104, 111, 108, 97, 32, 109, 117, 110, 100, 111]
writeln('hola'). hola\n
X=hola,
Y=rafa,
sformat(Salida, '~w ~w', [X, Y]) Salida='hola rafa'
OPERADORES -4.26 Arithmetic-
comando salida
----------------------------------------------------------------------------------------
>, <, +, -, *, /, ^ lo que indican
=<, >= no deben confundirse con flechas (=>, <=)
\= diferente
X is 5 + 3 forza la instanciaciOn de una variable
not(P) Se cumple si falla P
min(A,B) Obtiene el valor mas chico
max(A,B) Obtiene el valor mas grande
SOBRE ATOMOS EN LISTAS -4.21 Analysing and Constructing Atoms-
comando salida
----------------------------------------------------------------------------------------
atom_chars(hello, X). X = [h, e, l, l, o]
concat_atom([gnu, gnat], ', ', A). A = 'gnu, gnat'
MANIPULACION DE LISTAS -A.1 library( lists ): List Manipulation-
comando salida
----------------------------------------------------------------------------------------
append(List1, List2, List3) List3 = List1 + List2