Wasaya/Libraries
As a practical programming language, Wasaya supports a number of standard libraries. These standard libraries typically support advanced mathematical operations (e.g., trigonometric functions, greatest common divisors, etc.), efficient algorithms (e.g., insert sorting, quicksorting, etc.), inputs and outputs, and even manipulating systems, drawing pictures, etc.
Math Library
Math Library supports more mathematical operations. To use this library, you don't need to "require" it.
Its name is "math".
Supported functions:
math.sin(x) ---Sine math.cos(x) ---Cosine math.tan(x) ---Tangent math.cot(x) ---Cotangent math.sec(x) ---Secant math.csc(x) ---Cosecant math.gcd(x, y) ---Greatest common divisor math.log(x, b) ---Logarithm math.pow(x, y) ---Power math.sinh(x) ---Hyperbolic math.cosh(x) math.tanh(x) math.coth(x) math.sech(x) math.csch(x) math.asin(x) ---Anti math.acos(x) math.atan(x) math.acot(x) math.asec(x) math.acsc(x) math.sgn(x) ---If x is positive, it returns 1, if x is negative, it returns -1, otherwise it returns 0. math.round(x) ---Round math.ceil(x) ---Round away from 0 math.floor(x) ---Round toward 0 math.fact(x) ---Factorial
IO Library
I've talked about it in the part "Input and Output".
io.read() io.read_prompt(__prompt = "") io.printf(format, *args, **kwargs) io.printend(*args, **kwargs, end="")
Random Library
Of course, in order to achieve more advanced content, we'll also implemented random libraries in Wasaya.
Supported functions:
random.random(seed) ---Generate a seed. random.randint(a, b) ---Generate a random integer between a and b. random.random01() ---Generate a random real number between 0 and 1. random.choice(list) ---Choose a random element from list.
Algorithm
A series of algorithms are implemented here.
#---[[ These are most useful functions ]]---# algo.sort(list, cmp = less_than) ---Sort a list. algo.midsearch(list) ---Search an element from list.
Self-interpreter Library
request("exec")
Using it is easy, this is not even a library but a function:
exec("#---[[ Any Wasaya Code ]]---#")
Network operation
Its name is "network".
network.connect() network.disconnect() network.ConnectStatus ---This is a boolean value, which shows connecting status. If it is normal, then return True. network.access(website) network.ping(host, *args) network.address(host)
System
It supports to control your OS.
system.pause() system.cmd(cmd) system.time(timezone = 0) system.date(timezone = 0)
stdlib
This library needn't to show its name.
--- Currently, the stdlib library supports some common data structure types. stack queue deque array dict tuple graph tree hash
Regular Expression Library
Its name is "re".
re.match(pattern, matching, flag = NULL) #---[[ If there is a matching string in pattern then return the matched string's position that it appears first time, else return None. It can only match from starting point, unlike the stronger re.search. ]]---# re.search(pattern, matching, flag = NULL) re.replace(pattern, matching, mask, flag = NULL) #---[[ Replaces all "matching" in "pattern" by "mask". ]]---#