entity - MrKaszeba19/PapajLang GitHub Wiki
Entity – a single computable element in PapajScript.
The first entities, Number and String, were introduced on April 26, 2018 with the release of the RPN 0.4.0.
Current usable entity types:
-
Number, e.g.5, 2, -10, 20.5etc.
More explanation here. -
String, e.g."Hello world!", "Shalom!", "h"etc.
More explanation here.
See the functions for strings in the String package. -
Boolean, e.g.TRUE, FALSE
See the logical functions here. -
Null, e.g.NULL -
Function, e.g.fun{ -1 * }etc.
More explanation here. -
Exception, e.g.EXC(as of now just basic ones, to be improved) -
Array, e.g.[],[ 2 1 3 7 ],[ 10 times rand ]
More explanation here.
See the functions for arrays in the Array package. -
LogicalExpression, e.g.( x 0 > )
More explanation here. -
DateTime, e.g."2005-04-02 21:37:00" Date.toDateTimeMore explanation here.
See the functions for arrays in the Date package.
Quasi-types:
-
InstructionBlock, e.g.{ x 2 ^ 2 / }
Planned for the future
ObjectFileDataframe
Current unusable data types:
Unknown
Removed/replaced types:
-
Expression, e.g.( x 0 > )– replaced byLogicalExpressionin September 2020
Syntax: X command
| Programme Operand | Purpose |
|---|---|
| toString | convert to a string |
| toNumber | convert to a number |
| toBoolean | convert to a logical value true or false
|
| toArray | build an array from N elements of the stack |
| toException | build an exception (if X is a string, then it creates an unraised exception with this string message) |
| Date.toDateTime | builds a datetime either from a string or a real number (assuming it represents Unix epoch time) |
| raiseException | same as above, but it raises exception too |
Syntax: X command
-
typereturns a string containing entity type, e.g."String" -
isNumber,isBoolean,isString,isArray,isNull,isException,isLogicalExpression,isFunction,isDateTime– returnTRUEorFALSErelatively if an entity is of a type mentioned in the function