macroReplace

 

 

Overview

The macroReplace function supports c-like argument substitution macros. Up to ten arguments may be entered %1, %2, ... %9. The final argument must be the macro template containing the argument references to be replaced. If the argument template is a String, the function will substitute areguments and return a String. If the argument template is a List, the function will substitute areguments and return a List.

For instance the expression, (macroReplace '(/ 1 x) 23 {(+ %1 %2)}) performs argument substitution and returns the following string: "(+ (/ 1 x) 23)".

Alternatively the expression, (macroReplace '(/ 1 x) 23 '(+ %1 %2)) performs argument substitution and returns the following List: '(+ (/ 1 x) 23).

Usage

The macroReplace function is used to support c-like argument substitution macros. It is used in connection with the defmacro special form.

 

Syntax


Expression:

(macroReplace %1 %2 ... %9 macroTemplate)


Arguments Name Type Description
Argument:%1Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda Any Lisp expression to be substituted into the String macro template
Argument:%2Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%3Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%4Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%5Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%6Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%7Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%8Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:%9Character String Symbol Vector BitVector ByteVector IntVector Date FltVector ObjVector Structure Brick Dictionary Directory List Void Matrix NumMatrix Integer Float Number Complex Boolean Number Lambda (Optional) Lisp expression to be substituted into the String macro template
Argument:macroTemplateString A macro template containing references to arguments %1 thru %9. The arguments are substituted with the value of the actual arguments. Up to nine arguments can be substituted. If the macroTemplate is a String, then a String, with the arguments substituted, will be returned. If the macroTemplate is a List, then a List, with the arguments substituted, will be returned.

Returns:

Returns the macro String template with arguments substituted



 

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 Date
FltVector ObjVector Structure Brick
Dictionary Directory List Void
Matrix NumMatrix Integer Float
Number Complex Boolean Number
Lambda

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
associate 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 c::r cadd
callcc car 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 last
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 quote 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
today 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