represents an expression whose value is persistently stored in the cloud.
represents a cloud expression with a given URI.
represents the part of a cloud expression specified by the parti.
Details and Options
- CloudExpression["name"] immediately evaluates to CloudExpression[uri], where the path for the URI is determined by the value of $CloudExpressionBase.
- The value stored in a cloud expression can be any Wolfram Language expression.
- When the value consists of nested lists and associations, lookup and updating of parts is handled directly in the cloud.
- CloudExpression[…][part1,part2,…] retrieves the value of the specified part of the cloud expression.
- CloudExpression[…] retrieves the value of the entire cloud expression.
- CloudExpression[…][part1,part2,…]=value sets the value of part of a cloud expression.
- The following operations can be performed on CloudExpression objects:
Get get the complete value of the cloud expression Put put a new complete value into the cloud expression Part return a cloud expression object that represents the part Set assign new values to parts of the cloud expression Unset remove parts from the cloud expression AppendTo append to a list or association within the cloud expression AssociateTo associate a new value to a key in an association AddTo,Increment,… add, increment, etc. parts in the cloud expression DeleteCloudExpression delete the cloud expression Length return the length of the cloud expression KeyExistsQ test if a key exists in the cloud expression SetOptions set options associated with the cloud expression Options get the options associated with the cloud expression SetPermissions set permissions of the cloud expression ClearPermissions clear permissions of the cloud expression
- CloudExpression[…][[part1,part2,…]] gives CloudExpression[…,part1,part2,…], from which the value can be retrieved using Get.
- Cloud expressions have the following options, whose values are stored in the cloud:
PartProtection Automatic which parts are protected from change Permissions Automatic permissions for access etc.
- After creating a cloud expression with CreateCloudExpression, options for cloud expressions can be retrieved using Options and changed using SetOptions.
- In associations, when a mutable operation is applied to a missing key, the associated value is initialized before the operation is applied.
Set associate the missing key to the value specified in Set AssociateTo initialize the value to an empty association AppendTo initialize the value to an empty list AddTo, Increment, ... initialize the value to 0 TimesBy, DivideBy initialize the value to 1
Examplesopen allclose all
Basic Examples (2)
Add a new key using AppendTo:
Looking up a key that does not exist will return a Failure object:
Cloud expressions support Length:
Parts of a cloud expression also support Length:
Cloud expressions support KeyExistsQ:
KeyExistsQ also works on parts of a cloud expression:
Properties & Relations (8)
The entire expression stored in a cloud expression can be replaced with Put:
The existing value can be retrieved with Get:
DeleteCloudExpression deletes a cloud expression:
AppendTo adds a new element at the end of the list:
AppendTo changes the value associated with an existing key:
AppendTo will add an entry at the end of the association, if the key does not already exist:
AssociateTo will not reorder the entry if it already exists:
Remove the last elements of each list with Unset:
Set part protection to None:
With part protection set to None, it is possible to remove the first list:
Collect metadata by randomly selecting users, representing clients making HTTP requests. Values are automatically initialized to an empty list before the AppendTo operation is performed if they do not already exist:
Use FileByteCount to get the cloud storage used by a cloud expression:
Possible Issues (4)
Cloud expressions do not support PrependTo:
If needed, KeyExistsQ can be used to initialize the value for the new keys:
Insert the nested key, automatically initializing "last_score" to an empty association prior to the Set operation:
Use SetOptions to allow the modification:
If an arithmetic operation is attempted on an extended-precision integer or real number, and the number cannot be coerced to a machine-size number, a failure object will be returned and the operation will not be performed:
Neat Examples (3)
Create a form function that identifies the language of the requested string. The form function will also log the result of the request, the ID of the cloud user making the request, and the time spent:
Wolfram Research (2016), CloudExpression, Wolfram Language function, https://reference.wolfram.com/language/ref/CloudExpression.html (updated 2021).
Wolfram Language. 2016. "CloudExpression." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/CloudExpression.html.
Wolfram Language. (2016). CloudExpression. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CloudExpression.html