55 lines
1.0 KiB
Plaintext
55 lines
1.0 KiB
Plaintext
expr=lambda ->{
|
|
Print "ok"
|
|
}
|
|
ifrev=lambda (dothis, cond) ->{
|
|
if cond then call dothis()
|
|
}
|
|
a=1
|
|
call ifrev(expr, a=1)
|
|
|
|
\\ on module call
|
|
Module Subtract (a, b) {
|
|
Push a-b
|
|
}
|
|
Module PrintTop {
|
|
Print Number
|
|
}
|
|
Subtract 10, 3 : PrintTop
|
|
\\ pushing before calling in reverse order
|
|
Push 3, 10 : Subtract : PrintTop
|
|
\\ Before call PrintTop any parameter send to stack
|
|
\\ So this works ok
|
|
PrintTop 1000
|
|
\\ on assignment
|
|
Dim A(5)=1
|
|
Global n=2
|
|
Function AddOne (x) {
|
|
n++
|
|
=x
|
|
}
|
|
\\ Execution of left expression, then right expression
|
|
A(n)=AddOne(5)
|
|
Print A(n-1)=5, n=3
|
|
\\ Execution of right expression, then left expression
|
|
Let A(n)=AddOne(15)
|
|
Print A(n)=15, n=4
|
|
\\ This statement..
|
|
Let X=1, Y=2
|
|
\\ executed like these
|
|
Push 2, 1 : Read X, Y
|
|
|
|
\\ This is the CallBack way
|
|
Module ExecCond {
|
|
Read &callback(), cond
|
|
if cond then call callback()
|
|
}
|
|
x=1
|
|
\\ this aa() is a function but when we call it after transforming from Lazy$()
|
|
\\ act as part of module so we see x, and alter it
|
|
Function aa {
|
|
x++
|
|
}
|
|
a=1
|
|
ExecCond Lazy$(&aa()), A=1
|
|
Print x=2
|