new

 

 

Overview

The new function creates an instance of a specified Data Type and initializes the Object of the specified Data Type with a value.

Structure

The new function creates an instance of a Structure. The new function returns a new Structure object which is formed with the specified bindings (key: value) and with the optional cdr value. Each binding {key: value} is a quoted symbol followed by a value. There may be zero or more bindings specified. The optional cdr value is preceded by the period special character

Dictionary

The new function creates an instance of a Dictionary object and optionally allows you to specify initial Dictionary Bindings. The bindings (key/value) must be specified as pairs.

Directory

The new function creates an instance of a Directory object and optionally allows you to specify bindings (key: value). A Directory key and a Directory value may be any Native or Object Data Type.

Brick

The new function creates an instance of a Brick. The new function returns a new Brick object which is formed with the specified field declarations (Name: Type: Repeats). Each field declaration (Name: Type: Repeats) is two quoted symbols followed by an integer value. There may be one or more field declarations specified.

The valid Brick field type names are as follows:

Matrix

The new function returns an instance of a Matrix object of the specified size and optionally initializes the Matrix.

NumMatrix

The new function returns an instance of a NumMatrix object of the specified size and optionally initializes the NumMatrix.

Lambda

The new function creates a new Lambda object, either an exact copy of the specified Lambda object, or a new Lambda from the specified components. The newly cloned Lambda has the same behavior and structure as the original Lambda with the exception that the cloned Lambda has a similar but distinct Pv structure. This allows cloning of Lambda objects, which have the same behavior but may have different values in their persistent variables.

Alternatively, the new function may create a new Lambda object from the specified components specified in the following optional arguments: {Av:}, {Tv:}, {Pv:}, {Cv:}, {Pc:}, {In:}, and {Sc:} to allow Lambda properties to be supplied by the programmer.

ObjectRepository

The new function creates a new Object Repository, associates the Object Repository with a database archive file, and allows for Brick encryption and other options. The styles of Object Repository creation are dependent upon the number and types of the arguments passed to the new function.

CpxVector

The new function creates a new instance of a complex vector with optional initialization of the elements of the new vector. Like a pair, a list, or other vectors, a complex vector can have a tail. The tail can be of any type, but it is most often used to store a complex number. The number of complex numbers that can be stored in the vector is specified by a length. A single tilde (~) can be substituted for the length. In this case, the number of elements is determined by the number of initial values provided following the tilde.

The first two initial values specify the real part and the imaginary part of the first complex number, respectively. If only one value is specified, the imaginary part is taken to be zero. If no initial values are provided, the initial value of the elements in the array are all zero. If fewer than len pairs of values are provided, then the initial values are repeated until all of the elements are initialized. If more than len pairs are provided, the extra values are ignored.

Usage

Use the new function to create a new vector object and initialize it with some values.

String

The new function is used whenever you wish to create a new instance of a String. A String initializer argument to the new function forces a constant that is 9 characters or less to be typed as a String as opposed to the default type of Text.

Symbol

Use the new function to create a new Symbol object and assign a name to the Symbol.

Structure

Use the new function whenever you wish to create a new instance of a structure.

Dictionary

Use the new function whenever you wish to create a new instance of a dictionary. An arbitrary number of key-value constant pairs can be specified by the new function.

Directory

Use the new function whenever you wish to create a new instance of a dictionary. An arbitrary number of key-value constant pairs can be specified by the new function.

Brick

The new function is used whenever you wish to create a new instance of a Brick.

Matrix

Use the new function to create a new Matrix object and initialize it with some values.

NumMatrix

Use the new function to create a new NumMatrix object and initialize it with some values.

Lambda

Use this function when a multiple copies of the Lambda are required. For instance, if one has a blank expert Lambda, and one needs expert help on two separate subjects. Make two copies of the blank expert Lambda. Teach the first expert Lambda about subject one, and teach the second expert Lambda about subject two.

ObjectRepository

The new function is used to create an Object Repository and allows the user to specify creation options.

 

Syntax


Expression:

(new Vector: size)

(new Vector: subtype: size )

(new Vector: subtype: size initialValues )


Arguments Name Type Description
Argument:Vector:Symbol Mandatory keyword
Argument:subtype:Symbol An optional argument. If present it must be one of the following types: Word: Bit: Integer: Float: Number: Short: Object: Pcode: Short: If omitted, then the default will be a word vector.
Argument:sizeInteger An integer indicating how many elements in the vector.
Argument:initialValues Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean An optional argument. If present, it must be a list of initial values, each value separated by a space. If no initial values are specified, the vector is filled with zeros. If too few initial values are specified, the vector is filled with repeating patterns of initial values.

