ref

 

 

Overview

The ref function retrieves the I-th element from the Vector.

String

The ref function retrieves a the I-th character from a Text or String.

Symbol

The ref function retrieves the global value of a Symbol.

Structure

The ref function retrieves a value or a key from a Structure.

Dictionary

The ref function retrieves a value or a key from a Dictionary.

Directory

The ref function retrieves a value or a key from a Directory.

Brick

The ref command retrieves a field value or vital data element from a Brick.

Matrix

The ref function retrieves the I-th element from the Matrix

NumMatrix

The ref function retrieves the I-th element from the NumMatrix

List

The ref function retrieves the I-th element from the List

Function

The ref function retrieves the value of a symbol. When the argument of the ref function is a Function object id, the returned value is the function name. If the argument of the ref function is Function name, the returned value is the object id of the function.

Lambda

The ref function is used with an Lambda object to reference a method, or persistent variable that is owned by the Lambda.

ObjectRepository

The ref allows retrieval of an object from the Object Repository {aGor}. The ref function supports retrieval by arbitrary keys, by index, and by special symbolic keys. The special symbolic keys are keys: member:, odbid:, name:, and position:. The special keys enable the ref function to retrieve special information about the Object Repository such as the filename, associated with the Object Repository, the position in the Repository Index of a specific key or the odbid or frameid which are the identifiers needed by the low level database functions.

As objects are added to the Object Repository, the keys are added to the Repository Index. The Repository Index is a Directory Object and the keys are saved in sorted order. The entries in the Repository Index are Directory bindings comprised of a key and a pointer value which points to the location of the Object in Object Repository (In some cases, the value may be saved as an immediate value in the Repository Index, see the saveImmediate function). The Object Repository automatically handles retrieval of the appropriate value off the disk.



Usage

The ref function is used to access a single vector element. Assuming there are n elements in a Vector, the elements of the vector are accessed as elements 0 thru n-1.

String

The ref function is used to access a single character from a String or Text. Assuming there are n characters in the String or Text, the character indices run from 0 thru n-1

Symbol

The ref function is used to access the value of a character within a Symbol. If no value has been assigned, the ref function will return #void.

Structure

The ref command is used to retrieve a value from a Structure when the key is known or if the position in the Structure is known. The ref command will return either the key or the value at that position (see third syntax form).

Dictionary

The ref command is used to retrieve a value from a Dictionary when the key is known or if the position in the Dictionary is known. If two indices are used, the ref command will return either the key or the value at that location.

Directory

The ref command is used to retrieve a value from a Directory when the key is known or if the position in the Directory is known. If two indices are used, the ref command will return either the key or the value at that location.

Brick

The ref command is used to retrieve a field value or vital data element from a Brick when the field name is known or if the field position in the Brick is known.

Matrix

The ref function is used to access a single Matrix element. Assuming there are n elements in a Matrix, the elements of the Matrix are accessed as elements 0 thru n-1 , or they may be referenced by dimension list if the Matrix is of rank greater than one.

NumMatrix

The ref function is used to access a single NumMatrix element. Assuming there are n elements in a NumMatrix, the elements of the NumMatrix are accessed as elements 0 thru n-1 , or they may be referenced by dimension list if the NumMatrix is of rank greater than one.

List

The ref function is used to access a single List element. Assuming there are n elements in a List, the elements of the List are accessed as elements 0 thru n-1. Also the special attributes of Value: and Pair: are supported. The Value index always returns the Pair itself. The Pair index always return true.

Function

The ref function is used to access the value of a Function name or Function object id. Only one of the arguments can be used.

Date

The ref function is used to access the value of a Date. The default display format used by ref is the Julian representation of the number.

Lambda

The ref statement is used to return the value of a persistent variable belonging to an Lambda or the Object Id of a child Lambda.

ObjectRepository

The ref function is used to retrieve any of the following:

Also, the Object Repository supports low level operations such as Direct Frame Retrieval and Direct Frame Storage. The ref function can be used to retrieve a previously saved object by way of the object's frameid thus bypassing the repository index. The specified frameid must have been obtained from a previous repository save (see the Direct Frame Storage feature of the setq function).

