Hi,
I am trying to use the write command in the following way for instructional purposes but am getting an error. Please let me know the solution.
Thanks, Srini.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ?- greet(hamish):- write('How are you doin, pal?'). greet(amelia):- write('Awfully nice to see you!'). {SYNTAX ERROR: (lns 88-91) , or ) expected in arguments greet( hamish ) :- write( How are you doin, pal?'). greet(amelia):- write( ** here ** Awfully nice to see you ! ) . }
no ?-
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------
Dear Srini,
note that you cannot type clauses into the top level like that. Instead, create a file, say foo.pl, that contains:
:- module(_,_).
greet(hamish):- write('How are you doin, pal?'). greet(amelia):- write('Awfully nice to see you!').
and load it into the top level doing:
?- use_module(foo).
Then, you can do, for example:
?- greet(hamish).
In fact, the best way to do it is from the graphical (emacs) iterface: open the file with emacs and do "C-cl" (or push the load button on the toolbar).
Dear Srini,
You cannot write the program in the toplevel, you have to write a file with the program:
% ---------------- greet.pl ---------------- %
greet(hamish):- write('How are you doin, pal?'). greet(amelia):- write('Awfully nice to see you!').
% ------------------------------------------ %
And load it in the toplevel:
?- ensure_loaded(greet). yes ?- greet(X). How are you doin, pal? X = hamish ? ; Awfully nice to see you! X = amelia ? ;
no ?-
Regards,
Daniel
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------