Returns:

A Vector Object.




Expression:

(new String: value)


Arguments Name Type Description
Argument:String:--- Mandatory keyword
Argument:valueString, Symbol or Text Any valid String, Symbol, or Text constant

Returns:

A String




Expression:

(new Symbol: value)


Arguments Name Type Description
Argument:Symbol:--- Mandatory keyword
Argument:valueString, Symbol or Text Any valid String, Symbol, or Text constant

Returns:

A Symbol object




Expression:

(new Structure: key value ...)

(new Structure: key value ... . cdrvalue)


Arguments Name Type Description
Argument:Structure:--- Mandatory keyword
Argument:key:Symbol (optional argument, repeating) a symbolic key (the name part, or key, of the Structure binding)
Argument:valueCharacter String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean If key is present, should be a value which will be paired with the preceding symbolic key.
Argument:.--- (optional) period
Argument:cdrvalue--- cdr Value (tail) should be present if the period is present

Returns:

A Structure.




Expression:

(new Dictionary: key value ...)

(new Dictionary: key value ... . cdrvalue)


Arguments Name Type Description
Argument:Dictionary:--- Mandatory keyword
Argument:key:Symbol (optional argument, repeating) a symbolic key (the name part, or key, of the Dictionary binding)
Argument:valueCharacter String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean If key is present, should be a value which will be paired with the preceding symbolic key.
Argument:.--- (optional) period
Argument:cdrvalue--- cdr Value (tail) should be present if the period is present

Returns:

A Dictionary.




Expression:

(new Directory: key value ...)

(new Directory: key value ... . cdrvalue)


Arguments Name Type Description
Argument:Directory:--- Mandatory keyword
Argument:key:Symbol (optional argument, repeating) a symbolic key (the name part, or key, of the Directory binding)
Argument:valueCharacter String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean If key is present, should be a value which will be paired with the preceding symbolic key.
Argument:.--- (optional) period
Argument:cdrvalue--- cdr Value (tail) should be present if the period is present

Returns:

A Directory.




Expression:

(new Brick: {rowCount} Name:Type:Repeats ... Name:Type:Repeats)


Arguments Name Type Description
Argument:Brick:Symbol Mandatory keyword
Argument:rowCountInteger (Optional)The number of rows in the Brick.
Argument:NameSymbol The symbolic field name.
Argument:TypeSymbol The data type of the Brick field.
Argument:RepeatsInteger The number of times the Brick field repeats (must be one or greater)

Returns:

A Brick.




Expression:

(new Brick: Brick)


Arguments Name Type Description
Argument:Brick:Symbol Mandatory keyword
Argument:BrickBrick An existing Brick, which is to be copied to create the new Brick.

Returns:

A Brick.




Expression:

(new Matrix: size)

(new Matrix: subtype: size )


Arguments Name Type Description
Argument:Matrix:Symbol Mandatory keyword
Argument:subtype:Symbol An optional argument. If present it must be one of the following types: normal: number: If omitted, then the default will be a normal matrix.
Argument:sizeInteger An integer indicating how many elements in the Matrix (the rank is assumed to be one).

Returns:

A Matrix Object.




Expression:

(new Matrix: rank dimensions)

(new Matrix: rank dimensions initialValues)

(new Matrix: subtype: rank dimensions)

(new Matrix: subtype: rank dimensions initialValues)


Arguments Name Type Description
Argument:Matrix:Symbol Mandatory keyword
Argument:subtype:Symbol An optional argument. If present it must be one of the following types: normal: number: If omitted, then the default will be a normal matrix.
Argument:rankInteger An integer indicating the rank of the Matrix (0, 1, 2, or 3)
Argument:dimensionsInteger A list of from one to three integers indicating how many elements in each dimension of the Matrix
Argument:initialValues Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean An optional argument. If present, it must be a list of initial values, each value separated by a space. If no initial values are specified, the Matrix is filled with zeros. If too few initial values are specified, the Matrix is filled with repeating patterns of initial values.

Returns:

A Matrix Object.




Expression:

(new NumMatrix: size)

(new NumMatrix: subtype: size )


Arguments Name Type Description
Argument:NumMatrix:Symbol Mandatory keyword
Argument:subtype:Symbol An optional argument. If present it must be one of the following types: normal: number: If omitted, then the default will be a normal matrix.
Argument:sizeInteger An integer indicating how many elements in the Matrix (the rank is assumed to be one).

Returns:

A NumMatrix Object.




Expression:

(new NumMatrix: rank dimensions)

(new NumMatrix: rank dimensions initialValues)