Warning: If no object has been stored under the specified frameid value, or if the specified frameid is invalid, then an error is returned.

 

Syntax


Expression:

(ref obj)


Arguments Name Type Description
Argument:objVoid Boolean Character Number Date Complex Must be a native data type object.

Returns:

The value of the object.




Expression:

(ref string index)

(ref string index)

Strong Typed:

(refString string index)

(refText text index)


Arguments Name Type Description
Argument:stringString or Text A String object or Text
Argument:indexInteger An integer index

Returns:

An integer index




Expression:

(ref symbol index)

Strong Typed:

(refString symbol index)


Arguments Name Type Description
Argument:symbolSymbol A Symbol
Argument:indexInteger The index of the character within the Symbol to reference

Returns:

The value of the character within the Symbol




Expression:

(ref aStruct key)

Strong Typed:

(refStrValue aStruct index)

(refStrKey aStruct index)


Arguments Name Type Description
Argument:aStructStructure The Structure to be referenced.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned. The current key value bindings are assumed NOT to exist in binary unique ascending sorted order.

Returns:

Returns a value bound with the key.




Expression:

(ref aStruct index1)


Arguments Name Type Description
Argument:aStructStructure The Structure to be referenced.
Argument:index1Integer If present and numeric, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref aStruct index1 index2)


Arguments Name Type Description
Argument:aStructStructure The Structure to be referenced.
Argument:index1Integer If present and numeric, index1 specifies an integer index position which is to be referenced.
Argument:index2Integer If present and 0, the key at the specified integer index position will be returned. If present and 1, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref aStruct sorted: key)


Arguments Name Type Description
Argument:aStructStructure The Structure to be referenced.
Argument:sorted:Symbol If present and is the symbol sorted, the current key value bindings are assumed to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref aStruct unsorted: key )


Arguments Name Type Description
Argument:aStructStructure The Structure to be referenced.
Argument:unsorted:Symbol If present and is the symbol unsorted, the current key value bindings are assumed NOT to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref dict key)

Strong Typed:

(refStrValue dict index)

(refStrKey dict index)


Arguments Name Type Description
Argument:dictDictionary The Dictionary to be referenced.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned. The current key value bindings are assumed NOT to exist in binary unique ascending sorted order.

Returns:

Returns a value bound with the key.




Expression:

(ref dict index1)


Arguments Name Type Description
Argument:dictDictionary The Dictionary to be referenced.
Argument:index1Integer If present and numeric, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref dict index1 index2)


Arguments Name Type Description
Argument:dictDictionary The Dictionary to be referenced.
Argument:index1Integer If present and numeric, index1 specifies an integer index position which is to be referenced.
Argument:index2Integer If present and 0, the key at the specified integer index position will be returned. If present and 1, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref dict sorted: key)


Arguments Name Type Description
Argument:dictDictionary The Dictionary to be referenced.
Argument:sorted:Symbol If present and is the symbol sorted, the current key value bindings are assumed to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref dict unsorted: key )


Arguments Name Type Description
Argument:dictDictionary The Dictionary to be referenced.
Argument:unsorted:Symbol If present and is the symbol unsorted, the current key value bindings are assumed NOT to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref dir key)

Strong Typed:

(refDirValue aDir index)

(refDirKey aDir index)


Arguments Name Type Description
Argument:dirDirectory The Directory to be referenced.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned. The current key value bindings are assumed NOT to exist in binary unique ascending sorted order.

Returns:

Returns a value bound with the key.




Expression:

(ref dir index1)


Arguments Name Type Description
Argument:dirDirectory The Directory to be referenced.
Argument:index1Integer If present and numeric, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref dir index1 index2)


Arguments Name Type Description
Argument:dirDirectory The Directory to be referenced.
Argument:index1Integer If present and numeric, index1 specifies an integer index position which is to be referenced.
Argument:index2Integer If present and 0, the key at the specified integer index position will be returned. If present and 1, the value at the specified integer index position will be returned.

