Show HN: Embeddable Prolog in Go

Show HN: Embeddable Prolog in Go

ichiban/prolog is an embeddable scripting language for Bound.
Unlike any other scripting engines, ichiban/prolog implements logic programming language Prolog.

bound discover -u
if err := p.Exec(`

:- [abc].              % Load file 'abc' or ''.

:- ['/path/to/abc'].   % Load file '/route/to/abc' or '/route/to/'.
                       % You should cite to possess / within the route.

:- [library(dcg)].     % Load library 'library(dcg)'.
                       % Hang about examples/dcg/necessary.bound for a whole instance.

human(socrates).       % Right here's a truth.
mortal(X) :- human(X). % Right here's a rule.

`); err != nil {
Who = socrates
// Prolog program invocation takes a design of question of.
sols, err := p.Quiz(`mortal(Who).`)
if err != nil {
defer sols.End()

// Iterates over solutions.
for sols.Next() {
	// Put collectively a struct with fields which title corresponds with a variable within the question of.
	var s struct {
		Who string
	if err := sols.Scan(&s); err != nil {
	fmt.Printf("Who = %sn", s.Who)
	// ==> Who = socrates

Disbursed below the MIT license. Hang about LICENSE for added data.

Hang about for structure predominant facets.

Be a half of the pack! Be a half of 8000+ others registered users, and discover chat, produce groups, post updates and produce associates all the blueprint in which by the enviornment!

Ava Chan

Ava Chan

I'm a researcher at Utokyo :) and a big fan of Ava Max

you're currently offline