// Extend behaves like Append, except it takes a single slice or array value // which will be concatenated to the named list. // // Unlike a variadic call to Append - which requires a []interface{} value - // Extend accepts slices or arrays of any type. // // Extend will panic if the given value is not a slice, array, or nil. func Extend(builder interface{}, name string, vs interface{}) interface{} { if vs == nil { return builder } maybeList, ok := getBuilderMap(builder).Lookup(name) var list ps.List if ok { list, ok = maybeList.(ps.List) } if !ok { list = ps.NewList() } forEach(vs, func(v interface{}) { list = list.Cons(v) }) return Set(builder, name, list) }