About Primitives

DScript's intrinsic functions are called primitives. These are functions that perform basic tasks such as adding numbers, reading files, etc. Primitives also perform complex tasks such as solving numeric integration and linear optimization problems. Primitives are, more properly, the basic building blocks you use to build applications.

DScript differs from JavaScript in two basic ways:

  • The extensions DScript adds to the core syntax, including the addition of new operators, stricter rules for declaring variables, and a simplified syntax for creating definitions
  • The set of built-in functions available, which are called primitives

There are two types of primitives:

Types of Primitives

Type Description
Operators Operators are accessed using symbols. For example, the plus symbol (+) is used to add numbers in an expression such as 2+3. Operators differ from other primitives only in the syntax used to access them. In fact, the expression 2+3 is converted to the internal expression _ADD(2,3) before it is executed. Using the plus symbol to represent the _ADD primitive just makes accessing the primitive more convenient. See About Operators.
Functions Functions are accessed using the function name followed by a list of arguments in parentheses. For example, the expression sqrt(4) calls the square root primitive.

DScript’s collection of primitives gives you an extraordinary amount of power. For example, there are primitives to calculate integrals and derivatives, solve linear program problems, perform financial and statistical calculations, etc. These functions make it possible to build applications that perform very sophisticated business functions such as forecasting, inventory management, production scheduling, securities valuation, etc. Almost any type of calculation you need to perform in a decision-support or business-modeling application is included. The DScript language is the glue you use to combine primitives into useful applications. However, it is the primitives that give DScript its power.