예제 #1
0
func list1() (*ast.ListCell, *ast.ListCell) {
	l0 := ast.NewList()
	l0.Add(ast.NewSym("+"))
	l0.Add(ast.NewSym("x"))
	l1 := l0.Add(ast.NewList()).(*ast.ListCell)
	l1.Add(ast.NewSym("*"))
	l1.Add(ast.NewNum(4))
	l1.Add(ast.NewNum(7))
	l0.Add(ast.NewNum(1))
	return l0, l1
}
예제 #2
0
func list2() (*ast.ListCell,
	*ast.ListCell,
	*ast.ListCell,
	*ast.ListCell,
	*ast.ListCell) {
	// l0 is the top list, l1 and l2 are elements of l0
	// l3 and l4 are elements of l2
	l0 := ast.NewList()
	l0.Add(ast.NewNum(3))
	l1 := l0.Add(ast.NewList()).(*ast.ListCell)
	l2 := l0.Add(ast.NewList()).(*ast.ListCell)
	l3 := l2.Add(ast.NewList()).(*ast.ListCell)
	l2.Add(ast.NewSym("g"))
	l4 := l2.Add(ast.NewList()).(*ast.ListCell)
	return l0, l1, l2, l3, l4
}