Wolfram Research

Function Repository Resource:

CloudPutByHash

Source Notebook

CloudPut to a location determined by the hash of an expression

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["CloudPutByHash"][expr]

CloudPut expr to a CloudObject determined by the hash of expr.

ResourceFunction["CloudPutByHash"][expr,root]

uses root as the base directory in the cloud.

Examples

Basic Examples

CloudPut an expression:

In[1]:=
ResourceFunction["CloudPutByHash"]["Hello world"]
Out[1]=

The same expression will produce the same cloud object:

In[2]:=
ResourceFunction["CloudPutByHash"]["Hello world"]
Out[2]=
In[3]:=
% === %%
Out[3]=

Scope

Specify a different root directory:

In[4]:=
ResourceFunction["CloudPutByHash"]["Hello world", CloudObject["CloudPutByHash"]]
Out[4]=

Generalizations and Extensions

The hash can be different for unevaluated expressions:

In[5]:=
ResourceFunction["CloudPutByHash"][1 + 1]
Out[5]=
In[6]:=
ResourceFunction["CloudPutByHash"][Unevaluated[1 + 1]]
Out[6]=

Expressions are compressed:

In[7]:=
ResourceFunction["CloudPutByHash"][ConstantArray[0, 10000]]
Out[7]=
In[8]:=
CloudImport[%, "Text"]
Out[8]=
In[9]:=
CloudGet[%%] // Short
Out[9]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information