Difference between revisions of "Zblack Example of Omniglot"
Jump to navigation
Jump to search
| Line 133: | Line 133: | ||
[[File:Omniglot1.png|500px|Output from Omniglot1 z^3 Program]] | [[File:Omniglot1.png|500px|Output from Omniglot1 z^3 Program]] | ||
| + | |||
| + | =See Also= | ||
| + | |||
| + | [[OmniGlot]] | ||
Revision as of 17:14, 25 February 2025
Zblack Example of Omniglot
Consider the following files. Here when omniglot1.z3 is run, the programs with different languages are run intermixed to give the output given at the end.
Also note that include("test.apl") is commented below, however, if you have APL Kernel installed, it will also trigger.
omniglot1.z3
var end=SUM(SIN(1..340));
var end1=SUM(COS(1..30));
var end2=SUM(1..30);
console.log(end);
console.log(end1);
console.log(end2);
include("test1.py");
// include("test.apl");
include("test.ts");
include("test.py");
include("test3.py");
include("test4.py");
test1.py
Notice the [= =] operator to provide the expression composed of variables from omniglot1.z3
import time
import datetime
index=0;
for _ in range(2):
for i in range(2):
# get the current date and time
now = datetime.datetime.now()
index=index+1
print("time",now,"i",i,"index",index)
time.sleep(1)
1+2+3+4+[= end*end1*4+end2 =]
test1.apl
Not triggered in this case, but it can be uncommented in z^3 code to be run.
+⌿ 1 2 3 4 5 6
test.ts
Typescript
// Defining an interface
interface Person {
name: string;
age: number;
occupation?: string; // Optional property
}
// Function with type annotations
function greet(person: Person): string {
return `Hello, ${person.name}! You are ${person.age} years old.`;
}
// Creating an object that satisfies the interface
const john: Person = {
name: "John Doe",
age: 30,
occupation: "Software Engineer"
};
// Calling the function and printing the result
console.log(greet(john));
// Using an enum
enum Status {
Pending = "pending",
InProgress = "in_progress",
Completed = "completed"
}
// Function using the enum
function updateStatus(id: number, status: Status): string {
return `Task ${id} status updated to ${status}`;
}
console.log(updateStatus(1, Status.InProgress));
test.py
import math [34,math.sin(34)]
test3.py
import math [43,math.sin(43)]
test4.py
Python program prints out a string {= =} with z^3 code which triggers computation on the side of z^3 code.
import math
math.sin(4.3)
x=4+5+6
x
#print(x,"{=SIN(1..",x,")=}")
print(x,"{=SIN(1..",x,")=}")
Output when omniglot1.z3 is run
Python program prints out a string {= =} with z^3 code which triggers computation on the side of z^3 code.