Returns:

Returns a value associated with the specified integer index position.




Expression:

(ref dir sorted: key)


Arguments Name Type Description
Argument:dirDirectory The Directory to be referenced.
Argument:sorted:Symbol If present and is the symbol sorted, the current key value bindings are assumed to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref dir unsorted: key )


Arguments Name Type Description
Argument:dirDirectory The Directory to be referenced.
Argument:unsorted:Symbol If present and is the symbol unsorted, the current key value bindings are assumed NOT to exist in binary unique ascending sorted order.
Argument:keySymbol The key whose bound value is to be returned. If no such key is present in the current binding set, a value of #void will be returned.

Returns:

Returns a value bound with the key.




Expression:

(ref vector index)

Strong Typed:

(ref Vector index)


Arguments Name Type Description
Argument:vectorVector A predefined vector object.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref FltVector index)


Arguments Name Type Description
Argument:FltVectorFltVector A predefined Float Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref IntVector index)


Arguments Name Type Description
Argument:IntVectorIntVector A predefined Integer Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref ShortVector index)


Arguments Name Type Description
Argument:ShortVectorShortVector A predefined Short Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref NumVector index)


Arguments Name Type Description
Argument:NumVectorNumVector A predefined Number Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref ObjVector index)


Arguments Name Type Description
Argument:ObjVectorObjVector A predefined Object Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref BitVector index)


Arguments Name Type Description
Argument:BitVectorBitVector A predefined Bit Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref PcodeVector index)


Arguments Name Type Description
Argument:PcodeVectorPcodeVector A predefined Pcode Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

Strong Typed:

(ref ByteVector index)


Arguments Name Type Description
Argument:ByteVectorByteVector A predefined Byte Vector.
Argument:indexInteger An Integer index.

Returns:

A single vector element.




Expression:

(ref aBrick ...)


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:...Symbol none

Returns:

Returns the Brick's field list Structure.




Expression:

(ref aBrick "FieldList")


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:FieldListString The String Field List

Returns:

Returns the Brick's field list Structure.




Expression:

(ref aBrick "FieldCount")


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:FieldCountString The String Field Count

Returns:

Returns the number of fields in each row.




Expression:

(ref aBrick "RowCount")


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:RowCountString The String Row Count

Returns:

Returns the number of rows in each Brick object.




Expression:

(ref aBrick "ByteCount")


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:ByteCountString The String Byte Count

Returns:

Returns the number of bytes in each Brick object.




Expression:

(ref aBrick fieldIndex)


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).

Returns:

Returns the contents of the specified field in the Brick (always the first repeat).




Expression:

(ref aBrick fieldIndex number {rowIndex})


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).
Argument:number Integer The field repeat index of the specified field in the Brick (the first repeat is always index zero).
Argument:rowIndex Integer (Optional) The row index of the specified Brick in the Brick (the first row is always index zero).

Returns:

Returns the contents of the specified field in the Brick (always using the specified repeat index).




Expression:

(ref aBrick fieldIndex type: {rowIndex})


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).
Argument:type: Symbol The symbol type:
Argument:rowIndex Integer (Optional) The row index of the specified row in the Brick (the first row is always index zero).

Returns:

Returns the symbolic name of the data type of the specified field in the Brick.




Expression:

(ref aBrick fieldIndex repeats: {rowIndex})


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).
Argument:repeats: Symbol The symbol repeats:
Argument:rowIndex Integer (Optional) The row index of the specified row in the Brick (the first row is always index zero).

Returns:

Returns the number of repeats of the data type of the specified field in the Brick.




Expression:

(ref aBrick fieldIndex offset: {rowIndex})


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).
Argument:offset: Symbol The symbol offset:
Argument:rowIndex Integer (Optional) The row index of the specified row in the Brick (the first row is always index zero).

Returns:

Returns the offset of the specified field from the beginning of the Brick.




Expression:

(ref aBrick fieldIndex pointer: {rowIndex})


