Added canonical sexps sans parsing

This commit is contained in:
2024-08-28 23:01:38 -06:00
parent 33f732639f
commit 8261a876d1
9 changed files with 466 additions and 3 deletions

32
csexp/example_test.go Normal file
View File

@@ -0,0 +1,32 @@
package csexp_test
import (
"fmt"
"os"
"git.codemonkeysoftware.net/b/peachy-go/csexp"
)
func ExampleSexp_WriteTo() {
var sexp csexp.Sexp = csexp.List{
csexp.Atom("Hello,"),
csexp.List{
csexp.Atom("Mr."),
csexp.Atom("Rivest."),
},
}
sexp.WriteTo(os.Stdout)
// Output: (6:Hello,(3:Mr.7:Rivest.))
}
func ExampleSexp_String() {
var sexp csexp.Sexp = csexp.List{
csexp.Atom("Hello,"),
csexp.List{
csexp.Atom("Mr."),
csexp.Atom("Rivest."),
},
}
fmt.Print(sexp.String())
// Output: (6:Hello,(3:Mr.7:Rivest.))
}