blob: c69535cab886e89f12432520d4568fa6087922df [file] [log] [blame]
// +build ignore
package main
import "fmt"
type cons struct {
car string
cdr interface{}
}
func (c cons) String() string {
if c.cdr == nil || c.cdr == (cons{}) {
return c.car
}
return fmt.Sprintf("%v %v", c.car, c.cdr)
}
func main() {
m := map[cons]string{}
c := cons{}
for _, s := range []string{"life?", "with my", "I doing", "What am"} {
c = cons{s, c}
}
m[c] = "No idea."
fmt.Println(c, m[c])
}