Message Boards Message Boards

Announcing the Wolfram Function Repository on Community

POSTED BY: Daniel Lichtblau
22 Replies

Thanks Daniel for the nice post. I have already contributed some functions and a bunch are submitted. It is actually also a lot of fun to see new functions appearing every couple days, learn about new stuff and so on!

Just out of curiosity: does Wolfram track the usage of each function? Can contributors get those? I could imagine that functions that are most-used will be considered to be implemented in to the Wolfram Language?

POSTED BY: Sander Huisman

Tracking usage is under discussion. I believe we do count downloads but I'm fuzzy on details. It is not yet determined how we will make this available to contributors but I think we are in consensus that that would be a good thing to do.

POSTED BY: Daniel Lichtblau

I wish I'd read this about 20 minutes ago when, right before hitting the Submit button on two candidate functions, I said "Oh what the heck" when I could not figure out how to format arguments. The consolation is learning that I am not alone.

POSTED BY: Seth Chandler

I think this thread could use some BirdSay:

ResourceFunction["user:rhennigan/BirdSayCommunityPost"][
    "https://community.wolfram.com/groups/-/m/t/1703373"
]

enter image description here

POSTED BY: Richard Hennigan

and https://resources.wolframcloud.com/FunctionRepository/resources/WolfieSay :-)

Are there more animals in the pipeline?

POSTED BY: Sander Huisman

Ahem. What it needs, my young friend, is an artistic rendition.

Start by grabbing the full text.

wfrThreadText = 
 Import["https://community.wolfram.com/groups/-/m/t/1703621", 
  "Plaintext"]

I'll spare everyone the long string but it is readily seen that the text of interest is between the second and third appearances of my name.

posns = StringPosition[wfrThreadText, "Daniel Lichtblau"]

(* Out[370]= {{3351, 3366}, {3453, 3468}, {10171, 10186}, {11139, 
  11154}, {11171, 11186}, {11522, 11537}} *)

I have to step in a number of characters to avoid some stuff on the page. Similar issue at the end altthough less stepping needed.

myText = StringTake[wfrThreadText, {posns[[2, 2]] + 160, posns[[3, 1]] - 20}];

And now we make a picture.

ResourceFunction["TextToKaleidoscope"][myText]

enter image description here

The hard part was spelling "kaleidoscope".

POSTED BY: Daniel Lichtblau

I think it would be nice also to have a "What's new section" for new functions for the users visiting frequently the repository. New functions could stay there for a couple of weeks along with their alphabetic or topic sorting.

Yes exactly. I hadn't noticed that. After how long a function is removed from recent ?

Nice! The next move is to create twitter box in notebook.

POSTED BY: Shenghui Yang

A quick note: by "How it works" section, we can access the resource function offline after the first time you retrieve the content from Wolfram Cloud. Information displays the UUID, local cache and persistent path of a particular local object. For example, we have three ways to use BirdSay

localbase

Of course, BirdSayCommunityPost won't work offline because it requires internet connection to retrieve community articles.

If we no longer want the ResourceFunction object to be present on our machine,

DeleteObject[ResourceObject["<UUID>"]]

or

ResourceFunction["BirdSay"] // ResourceRemove

comes in handy to remove the content.

POSTED BY: Shenghui Yang

Could you, or somebody, please tell us — with a simple, direct explanation that perhaps a Mathematica user of some 20 years standing — exactly how to use a function already in the Wolfram Function Repository?

For example, suppose I want to use the function SymmetricDifference in my local Mathematica notebook.

  1. How do I retrieve it right now for that notebook?
  2. How do I make it available in subsequent sessions without having to go back to the on-line Wolfram Function Repository each time?

Here's one source of my mystification. Input

    ResourceFunction["SymmetricDifference"]

