package swipl

  1. Overview
  2. Docs
Legend:
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.

val app : ?module_:module_ -> fn -> t list -> t

app ?module_ fn args creates a prolog term that represents the symbolic expression module_:fn(args...).

val (&&) : t -> t -> t

t1 && t2 creates a prolog term that represents the conjunction of two prolog queries - i.e the prolog expression t1,t2.

val (||) : t -> t -> t

t1 || t2 creates a prolog term that represents the disjunction of two prolog queries - i.e the prolog expression t1; t2.

OCaml

Innovation. Community. Security.