我正在Prolog使用一种工具,在我执行之后,结果将出现在屏幕上,在Prolog壳体内。 我如何把这一结果复制到另一个档案中?
I ve read about it in a book but it wasn t explained at all. I also never saw it in a program. Is part of Prolog syntax? What s it for? Do you use it?
我正在Prolog使用一种工具,在我执行之后,结果将出现在屏幕上,在Prolog壳体内。 我如何把这一结果复制到另一个档案中?
you never said what prolog interpreter you re using. This code works for Edinburgh-compatible version of Prolog, SWI-Prolog (on Fedora) in my case.
如果有文件,请:
hello_world :- write( Hello World! ).
then
consult( hello ).
qsave_program(hello,[stand_alone(true),goal(hello_world)]).
空档和空壳:
$chmod +x hello
./hello > output_file
it doesn t return to shell when it s done, so you need to find a way to check whether or not your program finished execution and then Ctrl-d and check your output_file hope this helps
从指挥线来看,你可以这样做:
script <file Name>
run your prolog program
exit
I ve read about it in a book but it wasn t explained at all. I also never saw it in a program. Is part of Prolog syntax? What s it for? Do you use it?
I am trying to learn a little bit about swi-prolog (beyond the basic, useless programs). Can anyone explain (perhaps in pseudocode) what this sudoku solver and the related functions are doing? If ...
First off let me state that this is part of a class exercise given as homework. But, the entire assignment is much more involved than the subject of this question. So.. I am searching through two ...
Q. Given [1,2,3] in Prolog get back [6,5,3] by reverse accumulation I have the start code: accumalate([H],[H]). accumalate([H1 | H2], [Hnew, H2]), Hnew is H1 + H2. .... I am looking for ...
I m trying to write a function that will test to see if the word hello is contained in a list. If it is contained, i don t want it to say "true", i want it to say : "yes, the word hello is contained ...
How to determine whether two list have same element in prolog? If i have two list A and B, i want to know whether they have the same element.
I have a question I would like to ask you something about a code snippet: insert_pq(State, [], [State]) :- !. insert_pq(State, [H|Tail], [State, H|Tail]) :- precedes(State, H). insert_pq(State, [...
I know how to iterate over lists in Prolog to find the maximum, but what if each thing is a separate clause? For example if I had a bunch of felines and their ages, how would I find the oldest kitty? ...