calling YAP from R

Functions:

1. void install_real(void):

1. LogicalVector f():

1. RCPP_MODULE(yap4r):

1. yap4r::yap4r(): : Wrapper allowing R to control an YAP environment.

First, it creates an YAP engine using the C++ YAPEngine class; Second, it installs the Real library, both Prolog and C.

@examples library(yap4r) y <- new(yap4r)

1. SEXP yap4r::query(std::string query): : query the YAP database x a text query.

The output is a S-EXP.

query as a list of characters

The function often starts a sequence:

  • query(S): create a query and get the first answer;

  • [more()](group__YAP4R_1gacf6a09888c11da14bfb209f226dbde81.md): get an extra answer;

  • [done()](group__YAP4R_1ga871ae649942f594b2fee597fa692c03b.md): recover the query.

An answer is a vector of S-expressions, with one per query variable.

@examples y$query('current_predicate(X,Y)')

group__YAP4R_1autotoc_md53

_X

group__YAP4R_1autotoc_md54

text_que_y

group__YAP4R_1autotoc_md55

autotoc_md_5

group__YAP4R_1autotoc_md56

_Y

group__YAP4R_1autotoc_md57

text_query_)

y$query('between(1,10,X)')

group__YAP4R_1autotoc_md58

_X

group__YAP4R_1autotoc_md59

U5bU1U5dU_1

@export

1. SEXP yap4r::more(): : ask for more solutions from a query.

@examples y$more()

group__YAP4R_1autotoc_md60

U5bUXU3dUr_queryU2cUYU3dUr_queryU28U_20256_]

group__YAP4R_1autotoc_md61

_X

group__YAP4R_1autotoc_md62

r_que_y

group__YAP4R_1autotoc_md63

autotoc_md_3

group__YAP4R_1autotoc_md64

_Y

group__YAP4R_1autotoc_md65

r_query_)

group__YAP4R_1autotoc_md66

_X

group__YAP4R_1autotoc_md67

text_que_y

group__YAP4R_1autotoc_md68

autotoc_md_8

group__YAP4R_1autotoc_md69

_Y

group__YAP4R_1autotoc_md70

text_query_)

y$query('between(1,10,X)')

group__YAP4R_1autotoc_md71

_X

group__YAP4R_1autotoc_md72

U5bU1U5dU_1

@export

1. bool yap4r::done(): : ask for more solutions from a query.

@export

1. bool yap4r::run(SEXP s): : run a Prolog term represented as a sexp.

@export

1. bool yap4r::eval(std::string l): : y$compile('aleph')

y$eval('read(aleph)') y$eval('induce') @export

1. bool yap4r::compile(std::string s):

1. bool yap4r::library(std::string s):

1. SEXP yap4r::peek(int i):