Executing an ECLiPSe Goal From Tcl

## 6.5 Executing an ECLiPSe Goal From Tcl

An ECLiPSe predicate can be invoked from the Tcl side using the remote ECLiPSe predicate call (ec_rpc) facility. This should be the main method of interacting and communicating with ECLiPSe in the remote interface. Information can be sent to ECLiPSe via bindings for (input) arguments when the call is made; and results returned from ECLiPSe via the bindings made to (output) arguments:

ec_rpc goal ?format?
  Remote ECLiPSe predicate call. It calls goal in the default module. The goal should be simple in the sense that it can only succeed, fail or throw. Any choice-points the goal leaves will be discarded.
  Calls to ec_rpc can be nested and can be used from within Tcl queue event handlers. However, an ec_rpc cannot be issued while ECLiPSe side has control.
  If no format argument is given, the goal is assumed to be in ECLiPSe syntax. If a format argument is provided, the ECLiPSe goal is constructed from goal and format, according to the conversion rules explained in section 5.8.
  On success, ec_rpc returns the (possibly more instantiated) goal as a Tcl data structure (in EXDR format), otherwise "fail" or "throw" respectively.