"Function" (Resource Object Type)
Details
- Each function resource contains a single function that can be accessed with ResourceFunction.
Properties
- There are standard ResourceObject properties common to all resource types ». Additionally, each resource type defines additional special properties.
- Special properties for function resources associated with the internal storage of the function include:
-
"Function" raw internal symbol defining the function "Symbol" internal symbol name in HoldForm "SymbolName" fully qualified string name of the underlying symbol "Context" context of the internal symbol "Definition" Definition of the function in a dedicated context "DefinitionData" WXF ByteArray containing definition "DefinitionList" definition stored using an internal data structure "DefaultValues" DefaultValues of the function "DownValues" DownValues of the function "FullDefinition" FullDefinition of the function in a dedicated context "Messages" list of messages defined for the function "Options" Options of the function "OwnValues" OwnValues of the function "SubValues" SubValues of the function "UpValues" UpValues of the function - Additional properties for function resources include:
-
"DocumentationNotebook" documentation notebook containing usage, details and examples "FunctionLocation" CloudObject, LocalObject or File containing the function "VerificationTests" held VerificationTest objects defined for the function "TestNotebook" generated testing notebook containing "VerificationTests" "TestReport" results of evaluating the "VerificationTests" "Usage" formatted summary of the function's usage - When a published resource function's definition is downloaded, it is typically stored locally for future use. The "FunctionLocation" value changes from a CloudObject to a LocalObject when that caching occurs.
- All function resources have the property "ResourceType""Function".
- Properties used for sorting function resources include:
-
"Categories" list of domains associated with the function - Commonly used standard ResourceObject properties for function resources include:
-
"DefinitionNotebook" notebook defining the function and resource "ExampleNotebook" notebook of example inputs and outputs "Version" version of the local copy
Using a Function Resource
- The function within a ResourceObject is accessed with ResourceFunction.
- Properties can be accessed using ResourceObject[…]["prop"] or ResourceFunction[…,"prop"].
Creating a Function Resource
- The easiest way to create a simple function resource is with DefineResourceFunction. The ResourceObject can be retrieved by applying ResourceObject to the generated ResourceFunction.
- To create a function resource with complete metadata, use the definition notebook available with CreateNotebook["FunctionResource"].
- Using the definition notebook, the resource can also be stored locally, deployed to the cloud or submitted for publication in the Wolfram Function Repository.
Publishing in the Function Repository
- Function resources can be published in the Wolfram Function Repository.
- Submission to the function repository requires a PublisherID.
- Publication requires approval from a review team and typically involves modifications. To improve the efficiency of the review process, please follow the style guidelines.
Examples
open allclose allBasic Examples (2)
Retrieve a function resource from the public repository:
The resource has type "Function":
Create a ResourceFunction from the resource:
Create a new resource function using DefineResourceFunction:
Retrieve the ResourceObject:
Scope (2)
Explore the metadata for a published function resource:
See the CloudObject containing the function definition:
Open a blank function resource definition notebook to create a new function with metadata: