Wolfram Computation Meets Knowledge

CloudPutByHash

Contributed by: Richard Hennigan (Wolfram Research)

CloudPut to a location determined by the hash of an expression

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

More Examples

Scope

Specify a different root directory:

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

Generalizations & 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]=

Neat Examples

Resource History