mapc

 

 

Overview

The mapc Function applies the specified function {proc} to each value in {vector}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Structure

The mapc Function applies the specified function {proc} to each value in {structure}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Dictionary

The mapc Function applies the specified function {proc} to each value in {dictionary}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Directory

The mapc Function applies the specified function {proc} to each value in {directory}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Matrix

The mapc Function applies the specified function {proc} to each value in {matrix}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

NumMatrix

The mapc Function applies the specified function {proc} to each value in {nummatrix}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Pair

The mapc Function applies the specified function {proc} to each value in the{pair}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

List

The mapc Function applies the specified function {proc} to each value in the{list}. The mapc function returns the value resulting from the last mapping of the specified function. The function {proc} must be a function that requires a single argument.

Usage

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Vector. It is a simpler than coding a loop and applying a function to each Vector element. For instance, the mapc function, with arguments of {proc} and {vector}, is equivalent to the following generic loop code:

(loop for i from 0 until (length vector) do (proc vector[i]))

Structure

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Vector. It is a simpler than coding a loop and applying a function to each Structure element. For instance, the mapc function, with arguments of {proc} and {structure}, is equivalent to the following generic loop code:

(loop for i from 0 until (length structure) do (proc structure[i]))

Dictionary

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Vector. It is a simpler than coding a loop and applying a function to each Dictionary element. For instance, the mapc function, with arguments of {proc} and {dictionary}, is equivalent to the following generic loop code:

(loop for i from 0 until (length dictionary) do (proc dictionary[i]))

Directory

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Vector. It is a simpler than coding a loop and applying a function to each Directory element. For instance, the mapc function, with arguments of {proc} and {directory}, is equivalent to the following generic loop code:

(loop for i from 0 until (length directory) do (proc directory[i]))

Matrix

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Matrix. It is a simpler than coding a loop and applying a function to each Matrix element. For instance, the mapc function, with arguments of {proc} and {matrix}, is equivalent to the following generic loop code:

(loop for i from 0 until (length matrix) do (proc matrix[i]))

NumMatrix

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the NumMatrix. It is a simpler than coding a loop and applying a function to each NumMatrix element. For instance, the mapc function, with arguments of {proc} and {matrix}, is equivalent to the following generic loop code:

(loop for i from 0 until (length matrix) do (proc matrix[i]))

Pair

The mapc function is a non-destructive function that behaves like the map with the difference being the return value is the value returned by the last function whereas mapc returns a new copy of the Pair or List. It is a simpler than coding a loop and applying a function to each Pair or List element. For instance, the mapc function, with arguments of {proc} and {pair}, is equivalent to the following generic loop code:

(loop for i from 0 until (length pair) do (proc pair[i]))

 

Syntax


Expression:

(mapc proc vector)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:vector Vector FltVector ShortVector IntVector NumVector Vector containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc structure)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:structure Structure Structure containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc dictionary)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:dictionary Dictionary Dictionary containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc directory)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:directory Directory Directory containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc matrix)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:matrix Matrix Matrix containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc nummatrix)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:nummatrix NumMatrix NumMatrix containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc pair)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument:pair Pair A Pair containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.




Expression:

(mapc proc list)


Arguments Name Type Description
Argument:proc Function A function requiring a single argument.
Argument: list List A List containing the argument values for the function {proc}

Returns:

The result of the last invocation of the function {proc}.



 

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 Pair List ShortVector
NumMatrix FltVector IntVector NumVector

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

addMethod appendWriteln append apply
associate binaryInsert binarySearch bitToIntegerVector
bitToNumberVector boolean c::r car
cdr class compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compile cons
copy count debugDetective defineStructure
defstruct delete dimension display
eval exportCsv exportSbf exportTab
fieldsOf findBlock find freeBlock
importCsv importSbf importTab insert
inside integer isAtom isBitVector
isBoolean isBound isByteVector isCharAlphabetic
isCharAlphanumeric isCharLowercase isCharName isCharNumeric
isCharUppercase isCharWhitespace isChar isCharacter
isClass isComplex isDate isDictionary
isDirectory isEqual isError isFloatVector
isIdentical isInside isIntegerVector isInteger
isLambda isMatrix isMember isMoney
isNumberMatrix isNumberVector isNumber isObjectVector
isObject isPair isPcodeVector isString
isStructure isSymbol isText isType
isVector last length lisp
list loadRepository macroReplace makeDictionary
makeGaussianMatrix makeGramMatrix makeQuotedList makeStructure
map mapc matrixGaussianEliminate matrixGaussianSubstitute
member methodsOf money morph
new number objectToDictionary objectToDirectory
objectToList objectToMatrix objectToNumMatrix objectToNumVector
objectToStructure objectToVector offset pair
parent parse pointer product
proplist proprecord putprop quote
rank refAttributes refValues ref
remProp remove resize reverse
saveImmediate saveObject saveRepository send
setAttributes setBlock setCar setCdr
setLastCdr setq sizeof sort
stringToBVector stringToVector string super
svmRegression type uniqueInsert vectorBinaryInnerProduct
vectorBipolarInnerProduct vectorCosineInnerProduct vectorCubeInnerProduct vectorDelete
vectorExpInnerProduct vectorFill vectorInnerProduct vectorLogInnerProduct
vectorQuartInnerProduct vectorQuintInnerProduct vectorSigmoidInnerProduct vectorSineInnerProduct
vectorSquareInnerProduct vectorTanInnerProduct vectorTanhInnerProduct writelg
writeln

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE