DisplayString returns a string representation for this atom using unescaped constants.
()
| 978 | |
| 979 | // DisplayString returns a string representation for this atom using unescaped constants. |
| 980 | func (a Atom) DisplayString() string { |
| 981 | var sb strings.Builder |
| 982 | sb.WriteString(a.Predicate.Symbol) |
| 983 | sb.WriteString("(") |
| 984 | for i, arg := range a.Args { |
| 985 | if i > 0 { |
| 986 | sb.WriteString(",") |
| 987 | } |
| 988 | // Use DisplayString for Constant, fallback to String otherwise |
| 989 | if c, ok := arg.(Constant); ok { |
| 990 | sb.WriteString(c.DisplayString()) |
| 991 | } else { |
| 992 | sb.WriteString(arg.String()) |
| 993 | } |
| 994 | } |
| 995 | sb.WriteString(")") |
| 996 | return sb.String() |
| 997 | } |
| 998 | |
| 999 | // Equals provides syntactic equality for atoms. |
| 1000 | func (a Atom) Equals(u Term) bool { |