(new NumMatrix: subtype: rank dimensions)

(new NumMatrix: subtype: rank dimensions initialValues)


Arguments Name Type Description
Argument:NumMatrix:Symbol Mandatory keyword
Argument:subtype:Symbol An optional argument. If present it must be one of the following types: normal: number: If omitted, then the default will be a normal matrix.
Argument:rankInteger An integer indicating the rank of the Matrix (0, 1, 2, or 3)
Argument:dimensionsInteger A list of from one to three integers indicating how many elements in each dimension of the Matrix
Argument:initialValues Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean An optional argument. If present, it must be a list of initial values, each value separated by a space. If no initial values are specified, the Matrix is filled with zeros. If too few initial values are specified, the Matrix is filled with repeating patterns of initial values.

Returns:

A NumMatrix Object.




Expression:

(new anLambda ...)


Arguments Name Type Description
Argument:anLambdaLambda The Lambda to be copied
Argument:...--- Optional arguments to the new child Lambda within the template Lambda

Returns:

A new copy of the {anLambda} argument




Expression:

(new Lambda: Av: args Tv: vars Pv: pvars Cv: cvars Pc: PcodeVector Sc: tokens)


Arguments Name Type Description
Argument:Lambda:Symbol Mandatory keyword
Argument:Av:Symbol (Optional) The Arguments Structure object .
Argument:argsStructure Must follow the Av: keyword and must be a structure containing argument name symbol and value pairs. (name: value)
Argument:Tv:Symbol (Optional).The Temporary Variable Structure object.
Argument:vars Structure Must follow the Tv: keyword and must be a structure containing temporary variable name symbol and value pairs. (name: value)
Argument:Pv:Symbol (Optional).The Persistent Variable Structure object.
Argument:pvars Structure Must follow the Pv: keyword and must be a structure containing persistent variable name symbol and value pairs. (name: value)
Argument:Cv:Symbol (Optional).The Persistent Class Variable Structure object.
Argument:cvars Structure Must follow the Cv: keyword and must be a structure containing persistent class variable name symbol and value pairs. (name: value)
Argument:Rv:Symbol Optional).The Register Variable Structure object
Argument:regs Structure Must follow the Rv: keyword and must be a structure containing register variable name symbol and data type pairs. (name: type)
Argument:Pc PcodeVector (Mandatory).The Pcode Vector object.
Argument:Sc Vector (Optional) The source Token Vector for formula redisplay. If present must be a vector containing source line tokens.
Argument:In Structure Optional).The Interfaced Structure object for the Lambda.

Returns:

Returns the evaluating Lambda.




Expression:

(new ObjectRepository: fileName clear: key: code buffer: count)


Arguments Name Type Description
Argument:ObjectRepository:Symbol Mandatory argument specifying the type of object to create: ObjectRepository.
Argument:filenameText String The name of the database archive file to be associated with the ObjectRepository. If no such file exists, a new database archive file will be created.
Argument:clear:Symbol [Optional]. If the keyword clear: is present, the database archive file will be cleared immediately before any further processing. If no such file exists, a new database archive file will be created.
Argument:key: codeSymbol [Optional]. If the keyword key: is present and it is followed by a number, the number is treated as an encryption code to use in record encrypting the database archive file. This same encryption key code must be used in all future references to the ObjectRepository. If the keyword key: is followed by the Boolean value true, the database archive file will be compressed when saved. If the Boolean value false is present, the archive file will not be compressed. The same compression key code must be used in all future references to the ObjectRepository. WARNING: If the ObjectRepository is later opened with a different key value from was specified during file creation, as a security measure, the ObjectRepository will be made unrecoverable.
Argument:buffer: countSymbol [Optional]. If the key word buffer: is present, the numeric buffered object {count} must follow. The ObjectRepository will remember the last {count} objects retrieved to minimize disk access when required. As same objects are retrieved, the buffered object is returned and no disk access takes place. When a new object is retrieved, the oldest buffered object is thrown away to make room for the newly retrieved object.

Returns:

The newly created ObjectRepository, or the librarian Lambda.



 

Examples

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.

 

Argument Types

Here are the links to the data types of the function arguments.

Character String Symbol Vector
BitVector ByteVector IntVector ShortVector
FltVector ObjVector Structure Dictionary
Directory Brick ObjectRepository Matrix
NumMatrix Integer Float Number
Complex Boolean Lambda CpxVector

Here are also a number of links to functions having arguments with any of these data types.

