count

 

 

Overview

The count function returns the number of values in the object argument {obj}. If {obj} is a collection object, such as a List, Vector, Structure, Matirx, Dictionary, or Directory, the count function performs a deep count, i.e., all items in any imbedded collection objects are also counted.

Usage

Use the countfunction to determine the total number of items in an object, including the items in imbedded collection objects. This type of counting is called a deep count. An alternate type of counting is called a shallow count in which embedded collection objects are counted as one. An alternate function, the length function, performs a shallow count.

 

Syntax


Expression:

(count obj)


Arguments Name Type Description
Argument:objStructure Integer Character Number Symbol Text String Boolean List Pair Vector Dictionary Directory Matrix Any Analytic Information Server object

Returns:

If the target is #void, character, number, symbol, text, string, or Boolean, the value 1 is returned.
If the target is a List, then the number of Pairs in the list is returned.
If the target is a Vector, then the number of items in the vector is returned.
If the target is a Structure, Dictionary, or Directory, then the number of bindings is returned. If the target is a Matrix, then the number of non-void items is returned.



 

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 Integer Character Number
Symbol Text String BooleanNumMatrix
List Pair Vector Dictionary
Directory Matrix

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

++ += + /=
/ *= * --
-= - abs acos
add1 addMethod addi appendWriteln
append apply argument arithmetic
asin associate atan avg
badd balance bdiv binaryInsert
binaryNand binaryNor binaryNot binaryNxor
binarySearch bitToNumberVector bitwiseAnd bitwiseNand
bitwiseNor bitwiseNot bitwiseNxor bitwiseOr
bitwiseShiftLeft bitwiseShiftRight bitwiseXor bmod
bmul boolean c::r cadd
car ccompareEQ ccompareGE ccompareGT
ccompareLE ccompareLT ccompareNE cdiv
cdr char character class
clean closeLog cmod cmul
code compareEQ compareGE compareGT
compareLE compareLT compareNE compare
comparison compile compress 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
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 isInexact
isInside isIntegerVector isInteger isLambda
isMatrix isMember isMoney isNegative
isNull isNumberMatrix isNumberVector isNumber
isObjectVector isObject isOdd isPair
isPcodeVector isPositive isString isStructure
isSymbol isText isType isVector
isZero isub julian kurtosis
last lcm left length
lisp list loadModule loadRepository
loadWorkspace lock log10 log2
log logbase macroReplace makeDictionary
makeGramMatrix makeQuotedList makeQuotedSymbol makeStructure
map mapc 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 openLog pair
parent parse pi pointer
preAllocateFixedMemoryBlocks product proplist proprecord
putprop qt quote rad
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
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 system
tan tanh 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