Module Swipl.Syntax
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 syntaxpred/arity
and declares a prolog function namedfn
with arityarity
.Note: If you call this function before
initialise
you will segfault.
val (!) : string -> t
! atom
creates a prolog term representing the atomatom
.Note: If you call this function before
initialise
you will segfault.
val app : ?module_:module_ -> fn -> t list -> t
app ?module_ fn args
creates a prolog term that represents the symbolic expressionmodule_:fn(args...)
.