![]() |
|
|
NLI: Function: new Background: NLI, Expressions, Functions Related: Examples Description: The new function creates a new thing in the database to represent desired thing {ie john, mary, etc}. The last new thing can be referenced by the it function in subsequent expressions. General Format: (new ['name] ['class1] ['class2] ...) where: The first input names the new thing. The second and remaining inputs specify the new thing's classes. If the specified classes do not exist, they are created. Examples: (new) (new 'john) (new 'mary 'person) (new 'bob 'person 'doctor) Details: The expression (new 'mary 'person) is shorthand for following, assuming the class person did not already exist: (; Create a db item named person) (new) (set db item (it)) (set (it) name 'person) (; Create a person named mary) (new) (set person instance (it)) (set (it) name 'mary) Notes: |