import
is not only for importing *.ez
sources, but also native Easypt libraries (like *.dll
, *.so
etc.). Easypt interpreter executable contain only core of Easypt features and its main features are being extensible and flexible. I present 3 simple libraries here:
console
console.write
Basic
type, any number of parametersconsole
console.writeLine
console
console.read
String
console.readLine
String
console.scan
Int
, Double
, String
or Boolean
type, any number of parametersconsole
console.beep
console
system
system.callShellCommand
String
system
system.getEnvironmentVariable
String
String
time
time.secondsSinceEpoch
Int
time.sleep
Int
time
Clock
Clock
Clock
Clock.getElapsedMilliseconds
restart
or the construction of this Clock
as millisecondsInt
Clock.restart
Clock
See in reference: console
, system
, time
, Clock
.
import("console");
console.writeLine("What's your name?");
auto name.=(console.read());
console.writeLine("Hello, ", name, "!");
This source will measure speed of Easypt’s console output functions:
import("time");
import("console");
auto test1;
auto test2;
auto test3;
auto test4;
auto clock.=(Clock());
for (auto i.=(0).<, 10000, i.++, {
log(i);
});
test1.=(clock.getElapsedMilliseconds());
clock.restart();
for (auto i.=(0).<, 10000, i.++, {
console.writeLine(i);
});
test2.=(clock.getElapsedMilliseconds());
clock.restart();
for (auto i.=(0).<, 10000, i.++, {
console.write(i);
});
test3.=(clock.getElapsedMilliseconds());
clock.restart();
for (auto i.=(0).<, 10000, i.++, {
console.fast.writeInt(i);
});
test4.=(clock.getElapsedMilliseconds());
console.write("\nlog: ", test1, " ms\n");
console.write("console.writeLine: ", test2, " ms\n");
console.write("console.write: ", test3, " ms\n");
console.write("console.fast.writeInt: ", test4, " ms\n");
Possible output:
[…]
log: 4923 ms
console.writeLine: 4243 ms
console.write: 3384 ms
console.fast.writeInt: 2569 ms