Arguments Name Type Description
Argument:aBrickBrick The Brick to be referenced.
Argument:fieldIndexSymbol Integer The field index of a field in the Brick (must be either a field name or an integer index of the field).
Argument:pointer: Symbol The symbol pointer:
Argument:rowIndex Integer (Optional) The row index of the specified row in the Brick (the first row is always index zero).

Returns:

Returns a pointer to the specified field in the Brick.




Expression:

(ref matrix index)


Arguments Name Type Description
Argument:matrixMatrix A predefined Matrix object.
Argument:indexInteger An integer index or a series of indices

Returns:

A single Matrix element.




Expression:

(ref nummatrix index)


Arguments Name Type Description
Argument:nummatrixNumMatrix A predefined NumMatrix object.
Argument:indexInteger An integer index or a series of indices

Returns:

A single NumMatrix element.




Expression:

(ref list index)


Arguments Name Type Description
Argument:listList A list (collection of pairs).
Argument:indexInteger An integer index, or a symbol index.

Returns:

The list element at list[indexi].




Expression:

(ref FuncId)

(ref FuncName)


Arguments Name Type Description
Argument:FuncId--- The object id of the Function
Argument:FuncNameSymbol The symbolic name of the Function.

Returns:

If the argument of the ref function is a {funcId}, the returned value is the function name. If the argument of the ref function is {funcName}, the returned value is the object id of the function.




Expression:

(ref anLambda.LambdaVariable)


Arguments Name Type Description
Argument:anLambdaLambda The name of an Lambda
Argument:LambdaVariableSymbol Lambda Persistent Variable name or Child Lambda Name

Returns:

If the argument was a persistent variable, the value of the persistent variable is returned. If the argument was a name of a Child Lambda, the object id of the Child Lambda is returned.




Expression:

(ref aGor key)


Arguments Name Type Description
Argument:aGorObjectRepository The ObjectRepository which will be referenced.
Argument:keySymbol The key associated with the object.

Returns:

Returns the object in the Object Repository associated with the key.




Expression:

(ref aGor index1 index2)


Arguments Name Type Description
Argument:aGorObjectRepository The ObjectRepository which will be referenced.
Argument:index1Integer The index (the position) where the object is stored.
Argument:index2Integer The value must be 0 or 1 only. All other values are illegal.

Returns:

If the value of the {index2} argument is equal to 0, then the key at position {index1} will be returned. If the value of the {index2} argument is equal to 1, the object will be returned. If {index1} or {index2} is invalid, then #void is returned




Expression:

(ref aGor position: key)


Arguments Name Type Description
Argument:position:Symbol The symbolic constant to request the position (index) of the specified key argument.
Argument:keySymbol A valid key in the Object Repository argument {aGor}.

Returns:

If the key exists in the Object Repository, the ref function returns the numeric position of the specified index value. If the index is illegal or out of bounds, the Boolean value: false will be returned.




Expression:

(ref aGor member: odbid:)


Arguments Name Type Description
Argument: member:Symbol A keyword argument. If present, it must immediately followed by the keyword odbid:
Argument:odbid:Symbol A keyword argument.

Returns:

If the keyword pair member: and obdid: are the arguments to the ref function, then the ref returns the odbid of the Object Repository (which is a Byte Vector) if the Object Repository is active. If the Object Repository is not active, then the ref function wil return #void.




Expression:

(ref aGor member: name:)


Arguments Name Type Description
Argument: member:Symbol A keyword argument. If present, it must immediately followed by the keyword name:
Argument:name:Symbol A keyword argument.

Returns:

If the keyword pair member: and name: are the arguments to the ref function, then the ref returns the filename string of the Object Repository (including the file's pathname).




Expression:

(ref aGor frame: frameid)


Arguments Name Type Description
Argument: frame:Symbol A keyword argument. If present, it must immediately followed by a frameid value.
Argument:frameidText A valid repository frame id obtained from a previous save.

Returns:

The object as previously saved in the specified frameid.



 

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.

String Symbol Structure Brick
Matrix List Void Number
Date Function ObjectRepository ShortVector
Dictionary Directory Vector Text
Integer Boolean Character Complex
Lambda NumMatrix

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
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 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 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