Re: It seems that I found prolog in prolog
- From: newser.bbs@xxxxxxxxxxxxxxxxx
- Date: 24 May 2006 01:16:01 -0700
Joachim Schimpf wrote:
toplevel :-
write('?- '),
read_term(Query, [variable_names(NameVarPairs)]),
(
call(Query),
write(NameVarPairs),
get_char(Command),
Command \= (;)
->
write(yes)
;
write(no)
),
nl,
toplevel.
The key idea in your codes in the procedure call/1,
that makes me check the function of call/1.
If my auto-programming program writes codes
char by char , just as a person does , thus the
codes to be executed were in the form of string,
say,"write(hell_world)." Can the hello_world
program created by my program run via call/1?
Look :
------------------------------------------------------------------------------
Welcome to SWI-Prolog (Multi-threaded, Version 5.2.13)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
1 ?- string_to_atrom(S,'write(hello_world).'),
| call(S).
Correct to: string_to_atom(S, write(hello_world).)? yes
ERROR: Type error: `callable' expected, found `"write(hello_world)."'
2 ?-
------------------------------------------------------------------------------------------
Anybody can see call/1 doesn't work , even for the simplest
program , eg Hello World.
There is obvious gap between the codes written by my program
and the "calable" . Is there any solution to this gap ?
.
- Follow-Ups:
- Re: It seems that I found prolog in prolog
- From: Joachim Schimpf
- Re: It seems that I found prolog in prolog
- From: newser . bbs
- Re: It seems that I found prolog in prolog
- References:
- It seems that I found prolog in prolog
- From: newser . bbs
- Re: It seems that I found prolog in prolog
- From: Cesar Rabak
- Re: It seems that I found prolog in prolog
- From: newser . bbs
- Re: It seems that I found prolog in prolog
- From: Joachim Schimpf
- It seems that I found prolog in prolog
- Prev by Date: read doesn't read back from writeq
- Next by Date: Re: String is not string in SWI prolog , part/2.
- Previous by thread: Re: It seems that I found prolog in prolog
- Next by thread: Re: It seems that I found prolog in prolog
- Index(es):
Relevant Pages
|
|