Library
Module
Module type
Parameter
Class
Class type
The Syntax
module provides a useful set of combinators for constructing prolog terms using idiomatic OCaml syntax.
As the operators in this module shadow common OCaml ones (&&, ||
), typically you want to locally open this module:
Swipl.Syntax.(app ("consult" /@ 1) [! file])
val (/@) : string -> int -> fn
fn /@ arity
mirrors the prolog syntax pred/arity
and declares a prolog function named fn
with arity arity
.
Note: If you call this function before initialise
you will segfault.
val (!) : string -> t
! atom
creates a prolog term representing the atom atom
.
Note: If you call this function before initialise
you will segfault.
app ?module_ fn args
creates a prolog term that represents the symbolic expression module_:fn(args...)
.
t1 && t2
creates a prolog term that represents the conjunction of two prolog queries - i.e the prolog expression t1,t2
.