Package convex.core.lang
Class AFn<T extends ACell>
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.lang.AFn<T>
- Type Parameters:
T- Return type of functions.
- All Implemented Interfaces:
IValidated,IWriteable,IFn<T>
Base class for functions expressed as values
"You know what's web-scale? The Web. And you know what it is? Dynamically
typed." - Stuart Halloway
-
Field Summary
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbytegetTag()Gets the tag byte for this cell.final ATypegetType()Gets the most specific known runtime Type for this Cell.abstract booleanhasArity(int arity) Tests if this function supports the given arity.Invoke this function in the given context.booleanReturns true if this Cell represents a first class CVM Value.booleansupportsArgs(ACell[] args) Tests if this function supports the given argument list By default, checks if the function supports the given arity only.updateRefs(IRefFunction func) Updates all Refs in this object using the given function.Methods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, encode, encodeRaw, equals, equals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, getRefCount, hashCode, isCanonical, isCompletelyEncoded, isEmbedded, mark, mark, toCanonical, toCVMString, toString, validate, validateCell, writeMethods inherited from class convex.core.data.AObject
attachEncoding, print, print, printMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface convex.core.data.IWriteable
estimatedEncodingSize
-
Constructor Details
-
AFn
public AFn()
-
-
Method Details
-
invoke
Description copied from interface:IFnInvoke this function in the given context. -
updateRefs
Description copied from class:ACellUpdates all Refs in this object using the given function. The function *must not* change the hash value of Refs, in order to ensure structural integrity of modified data structures. This is a building block for a very sneaky trick that enables use to do a lot of efficient operations on large trees of smart references. Must return the same object if no Refs are altered.- Overrides:
updateRefsin classACell- Parameters:
func- Ref update function- Returns:
- Cell with updated Refs
-
getType
Description copied from class:ACellGets the most specific known runtime Type for this Cell. -
supportsArgs
Tests if this function supports the given argument list By default, checks if the function supports the given arity only. TODO: intention is to override this to include dynamic type checks etc.- Parameters:
args- Array of arguments- Returns:
- true if function supports the specified args array
-
hasArity
public abstract boolean hasArity(int arity) Tests if this function supports the given arity.- Parameters:
arity- Arity to check- Returns:
- true if function supports the given arity, false otherwise
-
isCVMValue
public boolean isCVMValue()Description copied from class:ACellReturns true if this Cell represents a first class CVM Value. Sub-structural cells that are not themselves first class values should return false, pretty much everything else should return true. Note: CVM values might not be in a canonical format, e.g. temporary data structures- Specified by:
isCVMValuein classACell- Returns:
- true if the object is a CVM Value, false otherwise
-
getTag
public byte getTag()Description copied from class:ACellGets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
-