nicer print output with empty lists/tables
This commit is contained in:
parent
2aa3a094bb
commit
ff9cfd9c39
|
@ -139,6 +139,8 @@ proc tableDelete*[U, V](tbl: Table[U, V], key: U): bool =
|
|||
return true
|
||||
|
||||
proc `$`*[U, V](tbl: NdTable[U, V]): string =
|
||||
if tbl[].count == 0:
|
||||
return "@{}"
|
||||
result = "@{ "
|
||||
for i in countup(0, tbl.cap.int - 1):
|
||||
let entry = tbl[].entries[i]
|
||||
|
|
|
@ -82,6 +82,8 @@ proc getLength*[T](list: List[T]): int {.inline.} =
|
|||
list.len
|
||||
|
||||
proc `$`*[T](list: List[T]): string =
|
||||
if list.len == 0:
|
||||
return "@[]"
|
||||
result = "@[ "
|
||||
for i in countup(0, list.len - 1):
|
||||
mixin `$`
|
||||
|
|
Loading…
Reference in New Issue