binaryInsert

 

 

Overview

The binaryInsert Function destructively inserts the specified new value into the Vector at the proper location to preserve ascending sort order. The Vector is increased in size to accommodate the new value. If a matching value is already in the Vector, no insertion is made.

Since there is always a matching object, either before or after insertion, the binaryInsert function always returns the index of the newly inserted value or the location of the matched object.

Structure

The binaryInsert Function destructively inserts the specified new value into the Structure at the proper location to preserve ascending sort order. The Structure is increased in size to accommodate the new value. If a matching value is already in the Structure, no insertion is made.

Since there is always a matching object, either before or after insertion, the binaryInsert function always returns the index of the newly inserted value or the location of the matched object.

Matrix

The binaryInsert Function destructively inserts the specified new value into the Matrix at the proper location to preserve ascending sort order. The Matrix is increased in size to accommodate the new value. If a matching value is already in the Matrix , no insertion is made.

Since there is always a matching object, either before or after insertion, the binaryInsert function always returns the index of the newly inserted value or the location of the matched object.

NumMatrix

The binaryInsert Function destructively inserts the specified new value into the NumMatrix at the proper location to preserve ascending sort order. The NumMatrix is increased in size to accommodate the new value. If a matching value is already in the NumMatrix , no insertion is made.

Since there is always a matching object, either before or after insertion, the binaryInsert function always returns the index of the newly inserted value or the location of the matched object.

Usage

Normally a vector is not maintained in sort order, but can be sorted by invoking the sort function. If a vector has been sorted, the binaryInsert function should be used to add new values to the vector and preserve the sort order. The binaryInsert function assumes sorted ascending order only.

Structure

Normally a structure is not maintained in sort order, but can be sorted by invoking the sort function. If a structure has been sorted, the binaryInsert function should be used to add new keys to the structure and preserve the sort order.

Matrix

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

Normally a Matrix is not maintained in sort order, but can be sorted by invoking the sort function. If a Matrix has been sorted in ascending order, the binaryInsert function should be used to add new values to the Matrix and preserve the sort order. The binaryInsert function assumes sorted ascending order only.

NumMatrix

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

Normally a NumMatrix is not maintained in sort order, but can be sorted by invoking the sort function. If a NumMatrix has been sorted in ascending order, the binaryInsert function should be used to add new values to the Matrix and preserve the sort order. The binaryInsert function assumes sorted ascending order only.

 

Syntax


Expression:

(binaryInsert vector newValue)


Arguments Name Type Description
Argument:vectorVector FltVector IntVector NumVector BitVector ShortVector A predefined vector variable or constant.
Argument:newValueCharacter String Symbol Vector BitVector Brick ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean The new value to be installed in the Vector.

Returns:

The index where the new key was installed.




Expression:

(binaryInsert struct newkey)


Arguments Name Type Description
Argument:structStructure A predefined Structure variable or constant.
Argument:newkeySymbol The new key to be installed in the Structure.

Returns:

The index where the new key was installed.




Expression:

(binaryInsert matrix newValue)


Arguments Name Type Description
Argument:matrixMatrix a previously sorted Matrix
Argument:newValueCharacter String Symbol Vector BitVector Brick ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean The new value to be installed in the Matrix.

Returns:

The index where the new key was installed.




Expression:

(binaryInsert nummatrix newValue)


Arguments Name Type Description
Argument:nummatrixNumMatrix a previously sorted Matrix
Argument:newValueCharacter String Symbol Vector BitVector Brick ByteVector IntVector FltVector ObjVector Structure Dictionary Directory Matrix NumMatrix Integer Float Number Complex Boolean The new value to be installed in the NumMatrix.

Returns:

The index where the new key was installed.



 

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 Brick ByteVector IntVector
ShortVector FltVector ObjVector Structure
Dictionary Directory CpxVector Matrix
NumMatrix Integer Float Number
Complex Boolean

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 argument
arithmetic asin atan 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 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 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 lcm left
length lisp list loadModule
loadObject loadRepository loadWorkspace lock
log10 log2 logConsole log
logbase macroReplace makeDictionary makeGaussianMatrix
makeGramMatrix makeQuotedList makeQuotedSymbol makeStructure
map mapc matrixGaussianEliminate matrixGaussianSubstitute
max median member methodsOf
mid min minute mod
modi money month morph
muli 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 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