sample list struct support in go
package main
import "fmt"
type list struct {
items map[int]int
}
func newlist() list {
return list{make(map[int]int)}
}
func (l list) append(val int) {
l.items[len(l.items)] = val
}
func (l list) removelast() {
delete(l.items, len(l.items)-1)
}
func main() {
f := newlist()
f.append(4)
f.append(2)
f.removelast()
fmt.Println(f)
}