From a884ce348df7a157a3c38eae37a66a199aeddb7c Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 13 Oct 2022 00:00:32 +0900 Subject: [PATCH] update docs --- README.md | 2 +- trealla/term.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0133a73..e43c667 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ func main() { for query.Next(ctx) { answer := query.Current() x := answer.Solution["X"] - fmt.Println(x) // 1, trealla.Compound{Functor: "foo", Args: ["bar"]}, "c" + fmt.Println(x) // 1, trealla.Compound{Functor: "foo", Args: [trealla.Atom("bar")]}, "c"} } // make sure to check the query for errors if err := query.Err(); err != nil { diff --git a/trealla/term.go b/trealla/term.go index 9ffefdb..d6e8f22 100644 --- a/trealla/term.go +++ b/trealla/term.go @@ -167,10 +167,12 @@ func unmarshalTerm(bs []byte) (Term, error) { // Atom is a Prolog atom. type Atom string +// String returns the Prolog text representation of this atom. func (a Atom) String() string { return escapeAtom(string(a)) } +// Indicator returns a predicate indicator for this atom ("foo/0"). func (a Atom) Indicator() string { return fmt.Sprintf("%s/0", escapeAtom(string(a))) } @@ -220,6 +222,7 @@ type Variable struct { Attr []Term } +// String returns the Prolog text representation of this variable. func (v Variable) String() string { if len(v.Attr) == 0 { return v.Name