diff --git a/vector/vector.go b/vector/vector.go index 360353c..a9d9fd1 100644 --- a/vector/vector.go +++ b/vector/vector.go @@ -30,8 +30,8 @@ func (this *Vector) Conj(data any) *Vector { return newVec } -func String(this *Vector) string { - if this == nil { +func (this *Vector) String() string { + if this.IsEmpty() { return "[]" } var sb strings.Builder @@ -41,10 +41,11 @@ func String(this *Vector) string { sb.WriteRune(' ') } return sb.String()[:sb.Len()-1] + "]" + } -func (this *Vector) String() string { - return String(this) +func (this *Vector) IsEmpty() bool { + return len(this._slice) == 0 } func ToList(this *Vector) list.IList {