From e8ef3454880b92a5485a339b3b6fe7b64cfe5305 Mon Sep 17 00:00:00 2001 From: Lam Wei Lun Date: Wed, 21 Jan 2026 19:35:12 +0800 Subject: Add length, clear, is_empty to Stack and Queue --- std/stack.zc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'std/stack.zc') diff --git a/std/stack.zc b/std/stack.zc index 3d7c3c5..7df77f1 100644 --- a/std/stack.zc +++ b/std/stack.zc @@ -50,6 +50,18 @@ impl Stack { } return Option::None(); } + + fn length(self) -> usize { + return self.len; + } + + fn clear(self) { + self.len = 0; + } + + fn is_empty(self) -> bool { + return self.len == 0; + } } impl Drop for Stack { -- cgit v1.2.3