Message Boards Message Boards

0
|
5700 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

What is involved in deploying locally from Wolfram Function Repository?

What does it mean to "deploy locally on this computer" a function that one has downloaded, in the form of the source notebook, from the Wolfram Function Repository? That is, if one opens the downloaded notebook, opens it in Mathematica, presses the "Deploy" button and then selects "Locally on this computer" from the drop-down menu?

Does this action save it in $UserBaseDirectory and, if so, then:

  • where is it saved?
  • how does one load the function's definition subsequently at another session? and
  • how does one see its documentation in the Documentation Center?

Or does deploying it, in that sense, merely mean that the expression for its definition is evaluated? (But that does not make sense to me, given that the "Deploy" button also has a separate choice "In this session only (without documentation)".

Example function: SymmetricDifference

POSTED BY: Murray Eisenberg
6 Replies
Posted 5 years ago

In fact, I see no directory ~/Library/Wolfram/Objects/Resources/c3f at all.

I would have expected local installs of resource functions to always be in the same location. I got that path from

ResourceFunction["SymmetricDifference"] // Information
POSTED BY: Rohit Namjoshi

OK, that helps: on my system

Information[ResourceFunction["SymmetricDifference"]]

yields as Function Location

LocalObject["file:///Users/myname/Library/Wolfram/Objects/Resources/\
4f3/4f3f7f00-c70a-455e-8bd4-1eaa2b455ae5/download/DefinitionData"]

...which is in a different folder than you found!

An aside: it's really annoying that while Information works on the ResourceFunction expression, neither

 ?ResourceFunction["SymmetricDifference"]`

nor

?? ResourceFunction["SymmetricDifference"]

works — each returning

  Missing["UnknownSymbol", "ResourceFunction[\"SymmetricDifference\"]"]

which seems to be contrary to what the Documentation Center page Information says in its Details section about the special input forms! This is either a bug in the version 12.0 updated Information implementation or an error or omission in the documentation for it.

POSTED BY: Murray Eisenberg
Posted 5 years ago

What should one do so that such functions become available directly, as if they were built-in

I think the resource function framework was designed so that they would not be in the System or Global context.

You could do this

SymmetricDifference = ResourceFunction["SymmetricDifference"]
SymmetricDifference[{1, 2, 3}, {3, 4, 5}]
(* {1, 2, 4, 5} *)

The actual definition is in the "FunctionRepository`$c3fc4fd0fb6645c594c25bce56bed0e3" context, See

Import["~/Library/Wolfram/Objects/Resources/c3f/c3fc4fd0-fb66-45c5-94c2-5bce56bed0e3/download/DefinitionData/export"]
POSTED BY: Rohit Namjoshi

Using SymmetricDifference = ResourceFunction["SymmetricDifference"] does allow one to use the function. However:

  • evaluating ?SummetricDifference still gives no useful information (beyond saying it is Global`SymmetricDifference); and
  • still there is no information on SymmetricDifference in the Documentation Center.

Moreover:

  • Import["~/Library/Wolfram/Objects/Resources/c3f/c3fc4fd0-fb66-45c5-\ 94c2-5bce56bed0e3/download/DefinitionData/export"] gives an error that the object of the import was not found! In fact, I see no directory ~/Library/Wolfram/Objects/Resources/c3f at all.

Also:

  • What is /Library/Wolfram/Objects/DeployedResources/Function/SymmetricDifference? This directory contains two files, object.wl and put.wl. How does one use that?
POSTED BY: Murray Eisenberg
Posted 5 years ago

Murray,

They are stored under FileNameJoin[{$LocalBase, "Resources"}] : enter image description here

POSTED BY: Rohit Namjoshi
  1. Does the Mathematica Documentation Center have a page on which that is explained? Does the Wolfram Function Repository itself? (If so, I certainly did not see it.)
  2. Evaluating AppendTo[$Path, FileNameJoin[{$LocalBase, "Resources"}]] does not make such a function available. That is, evaluating, say, ?SymmetricDifference returns Missing["UnknownSymbol", "SymmetricDiference"] and an expression such as SymmetricDifference[{1, 2, 3}, {2, 3, 4, 5}] returns unevaluated — even after I have "deployed locally to this computer" from SymmetricDifference-definition.nb. Why?
  3. I do know about the (experimental) function ResourceFunction. After I have "deployed locally to this computer" from SymmetricDifference-definition.nb, if I then evaluate ResourceFunction["SymmetricDifference"], I can copy/past the resulting object and use it as if it were an ordinary function. Nonetheless, ?SymmetricDifference still returns Missing["UnknownSymbol", "SymmetricDiference"] and SymmetricDifference[{1, 2, 3}, {2, 3, 4, 5}] returns unevaluated.

This all seems plain dumb!

What should one do so that such functions become available directly, as if they were built-in (or, at worst, as if they were in an add-on application that one must load)?

How does one readily see the names of all such locally deployed functions?

POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract