insert

 

 

Overview

The insert function destructively inserts the specified object into the Vector or any Vector subtypes at the specified index location.

Structure

The insert function destructively inserts the specified key into the Structure at the specified index location. The Structure is increased in size to accommodate the new value.

Dictionary

The insert function destructively inserts the specified key into the Dictionary at the specified index location. The Dictionary is increased in size to accommodate the new value.

Directory

The insert function destructively inserts the specified key into the Directory at the specified index location. The Directory is increased in size to accommodate the new value.

Matrix

The insert function destructively inserts the specified object into the Matrix at the specified index location.

NumMatrix

The insert function destructively inserts the specified object into the NumMatrix at the specified index location.

Usage

The insert function should be used when you want to insert a new object into an existing Vector in a specific location in the Vector. The insert function will always insert, even though the object already exists, whereas the uniqueInsert function will not insert if the object already exists. If the specified index is already occupied, then that object and all remaining objects to the right will be shifted to the right to make room for the new object.

Structure

The insert function should be used when you want to insert a new Structure binding (key and value) into an existing Object in a specific location. The insert function will always insert, even though the key already exists, whereas the uniqueInsert function will not insert if the key already exists. The insert function is similar to the uniqueInsert function but it has the additional feature of assigning a value to the key (instead of #void) and the additional feature of being able to specify a location (instead of the end of the Structure).

Dictionary

The insert function should be used when you want to insert a new Dictionary binding (key and value) into an existing Object in a specific location. The insert function will always insert, even though the key already exists, whereas the uniqueInsert function will not insert if the key already exists. The insert function is similar to the uniqueInsert function but it has the additional feature of assigning a value to the key (instead of #void) and the additional feature of being able to specify a location (instead of the end of the Dictionary).

Directory

The insert function should be used when you want to insert a new Directory binding (key and value) into an existing Object in a specific location. The insert function will always insert, even though the key already exists, whereas the uniqueInsert function will not insert if the key already exists. The insert function is similar to the uniqueInsert function but it has the additional feature of assigning a value to the key (instead of #void) and the additional feature of being able to specify a location (instead of the end of the Directory).

Matrix

Note: Returns an error message if the Matrix is not of rank one.

The insert function should be used when you want to insert a new object into an existing Matrix in a specific location in the Matrix. The insert function will always insert, even though the object already exists, whereas the uniqueInsert function will not insert if the object already exists. If the specified index is already occupied, then that object and all remaining objects to the right will be shifted to the right to make room for the new object.

NumMatrix

Note: Returns an error message if the NumMatrix is not of rank one.

The insert function should be used when you want to insert a new object into an existing NumMatrix in a specific location in the NumMatrix. The insert function will always insert, even though the object already exists, whereas the uniqueInsert function will not insert if the object already exists. If the specified index is already occupied, then that object and all remaining objects to the right will be shifted to the right to make room for the new object.

 

Syntax


Expression:

(insert vector index obj)


Arguments Name Type Description
Argument:vectorVector FltVector ShortVector IntVector NumVector ObjVector The Vector to be modified.
Argument:indexInteger The location in the vector to install the new value.
Argument:obj Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new object to insert.

Returns:

The modified Vector.




Expression:

(insert struct index newKey newValue)


Arguments Name Type Description
Argument:structStructure The Structure to be modified.
Argument:indexInteger The position in the structure to put the new binding
Argument:newKey Symbol The new Key to insert.
Argument:newValue Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new value to insert.

Returns:

The modified structure.




Expression:

(insert dictionary index newKey newValue)


Arguments Name Type Description
Argument:dictionaryDictionary The Dictionary to be modified.
Argument:indexInteger The position in the structure to put the new binding
Argument:newKey Symbol The new Key to insert.
Argument:newValueCharacter String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new value to insert.

Returns:

The modified dictionary.




Expression:

(insert directory index newKey newValue)


Arguments Name Type Description
Argument:directoryDirectory The Directory to be modified.
Argument:indexInteger The position in the directory to put the new binding
Argument:newKey Symbol The new Key to insert.
Argument:newValue Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new value to insert.

Returns:

The modified Directory.




Expression:

(insert matrix index obj)


Arguments Name Type Description
Argument:matrixMatrix The Matrix to be modified.
Argument:indexInteger The location in the Matrix to install the new value.
Argument:obj Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new object to insert.

Returns:

The modified Matrix.




Expression:

(insert nummatrix index obj)


Arguments Name Type Description
Argument:nummatrixNumMatrix The NumMatrix to be modified.
Argument:indexInteger The location in the NumMatrix to install the new value.
Argument:obj Character String Symbol Vector BitVector ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex The new object to insert.

Returns:

The modified NumMatrix.



 

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.

Structure Dictionary Directory Vector
Matrix FltVector ShortVector IntVector
NumVector ObjVector Integer String
Text Symbol NumMatrix

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

++ += + /=
/ *= * --
-= - addMethod addi
appendWriteln append apply avg
badd balance bdiv binaryInsert
binaryNand binaryNor binaryNot binaryNxor
binarySearch bitToIntegerVector bitToNumberVector bitwiseAnd
bitwiseNand bitwiseNor bitwiseNot bitwiseNxor
bitwiseOr bitwiseShiftLeft bitwiseShiftRight bitwiseXor
bmod bmul boolean cadd
cdiv cdr char character
class clean closeLog cmod
cmul code compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compress cons
copy count csub date
day days360 debugBrowsableProcs debugDetective
debugEval debug defchild defclass
define(macro) defineStructure define defmacro
defmethod deforphan defriend defstruct
defun deleteRows delete dimension
disassemble display divi downcase
encode evalInSyncLocalContext eval exit
exportCsv exportSbf exportTab 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 globalBinding hashString
hour iadd icompareEQ icompareGE
icompareGT icompareLE icompareLT icompareNE
idiv 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 isFloatVector isIdentical isInside
isIntegerVector isInteger isLambda isMatrix
isMember isMoney isNumberMatrix isNumberVector
isNumber isObjectVector isObject isPair
isPcodeVector isString isStructure isSymbol
isText isType isVector isub
julian kurtosis lcm left
length list loadModule loadRepository
loadWorkspace lock macroReplace makeDictionary
makeGaussianMatrix makeGramMatrix makeQuotedList makeQuotedSymbol
makeStructure map mapc matrixGaussianEliminate
matrixGaussianSubstitute max median member
methodsOf mid min minute
mod modi money month
muli new number objectToDictionary
objectToDirectory objectToList objectToMatrix objectToNumMatrix
objectToNumVector objectToStructure objectToVector offset
openLog pair parent parse
pointer preAllocateFixedMemoryBlocks product proplist
proprecord putprop qt random
randomize range rank refAttributes
refValues ref remProp remove
rename replace rept resize
reverse right round run
saveImmediate saveModule saveObject saveRepository
saveWorkspace second send setAttributes
setBlock setCar setCdr setLastCdr
set setf setq sizeof
skew sort sql sqrt
srandom stdev stdevp stringCiEQ
stringCiGE stringCiGT stringCiLE stringCiLT
stringCiNE stringFill stringToBVector stringToVector
string subi submit substitute
substringCiEQ substringCiGE substringCiGT substringCiLE
substringCiLT substringCiNE substringEQ substringFill
substringGE substringGT substringLE substringLT
substringNE substring sum sumsqr
super svmRegression symbolToTypeCode symbol
system text time trim
type uniqueInsert unlock upcase
var varp vectorBinaryInnerProduct vectorBipolarInnerProduct
vectorCosineInnerProduct vectorCubeInnerProduct vectorDelete vectorExpInnerProduct
vectorFill vectorInnerProduct vectorLogInnerProduct vectorQuartInnerProduct
vectorQuintInnerProduct vectorSigmoidInnerProduct vectorSineInnerProduct vectorSquareInnerProduct
vectorTanInnerProduct vectorTanhInnerProduct 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