Example NumVector apply 007

 

 

Description

This example defines a Vector containing Number values. Then it uses the apply function to add all the values in the Vector.

 

Details

(setq X (new Vector: number: 3 1 2.654 3)) Returns: #<NumVector 197815>
(apply + X) Returns: 6.654

Notes and Hints

Equivalent expression not using apply:

(+ (+ X[0] X[1]) X[2] )

Returns: 6.654

(+ X[0] X[1] X[2] )

Returns: 6.654

 

Related Examples

Here are examples of the apply function at work.

BitVector apply 008 CpxVector apply 010 FltVector apply 005 IntVector apply 006
Matrix apply 005 Matrix apply 006 NumMatrix apply 009 NumVector apply 007
Pair apply 009 Pair apply 010 ShortVector apply 007 Structure apply 001
Structure apply 002 Vector apply 003 Vector apply 004

 

Function Links

Here is the link to the current function used in this example.

apply

Here are a number of links to other related functions.

defmethod(NumVector) addMethod(NumVector)

 

Argument Types

Here are the links to the data types of the arguments used in this example.

NumVector

Here are a number of links to examples having similar argument types.

BitVector bitToNumberVector 001 BitVector inside 007 NumVector addMethod 021 NumVector append 008
NumVector apply 007 NumVector binaryInsert 006 NumVector binarySearch 007 NumVector bitToNumberVector 002
NumVector cdr 008 NumVector compare 016 NumVector compareEQ 014 NumVector compareGE 014
NumVector compareGT 014 NumVector compareLE 014 NumVector compareLT 014 NumVector compareNE 014
NumVector comparison 014 NumVector copy 008 NumVector defmethod 019 NumVector delete 011
NumVector insert 007 NumVector inside 006 NumVector isAtom 007 NumVector isEqual 015
NumVector isIdentical 014 NumVector isNumberVector 001 NumVector isObject 009 NumVector isType 018
NumVector length 010 NumVector map 007 NumVector mapc 007 NumVector member 006
NumVector methodsOf 019 NumVector new 011 NumVector objectToNumVector 001 NumVector ref 024
NumVector remove 006 NumVector resize 008 NumVector reverse 005 NumVector send 017
NumVector setCdr 008 NumVector setLastCdr 008 NumVector setq 021 NumVector sizeof 016
NumVector sort 015 NumVector svmRegression 001 NumVector type 018 NumVector uniqueInsert 006
NumVector vectorBinaryInnerProduct 001 NumVector vectorBipolarInnerProduct 001 NumVector vectorCosineInnerProduct 001 NumVector vectorCubeInnerProduct 001
NumVector vectorExpInnerProduct 001 NumVector vectorFill 005 NumVector vectorInnerProduct 001 NumVector vectorLogInnerProduct 001
NumVector vectorQuartInnerProduct 001 NumVector vectorQuintInnerProduct 001 NumVector vectorSigmoidInnerProduct 001 NumVector vectorSineInnerProduct 001
NumVector vectorSquareInnerProduct 001 NumVector vectorTanInnerProduct 001 NumVector vectorTanhInnerProduct 001 ObjVector cdr 009
ObjVector sort 016

How do I contact the AIS Server team?

You can always talk with the AIS at aiserver.sourceforge.net.