49 lines
1023 B
Plaintext
49 lines
1023 B
Plaintext
print("\nQ& Test script.");
|
|
|
|
var now = time();
|
|
|
|
*~ how <~ 'very cool';
|
|
var _WHAT_ = "ABQ&%$#@!";
|
|
|
|
var a = 7;
|
|
*~ b <~ 12;
|
|
var c <~ 8;
|
|
*~ d = 3;
|
|
|
|
:: _WHAT_.SubString(2, 2) + ' is ' + how;
|
|
print(a * b * c * d);
|
|
|
|
if (a > d) { :: "compare operator is sane"; }
|
|
else { :: "sanity check failed"; }
|
|
|
|
for (*~i<~1;i<=16;i++) { :: "[" + i + "]: " + i * i; }
|
|
|
|
# this part is spooky as fuck, write(b) prints out random variables :x
|
|
# almost like its taking the slot index of the global register, huh...
|
|
for (;b>0;) { ::b; b--; write(b); }
|
|
|
|
fq fib(n) { if (n<2) <: 1; <: fib(n-1) + fib(n-2); }
|
|
|
|
*~ fibs <~ 'fibonacci sequence:';
|
|
for (*~i<~0;i<16;i++) {
|
|
fibs = fibs + " " + fib(i);
|
|
}
|
|
:: fibs;
|
|
|
|
class Vector {
|
|
Vector(x, y, z) {
|
|
.~:x <~ x;
|
|
this.y = y;
|
|
this:z <~ z;
|
|
}
|
|
}
|
|
|
|
var delta = time() - now;
|
|
:: "this took " + delta + " microseconds. which are ~" + (delta / 1000) + " milliseconds.";
|
|
|
|
var content = fread("./Build/.qpb");
|
|
::typeof content;
|
|
write(content);
|
|
|
|
:: "if you can read this, Q& probably works. Wow!";
|