Skip to main content

export - Why my cloud application failed to display manipulate element correctly?


I have:



Fence[content_, length_] := Column[{
Grid[Partition[Characters[content], UpTo[length]]],
Grid[{Select[
Flatten[Transpose[
PadRight[
Partition[Characters[content],
UpTo[length]], {Ceiling[Length[Characters[content]]/length],
length}, "@@"]]], # != "@@" &]}]
}]
Mani[content_] :=

Manipulate[Fence[content, x], {x, 1, Length[Characters[content]], 1}]

Then test it in my desktop Mathematica and everything goes well:


enter image description here


So I deploy:


CloudDeploy[Mani["0123456789"], Permissions -> "Public"]
CloudObject["https://www.wolframcloud.com/objects/ea1707d8-8c50-4926-bfad-207c5c1c1430"]

But it seems doesn't evaluate my function(Fence):


enter image description here




Answer



Documentation and Details ans Options section for CloudDeploy are saying:



CloudDeploy[expr,...] automatically deploys all definitions needed to evaluate expr, much like CloudSave.



and as we can see, it's not the case here. Or, it's a feature of Manipulate which boxes definitions are got by FrontEnd so maybe evaluation doesn't apply here.


At the end, you can force them to be remembered by using SaveDefinitions:


Mani[content_] :=  Manipulate[
Column@{Fence[content, x], DownValues@Fence},
{x, 1, Length[Characters[content]], 1},

SaveDefinitions -> True
]

enter image description here


Comments