Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
Module Checkit {
|
||||
Module Multiply (a, b) {
|
||||
Push a*b
|
||||
}
|
||||
Multiply 10, 5
|
||||
Print Number=50
|
||||
|
||||
Module Multiply {
|
||||
Push Number*Number
|
||||
}
|
||||
|
||||
Multiply 10, 5
|
||||
Print Number=50
|
||||
\\ push before call
|
||||
Push 10, 5
|
||||
Multiply
|
||||
Read A
|
||||
Print A=50
|
||||
Push 10, 2,3 : Multiply : Multiply: Print Number=60
|
||||
Module Multiply {
|
||||
If not match("NN") Then Error "I nead two numbers"
|
||||
Read a, b
|
||||
Push a*b
|
||||
}
|
||||
Call Multiply 10, 5
|
||||
Print Number=50
|
||||
\\ now there are two values in stack 20 and 50
|
||||
Multiply
|
||||
}
|
||||
Call Checkit, 20, 50
|
||||
Print Number=1000
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
Module Checkit {
|
||||
\\ functions can shange by using a newer definition
|
||||
\\ function Multiply is local, and at the exit of Checkit, erased.
|
||||
Function Multiply (a, b) {
|
||||
=a*b
|
||||
}
|
||||
Print Multiply(10, 5)=50
|
||||
|
||||
Function Multiply {
|
||||
=Number*Number
|
||||
}
|
||||
|
||||
Print Multiply(10, 5)=50
|
||||
|
||||
Function Multiply {
|
||||
If not match("NN") Then Error "I nead two numbers"
|
||||
Read a, b
|
||||
=a*b
|
||||
}
|
||||
Print Multiply(10, 5)=50
|
||||
Function Multiply {
|
||||
Read a as long, b as long
|
||||
=a*b
|
||||
}
|
||||
Z=Multiply(10, 5)
|
||||
Print Z=50, Type$(Z)="Long"
|
||||
Function Multiply(a as decimal=1, b as decimal=2) {
|
||||
=a*b
|
||||
}
|
||||
D=Multiply(10, 5)
|
||||
Print D=50, Type$(D)="Decimal"
|
||||
D=Multiply( , 50)
|
||||
Print D=50, Type$(D)="Decimal"
|
||||
D=Multiply( 50)
|
||||
Print D=100, Type$(D)="Decimal"
|
||||
\\ by reference plus using type
|
||||
Function Multiply(&a as decimal, &b as decimal) {
|
||||
=a*b
|
||||
a++
|
||||
b--
|
||||
}
|
||||
alfa=10@
|
||||
beta=20@
|
||||
D=Multiply(&alfa, &beta)
|
||||
Print D=200, alfa=11,beta=19, Type$(D)="Decimal"
|
||||
\\ Using Match() to identify type of items at the top of stack
|
||||
Function MultiplyALot {
|
||||
M=Stack
|
||||
While Match("NN") {
|
||||
mul=Number*Number
|
||||
Stack M {
|
||||
Data mul ' at the bottom
|
||||
}
|
||||
}
|
||||
=Array(M)
|
||||
}
|
||||
|
||||
K=MultiplyALot(1,2,3,4,5,6,7,8,9,10)
|
||||
N=Each(K)
|
||||
While N {
|
||||
Print Array(N), ' we get 2 12 30 56 90
|
||||
}
|
||||
Print
|
||||
}
|
||||
Checkit
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
Module CheckIt {
|
||||
A$=Lambda$ N$="Hello There" (x) ->{
|
||||
=Mid$(N$, x)
|
||||
}
|
||||
Print A$(4)="lo There"
|
||||
Push A$
|
||||
}
|
||||
CheckIt
|
||||
Read B$
|
||||
Print B$(1)="Hello There"
|
||||
Function List$ {
|
||||
Dim Base 1, A$()
|
||||
A$()=Array$([]) ' make an array from stack items
|
||||
=lambda$ A$() (x) -> {
|
||||
=A$(x)
|
||||
}
|
||||
|
||||
}
|
||||
\\ change definition/closures
|
||||
B$=List$("Hello", "Rosetta", "Function")
|
||||
Print B$(1)="Hello"
|
||||
Loading…
Add table
Add a link
Reference in a new issue