Added canonical sexps sans parsing
This commit is contained in:
32
csexp/example_test.go
Normal file
32
csexp/example_test.go
Normal 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.))
|
||||
}
|
Reference in New Issue
Block a user