2016-11-17 107 views

回答

1

如果你想舉辦XSB在服務器上,只需要用子進程將催生對XSB

看到XSB Manual

spawn_process(+CmdSpec,-StreamToProc,-StreamFromProc,-ProcStderrStream,ProcId)

菌種由CmdSpec

一個XSB子過程的用途是創建一個派生的子進程XSB服務器指定的新工藝和 控制它們。 產生的子流程可以是另一個XSB流程。 下面的示例示出了一個XSB過程產卵另一個,發送一個目標來評估和獲得的結果:

`| ?-` spawn_process([xsb], To, From,Err,_), 
    file_write(To,’assert(p(1)).’), 
    file_nl(To), 
    file_flush(To,_), 
    file_write(To,’p(X), writeln(X).’), 
    file_nl(To), 
    file_flush(To,_), 
    file_read_line_atom(From,XX). 

`XX = 126` 
`yes` 
`| ?-` 
"Here the parent **XSB** process sends 「 
`assert(p(1)).` 
」 and then 「 
`p(X), writeln(X).` 
」 to the spawned XSB subprocess." 
"The latter evaluates the goal and prints (via 「 `writeln(X)` 」) 
to its standard output..."