The balance function locates the sub-string (if any) of the source string {sourceString}, starting at the specified displacement {startPos}, that is enclosed by parentheses. If the specified source start location is not enclosed by parentheses, the balance function returns the Boolean value false.


Since the Lisp language is heavily (like all Lisp dialects) involved with matching open and close parentheses, this function can be used often during automated Script editing.




(balance sourceString startPos)

Arguments Name Type Description
Argument:sourceStringString Source String that contains a Lisp expression
Argument:startPosInteger An integer value that represents the starting position to determine if the expression is balanced.


If the specified source string starting at the specified position, is balanced, then the return value is the substring containing the balanced expression. If the string is not balanced, then the Boolean value false is returned.



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.

Lambda String Integer

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

++ += + /=
/ *= * --
-= - addMethod addi
appendWriteln append argCount argFetch
attachLibrarian avg badd balance
bdiv binaryInsert binaryNand binaryNor
binaryNot binaryNxor binarySearch bitwiseAnd
bitwiseNand bitwiseNor bitwiseNot bitwiseNxor
bitwiseOr bitwiseShiftLeft bitwiseShiftRight bitwiseXor
bmod bmul boolean cadd
callcc cdiv char character
class clean closeLog cmod
cmul code compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compile compress
cons copy count csub
date day days360 debugBrowsableProcs
debugDetective debugEval debug defchild
defclass define(macro) define defmacro
defmethod deforphan defriend defun
deleteRows delete detachLibrarian dimension
disassemble display divi downcase
encode evalInSyncLocalContext eval exit
exportCsv exportSbf exportTab fact
fdisplay fileClose fileCopy fileDir
fileDisplay fileEraseDir fileErase fileExists
fileMakeDir fileOpen fileReadAll fileReadRecord
fileRead fileResize fileSeek fileSizeOf
fileWriteAll fileWrite filewriteln findBlock
find floor fraction freeBlock
gcd getRecursionCount 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 lambda lcm
left length lisp list
loadModule loadWorkspace macroReplace makeLambda
makeQuotedList makeQuotedSymbol max median
member mid min minute
mod modi money month
muli myself new number
objectToMatrix objectToNumMatrix objectToNumVector offset
onError openLog pair parent
parse pointer preAllocateFixedMemoryBlocks product
qt random randomize range
rank refAttributes refLibrarian refValues
ref remove replace rept
resize right round run
saveImmediate saveModule saveObject 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 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