NLI: Expressions

Background: NLI
Related: Functions, Examples

DBD's NLI allows users to manage data via expressions. Below are some typical expressions:

(new 'mary)
(set john like mary)
(get john like *)
(change (get john like mary) sue)
(delete mary)

In general, DBD's expressions consist of a function and a input, both of which are themselves expressions. Because adhering to this method would make typical expressions extremely long, DBD's NLI provides various shorthands.

In DBD, an expression starts with a "(" and ends with a corresponding ")". Within the parentheses there can be 0 to many elements. Elements are separated by at least one white space. A white space is a space, tab, carriage return or line feed. The first and last elements can be adjacent to the parentheses. Elements are themselves expressions. An expression's first element is a function. The remaining elements are function inputs. An input is optional, if documentation shows it surrounded by square brackets. Once an optional input is omitted, remaining inputs cannot be specified. Functions that accept a variable number of inputs are indicated by three dots.

General Expressions Format:
(function input1 input2 input3 ...)

Expression Shorthands:
Expressions are frequently specified by their shorthand. Shorthands for a strings and named things are described below:

The unabridged expression for the string john is (get 'j 'o 'h 'n). Its shorthands are (str john) or simply 'john.

The unabridged expression for a unique thing named by the string john is approximately:
(get * name (get 'j 'o 'h 'n)) which can be successively shorthanded as
(get * name 'john)
(. 'john)

The expression for a unique thing named john b smith is (. 'john 'b 'smith).

If a thing's name is not unique, refer to it via an expression such as:
(and (get person instance *)
    (get * name 'john)
    (get * age 28))

Thus the expression (get john like mary) is actually a shorthand for the following:
((. 'get) (. 'john) (. 'like) (. 'mary))

or expanded even further:
((and (get function instance *)
         (get * name (get 'g 'e 't)))
  (get * name (get 'j 'o 'h 'n))
  (get * name (get 'l 'i 'k 'e))
  (get * name (get 'm 'a 'r 'y)))

DBD's expressions have a syntax that is similar to LISP or Scheme.

CM ©2000-2007

air max polski


Tanie Nike Air Max