Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
guregu committed Oct 12, 2022
1 parent dc366ae commit a884ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions trealla/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a884ce3

Please sign in to comment.