Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,23 @@
type Stack() {
var xs = []
}
func Stack.IsEmpty() => this!xs.Length() == 0
func Stack.Peek() => this!xs[this!xs.Length() - 1]
func Stack.Pop() {
var e = this!xs[this!xs.Length() - 1]
this!xs.RemoveAt(this!xs.Length() - 1)
return e
}
func Stack.Push(item) => this!xs.Add(item)
var stack = Stack()
stack.Push(1)
stack.Push(2)
print(stack.Pop())
print(stack.Peek())
stack.Pop()
print(stack.IsEmpty())