func listToSlice(list ps.List, arrayType reflect.Type) reflect.Value { size := list.Size() slice := reflect.MakeSlice(arrayType, size, size) for i := size - 1; i >= 0; i-- { val := reflect.ValueOf(list.Head()) slice.Index(i).Set(val) list = list.Tail() } return slice }