++ += + /=
/ *= * --
-= - abortTransaction abs
acos add1 addMethod addi
appendWriteln append apply argCount
argFetch argument arithmetic asin
atan attachLibrarian avg badd
balance bcompareEQ bcompareGE bcompareGT
bcompareLE bcompareLT bcompareNE bdiv
beginTransaction binaryInsert binaryNand binaryNor
binaryNot binaryNxor binarySearch bitToIntegerVector
bitToNumberVector bitwiseAnd bitwiseNand bitwiseNor
bitwiseNot bitwiseNxor bitwiseOr bitwiseShiftLeft
bitwiseShiftRight bitwiseXor bmod bmul
boolean cadd callcc ccompareEQ
ccompareGE ccompareGT ccompareLE ccompareLT
ccompareNE cdiv cdr char
character checkPointTransaction class clean
clear closeLog cmod cmul
code commitTransaction compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compile complex
compress conjugate cons copy
cos cosh count csub
date day days360 debugBrowsableProcs
debugDetective debugEval debug decode
defchild defclass define(macro) defineStructure
define defmacro defmethod deforphan
defriend defstruct defun deg
deleteRows delete detachLibrarian dimension
disassemble display divi downcase
encode evalInSyncLocalContext eval exit
exp exportCsv exportSbf exportTab
expt fact fdisplay fieldsOf
fileClose fileCopy fileDir fileDisplay
fileEraseDir fileErase fileExists fileMakeDir
fileOpen fileReadAll fileReadRecord fileRead
fileResize fileSeek fileSizeOf fileWriteAll
fileWrite filewriteln findBlock find
floor fraction freeBlock gc
gcd getGlobalValue getRecursionCount getSymbolTable
getTickCount globalBinding hashString hour
iadd icompareEQ icompareGE icompareGT
icompareLE icompareLT icompareNE idiv
imaginary imod importCsv importSbf
importTab imul insertRows insert
inside inspect integer isAtom
isBitVector isBoolean isBound isByteVector
isCharAlphabetic isCharAlphanumeric isCharLowercase isCharName
isCharNumeric isCharUppercase isCharWhitespace isChar
isCharacter isClass isComplex isDate
isDictionary isDirectory isEqual isError
isEven isExact isFloatVector isIdentical
isImmediate isInexact isInside isIntegerVector
isInteger isLambda isMatrix isMember
isMoney isNegative isNull isNumberMatrix
isNumberVector isNumber isObjectVector isObject
isOdd isPair isPcodeVector isPositive
isString isStructure isSymbol isText
isTransaction isType isVector isZero
isub julian kurtosis lambda
lcm left length lisp
list loadModule loadObject loadRepository
loadWorkspace lock log10 log2
logConsole log logbase macroReplace
makeDictionary makeGaussianMatrix makeGramMatrix makeLambda
makeQuotedList makeQuotedSymbol makeStructure map
mapc matrixGaussianEliminate matrixGaussianSubstitute max
median member methodsOf mid
min minute mod modi
money month morph muli
myself nadd ncompareEQ ncompareGE
ncompareGT ncompareLE ncompareLT ncompareNE
ndiv new nmod nmul
now nsub number objectToDictionary
objectToDirectory objectToList objectToMatrix objectToNumMatrix
objectToNumVector objectToStructure objectToVector offset
onError openLog pair parent
parse pi pointer preAllocateFixedMemoryBlocks
product proplist proprecord putprop
qt quit rad random
randomize range rank real
refAttributes refLibrarian refValues ref
remProp remove rename replace
rept reset resize reverse
right round run saveImmediate
saveModule saveObject saveRepository saveWorkspace
second send setAttributes setBlock
setCar setCdr setLastCdr set
setf setq sigmoid sign
sin sinh sizeof skew
sleep sort sql sqrt
srandom stdev stdevp stringCiEQ
stringCiGE stringCiGT stringCiLE stringCiLT
stringCiNE stringFill stringToBVector stringToVector
string sub1 subi submit
substitute substringCiEQ substringCiGE substringCiGT
substringCiLE substringCiLT substringCiNE substringEQ
substringFill substringGE substringGT substringLE
substringLT substringNE substring sum
sumsqr super svmRegression symbolToTypeCode
symbol systemCheck system tan
tanh text time trim
type uncompress uniqueInsert unlock
upcase var varp vectorBinaryInnerProduct
vectorBipolarInnerProduct vectorCosineInnerProduct vectorCubeInnerProduct vectorDelete
vectorExpInnerProduct vectorFill vectorInnerProduct vectorLogInnerProduct
vectorQuartInnerProduct vectorQuintInnerProduct vectorSigmoidInnerProduct vectorSineInnerProduct
vectorSquareInnerProduct vectorTanInnerProduct vectorTanhInnerProduct version
writelg writeln year

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE