package OCanren

  1. Overview
  2. Docs
Implementation of miniKanren relational (logic) EDSL

Install

Dune Dependency

Authors

Maintainers

Sources

0.3.0.tar.gz
sha256=eaf9624bbdbae8050eb43a48c0e79e97160b83b6f65a543ee1beca4c9f4ff4b2
sha512=e55dd7a3026b1dedcd37f55181059dfa44ad6976d241a1199246ee3c1684dcfdf1ae0c1da32165b5b2eb5748cfc57c906a0f0ebab56d03035a5bb87187a63cf7

doc/OCanren.tester/Tester/index.html

Module TesterSource

Auxiliary functions

Sourceval qh : (int -> string -> 'a -> unit) -> 'a -> unit -> unit
Sourceval qrh : (int -> string -> 'a -> unit) -> 'a -> 'a -> unit -> unit
Sourceval qrsh : (int -> string -> 'a -> unit) -> 'a -> 'a -> 'a -> unit -> unit
Sourceval qrsth : (int -> string -> 'a -> unit) -> 'a -> 'a -> 'a -> 'a -> unit -> unit

Main

Sourceval run_r : ('a OCanren.ilogic, 'b) OCanren.Reifier.t -> ('b -> string) -> int -> (unit -> ('c -> OCanren.State.t -> 'd) * ('e -> OCanren.Env.t -> 'f) * ('d -> 'e * OCanren.State.t OCanren.Stream.t) * ('g -> 'f -> unit -> unit)) -> ((int -> string -> 'a OCanren.reified -> unit) -> 'g) -> (string * 'c) -> unit

The call run_r reifier to_string count num num_handler ("description", goal) should be used to a goal goal, get count answers, reify all of them using reifier, and print them using provided to_string function. Auxiliary functions num and num_handler allow using this function in polyvariadic manner

For example:

open OCanren
run_r (Std.List.prj_exn prj_exn) show_int 1 q qh ("simple", (fun q -> q === inj 1))
Sourceval run_gen : 'a -> int -> (unit -> ('b -> OCanren.State.t -> 'c) * ('d -> OCanren.Env.t -> 'e) * ('c -> 'd * OCanren.State.t OCanren.Stream.t) * ('f -> 'e -> unit -> unit)) -> ('a -> 'f) -> (string * 'b) -> unit

More general combinator. The run_r is implemented using it. Unlikely will be used in practice

OCaml

Innovation. Community. Security.