From 4ed27b8c0e8bafd3420fe446da1adcc36dc33dc3 Mon Sep 17 00:00:00 2001 From: ajet Date: Wed, 5 Nov 2025 06:43:02 -1000 Subject: [PATCH] add IsEmpty --- vector/vector.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 {