({{, (RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[f] 
defines a resource function that can be applied to arguments to give the same result as f[…].}, {, (RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[f,name]
uses name as the name of the resource function.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[…] returns (RefLink[ResourceFunction, paclet:ref/ResourceFunction])[…].

(RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[f,…] immediately stores all definitions on which f[…] depends. If the definitions change later, values obtained from (RefLink[ResourceFunction, paclet:ref/ResourceFunction])[…][…] will not be affected.

In (RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[f,…], f can be any expression.

In (RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[f], the resource function produced will have name (RefLink[SymbolName, paclet:ref/SymbolName])[f] if f is a symbol.

(RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[(RefLink[Unevaluated, paclet:ref/Unevaluated])[f],…] defines a resource function for a symbol f, without evaluating the symbol.

If a name cannot be inferred from f, a unique name will be assigned.

The definitions set up by (RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction]) will not persist past the end of the session.

(RefLink[CloudDeploy, paclet:ref/CloudDeploy]), (RefLink[CloudPublish, paclet:ref/CloudPublish]), (RefLink[LocalCache, paclet:ref/LocalCache]), etc. can be used to store persistent versions of a resource function.

Use a definition notebook from File ▶ New ▶ Repository Item ▶ Function Repository Item to create a resource function with properties.

(RefLink[DefineResourceFunction, paclet:ref/DefineResourceFunction])[] also opens a new definition notebook.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create a new (RefLink[ResourceFunction, paclet:ref/ResourceFunction]):

DefineResourceFunction[1+#&,"Add One"]

Create a (RefLink[ResourceFunction, paclet:ref/ResourceFunction]) from a symbol:

RedPlot[args___]:=Plot[args,PlotStyle->Red]

rf=DefineResourceFunction[RedPlot]

Apply the resulting function to arguments:

rf[Sin[x],{x,0,Pi}]

OpenersExampleSection2(Spacer1)Properties & Relations  (2)

Dependencies are automatically included in the resource:

randomCities[n_]:=RandomEntity["City",n];
getPopulation[city_]:=EntityValue[city,"Population"];
mapCitiesBySize[cities_]:=GeoBubbleChart[Normal@AssociationMap[getPopulation,cities]];
RandomCityMap[n_]:=mapCitiesBySize[randomCities[n]]

rf=DefineResourceFunction[RandomCityMap,"Random City Map"]

rf[6]

The resource works even if the original definitions are cleared:

Clear[getPopulation,randomCities]

rf[6]

If no name is given for a pure function, an "Untitled" name is automatically generated:

DefineResourceFunction[Factorial[#]/#^3&]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ResourceFunction, paclet:ref/ResourceFunction])  ▪  (RefLink[ResourceObject, paclet:ref/ResourceObject])  ▪  (RefLink[ResourceData, paclet:ref/ResourceData])  ▪  (RefLink[Save, paclet:ref/Save])  ▪  (RefLink[CloudSave, paclet:ref/CloudSave])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Wolfram Function Repository, paclet:guide/WolframFunctionRepository])}, {▪(RefLinkPlain[Package Development, paclet:guide/PackageDevelopment])}})}})