does return as output some kind of gadget, with a gray background, bearing text like [*] SymmetricDifference (it's a placeholder symbol, actually, where I just showed an asterisk).

Yet strangely,

    Information[%]

gives two ResourceObject errors messages that "The specified ResourceObject could not be found", then followed by a formatted version of:

            ResourceFunction[
            ResourceObject[
            Association[
              "Name" -> "SymmetricDifference", 
               "ShortName" -> "SymmetricDifference", 
               "UUID" -> "4f3f7f00-c70a-455e-8bd4-1eaa2b455ae5", 
               "ResourceType" -> "Function", "Version" -> None, 
               "Description" -> "The complement of the union and intersection of \
            lists with duplicates deleted", 
               "SymbolName" -> "FunctionRepository`$\
            4f3f7f00c70a455e8bd41eaa2b455ae5`SymmetricDifference"], 
              ResourceSystemBase -> "https://www.wolframcloud.com/objects/\
            resourcesystem/api/1.0"]]

Next, if I try, say,

    ResourceFunction["SymmetricDifference"][{1, 2, 3}, {3, 4, 5, 6}]

then again I get a "ResourceObject::notf: The specified ResourceObject could not be found." error message.

So I don't even know the answer to my question 1., let alone the answer to 2.

Somebody needs to write up a simple, clear, direct explanation of how to use the WFR -- and make it prominently available as part of the Mathematica documentation center or, at least, on the WFR site. Without that, all the docs I've seen so far about how to write and submit definitions to the WFR are of little avail except to the insiders who already understand what's going on.

POSTED BY: Murray Eisenberg

What version of Mathematica do you have? You need 12.

Does CloudConnect[] work on your machine?

Then the input should just be:

ResourceFunction["SymmetricDifference"][{1, 2, 3}, {3, 4, 5, 6}]

and should return: {1, 2, 4, 5, 6}

POSTED BY: Sander Huisman

Yes, Mathematica 12.0.0. (macOS)

I just ran CloudConnect[], which apparently worked OK as it returned as output the value of my $WolframID. (Shouldn't that happen automatically, when I start Mathematica? When I do, on the Welcome Screen I do see the signing-in process happening automatically.)

But still the same error as before when I try to use

    ResourceFunction["SymmetricDifference"][{1, 2, 3}, {3, 4, 5, 6}]

namely, the error message "ResourceObject::notf: The specified ResourceObject could not be found." and the output:

    $Failed[{1, 2, 3}, {3, 4, 5, 6}]

Wait... I quit that Mathematica session and opened a new one. Now without evaluating CloudConnect[], the input ResourceFunction["SymmetricDifference"][{1, 2, 3}, {3, 4, 5, 6}] works OK. And so does using the iconized output from ResourceFunction["SymmetricDifference"] in that same expression.

This mysterious failure then success more or less answers my first question.

Now what about an answer to my 2nd question?

And related to that, what exactly are the distinctions between, and relationships among, the following directories?

~/Library/Wolfram/Objects/DeployedResources/Function
~/Library/Wolfram/Objects/Persistence/ResourceNames
~/Library/Wolfram/Objects/Resources

I note that in the first of those three directories I have a subdirectory SymmetricDifference containing two items, namely, object.wl and put.wl, the second of which includes among its associations:

"ResourceLocations " -> {LocalObject["file:///Users/murray/Library/Wolfram/O\
bjects/Resources/4f3/4f3f7f00-c70a-455e-8bd4-1eaa2b455ae5 "]}

Or do I not need to understand the relationships among those directories in order to intelligently (with understanding) use a ResourceFunction?

POSTED BY: Murray Eisenberg

I have no idea about storage of those functionsÂ… Is that important to know?

POSTED BY: Sander Huisman

Murray,

Thanks for the questions. I don't know what could have caused your initial failure. Perhaps a failed paclet update of the resource function framework code? Regardless, the dead simple use case that you tried is correct and should have worked immediately. There is no configuration or set up needed. With version 12, anywhere that you can CloudConnect, you can just use ResourceFunction["name"] or the gray, pill-shaped blob like you would a normal symbol in Mathematica.

Once you use a published resource function it will be automatically cached on your computer and you should not need to retrieve it from our servers ever again (unless you choose to get an update).

As for the different file paths. You definitely don't need to know anything about them. They are an implementation detail. If you want to know about them, I'm happy to tell you why we have those three paths.

  • Objects/Resources

is where the actual resources objects (ResourceFunction is built using ResourceObject) are stored locally. It contains the full metadata and any content that has been cached along with possible ancillary files. This path is intended to only be used by the built in ResourceObject code. Directly modifying files on this path is a good way to break things in unpredictable ways. However DeleteObject[ResourceObject[...]] should always provide a clean slate.

  • Persistence/ResourceNames

is part of the PersistentValue framework. It is used by ResourceRegister and ResourceObject to provide fast recognition of resource names. This improves the performance of ResourceFunction["name"] from session to session. Again, modifying files directly on this path will probably only give you headaches.

  • DeployedResources/Function

is a default path for local deployments of resources made by LocalCache with no second argument (or with the Deploy button in the definition notebook). This is a path you might interact with by using ResourceFunction[LocalObject["path"]]. Directly modifying the files here is unlikely to cause you any real issues.

POSTED BY: Bob Sandheinrich

Greatly clarifies & elucidates; thanks!

It's still surprising that, so far as I can see, the WFR does not tell how to use what's there (except somewhat buried in the linked long blog post by Stephen).

POSTED BY: Murray Eisenberg

Check out the documentation:

We have a dedicated guide page https://reference.wolfram.com/language/guide/WolframFunctionRepository.html

Here is the page just for ResourceFunction: https://reference.wolfram.com/language/ref/ResourceFunction.html

You're right, it would have been smart to have one or both of these prominently linked in the blog.

POSTED BY: Bob Sandheinrich

Neither of those pages says what is buried in Stephen's blog post: once you've found a particular function on-line in the Repository, by clicking the appropriate spot there, it automatically copies the relevant ResourceFunction expression onto the clipboard, from which you may then paste it into a Mathematica notebook.

Moreover, Stephen refers to it as a "blob", but it's wholly unclear what is meant by "blob" in this context.

Things should not be so hard to figure out. The WFR should have a prominent link to a page that tells one how to do what I just described.

POSTED BY: Murray Eisenberg

I want to submit an update of a resource function (that is already approved.) Should I just put my updates in the definition notebook from WFR and bravely press the "Submit to Repository" button?

POSTED BY: Anton Antonov

Anton, Yes. Assuming you are the original author that is the correct process.

I'll reiterate for anyone else that is coming across this. Use the definition notebook from the WFR not your original notebook if you saved it. You can get the correct notebook using either the "Source Notebook" button on the website or with: ResourceFunction[name, "DefinitionNotebook"]

POSTED BY: Bob Sandheinrich

Thank you for your prompt response!

POSTED BY: Anton Antonov
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