Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
21
Task/Stack/EasyLang/stack.easy
Normal file
21
Task/Stack/EasyLang/stack.easy
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
stack[] = [ ]
|
||||
proc push v . .
|
||||
stack[] &= v
|
||||
.
|
||||
func pop .
|
||||
if len stack[] = 0
|
||||
return 0
|
||||
.
|
||||
r = stack[-1]
|
||||
len stack[] -1
|
||||
return r
|
||||
.
|
||||
func empty .
|
||||
return if len stack[] = 0
|
||||
.
|
||||
push 2
|
||||
push 11
|
||||
push 34
|
||||
while empty = 0
|
||||
print pop
|
||||
.
|
||||
|
|
@ -2,7 +2,7 @@ public program()
|
|||
{
|
||||
var stack := new system'collections'Stack();
|
||||
|
||||
stack.push:2;
|
||||
stack.push(2);
|
||||
|
||||
var isEmpty := stack.Length == 0;
|
||||
|
||||
|
|
|
|||
25
Task/Stack/GDScript/stack.gd
Normal file
25
Task/Stack/GDScript/stack.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
# Empty stack creation.
|
||||
var stack : Array = []
|
||||
|
||||
# In Godot 4.2.1 nothing happens here.
|
||||
stack.pop_back()
|
||||
|
||||
if stack.is_empty():
|
||||
print("Stack is empty.")
|
||||
|
||||
stack.push_back(3)
|
||||
stack.push_back("Value")
|
||||
stack.push_back(1.5e32)
|
||||
print(stack)
|
||||
|
||||
print("Last element is: " + str(stack.back()))
|
||||
|
||||
stack.pop_back()
|
||||
print(stack)
|
||||
print("Last element is: " + str(stack.back()))
|
||||
if not stack.is_empty():
|
||||
print("Stack is not empty.")
|
||||
return
|
||||
3
Task/Stack/Uiua/stack.uiua
Normal file
3
Task/Stack/Uiua/stack.uiua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[3] # Since UIUA is a stack language, everything is pushed on the stack
|
||||
x ← # stores the top of the stack into the variable x
|
||||
? # ? checks the stack, it is now empty
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import "/seq" for Stack
|
||||
import "./seq" for Stack
|
||||
|
||||
var s = Stack.new()
|
||||
s.push(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue