Mixed vector/number
A demo with a runtime that supports Number
's and
Vector
's
Number
supports the following methods
-
+
addition1 + 1
returnsNumber
-
-
subtraction2 - 1
returnsNumber
-
*
multiplication2 * 2
returnsNumber
-
/
division2 / 1
returnsNumber
You can create a Vector
with
vec(Number x, Number y)
and supports the following methods
-
+
additionvec(1,1) + vec(1,1)
returnsVector
-
-
subtractionvec(1,1) + vec(1,1)
returnsVector
-
*
multiplicationvec(2,2) * 3
returnsVector
-
/
multiplicationvec(2,2) / 2
returnsVector
-
len(Vector)
length of vectorlen(vec(1, 1))
returnsNumber
-
norm(Vector)
make the vector a length of1
,norm(vec(2, 2))
returnsVector
Demo
The texprl code editor —
The JSON representation
The raw text output
The formatted code. Not complete, see "Code formatter" below.