Skip to main content
added 173 characters in body
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751

Bug fixed in V11.2

Previously dependencies collector failed to collect check if check was only mentioned in lhs: foo[x_?check] := $Failed;


Cross posted on community.wolfram.com

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

Cross posted on community.wolfram.com

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

Bug fixed in V11.2

Previously dependencies collector failed to collect check if check was only mentioned in lhs: foo[x_?check] := $Failed;


Cross posted on community.wolfram.com

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

edited tags
Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Tweeted twitter.com/StackMma/status/874374274840178688
added 98 characters in body
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751

Cross posted on community.wolfram.com

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

Cross posted on community.wolfram.com

Background

After failed attempt (1) to create a complex API, by nicely linking my APIFunction to a cloud based package, I decided to go with the flow and trust that:

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

Problem

but either it can't be trusted or I'm missing the point. It seems that definitions are collected by scanning right-hand-sides of related definitions but not left-hand-sides.

Example

ClearAll[foo, check];
check = IntegerQ;
foo[x_?check] := $Failed;
foo[x_] := x^2

api = CloudDeploy[
    APIFunction[{"x" -> "Number"}, foo[#x] &]
  , Permissions -> "Public"
]
foo[2]     (* -> $Failed*)
foo[1.2]   (* -> 1.44 *)
URLExecute[api, {"x" -> 2}]    (* -> 4*) !!!!!!!!!!!
URLExecute[api, {"x" -> 1.2}]  (* -> 1.44*)

The first URLExecute is wrong, it is caused by missing definition of check.

One can confirm that by

Import[api, "Text"]
Language`ExtendedFullDefinition[] = Language`DefinitionList[ 
  HoldForm[foo] -> {..., DownValues -> {
    HoldPattern[foo[(x_)?check]] :> $Failed, 
    HoldPattern[foo[x_]] :> x^2
    }, ...
 }];
APIFunction[{"x" -> "Number"}, foo[#x] & ]

Questions

  • Is this expected? Are there any new guidelines how to write code so it could be collected well? Or is it a flaw in Language` ?

  • Is there anything I could read to learn working with the Cloud features in such a way that I won't have to come back here with a question/problem about a basic issue like deployment of dependencies?

Links

  1. Clean package update for API/FormFunctions on Wolfram Cloud

  2. Why my cloud application failed to display manipulate element correctly?

  3. CloudDeploy a Manipulate with dependent functions

added 116 characters in body
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Loading
deleted 2 characters in body
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Loading
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Loading