Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,6 @@
\\ block For This {}, or For object [, object2] { }, where object is a group, or a pointer to group, or an item from an array contains a group
\\ This is "this context".
For This {
\\ any new definition here has a temporary use
\\ can be nested, but if we use object then we can use dots to access members of it. If we use a second one then we have to use double dots (..x for second object, for access to x member)
}

View file

@ -0,0 +1,76 @@
Class PointA {
Property x=0~
Property Y=0~
Operator "=" (n1) {
n=group(n1)
if n.x=.x Then if n.y=.y then push true : exit
push false
}
Module Print {
Print "Point" , .x, .y
}
Class:
Module PointA {
\\ ? means optionally
Read ? .[x], .[y]
}
}
Class Circle {
Property R=300~ ' type single
Operator "=" (n1) {
n=group(n1)
n2=This ' get a copy of this to check n against n2
if valid(@n as n2) else push false :exit
if n.x=.x Then if n.y=.y then if n.r=.r then push true : exit
push false
}
Module Print {
Print "Circle", .x, .y, .r
}
Class:
Module Circle {
if match("nn") then {
M=PointA(Number, Number)
} Else.if match("G") then {
M=PointA()
Read M
} Else M=PointA()
M=This
\\ If match("N") then Read M.r \\ check if a number is in top of stack
\\ Read ? M.r \\ optionally
Read M.r \\ for this example, r has value, so this used if stack is empty.
This=M
}
}
A=PointA(10,3)
C=Circle(20,10,5)
D=Circle(A, 100)
B=A
K=PointA()
Z=Circle(A)
P=PointA(600,700)
\\ N is a pointer to array
N=(A, B, C, D, K, P, Z)
M=each(N)
While M {
For This {
\\ a copy in MM
MM=Array(M)
MM.Print
Print A=MM, D=MM ' using MM=A interpreter use "=" from MM
}
}
\\ pA is a pointer to D (a named group)
pA->D
Print pA=D, pA=Z
pA=>Print
\\ pA is a pointer to a copy of D (a float group)
pA->(D)
Print pA=D, pA=Z
pA=>Print
\\ rA is a reference to D (& is optional in Link statement)
Link &D to &rA
rA.Print

View file

@ -0,0 +1,67 @@
Class PointA {
X=0~, Y=0~
Module Print {
Print "Point" , .x, .y
}
Class:
Module PointA {
Read ? .x, .y
}
}
Class Circle {
Property R {
Value,
Set {
If Value>1000 then Value=1000
}
}=300~
Module Print {
Print "Circle", .x, .y, .r
}
Class:
Module Circle {
if match("nn") then {
M=PointA(Number, Number)
} Else.if match("G") then {
M=PointA()
Read M
} Else M=PointA()
M=This
This=M
Read ? .r
}
}
A=PointA(10,3)
C=Circle(20,10,5)
D=Circle(A, 100)
B=A
K=PointA()
Z=Circle(A)
P=PointA(600,700)
\\ N is a pointer to stack
N=Stack:=A, B, C, D, K, P, Z
\\ M is a pointer to an iterator
M=each(N)
While M {
For This {
\\ a copy in MM
MM=StackItem(M)
MM.Print
}
}
\\ NN is a pointer to Inventory
Inventory NN= 1:=A, 2:=B, 3:=C, 4:=D, 5:=K, 6:=P,7:= Z
M=each(NN)
While M {
For This {
\\ a copy in MM
MM=Eval(M)
MM.Print
}
}
\\ we can call NN(3).print
Print "NN(3).Print"
NN(3).Print
NN(3).R=5000
NN(3).Print