6
$\begingroup$

The new Data Drop product sounds interesting. Can I use Databin to share Packages and Notebooks?

If yes. How? Something like:

bin = CreateDatabin[]
DatabinAdd[bin, <|"myPack" -> "???"|>]

And then, how can I load a package stored in a Databin?

cross related Wolfram Community question

$\endgroup$
1
  • 2
    $\begingroup$ You could store packages encoded (or not) as a String. Actually I think this is design oversight in Mathematica : a package is not a expression. $\endgroup$ Mar 5, 2015 at 3:22

1 Answer 1

5
$\begingroup$

An ancient question - I just started digging my nose into Databins. Here's one way to store a package in databins. the key is to drop them as inactivated expressions

Remove[Collatz]
Collatz[5]
bin = CreateDatabin[];
DatabinAdd[bin, 
 Import["ExampleData/Collatz.m", "InactivatedExpressions"]];
Collatz[5]
(* Collatz should remain unevaluated in both calls above *)

Now, to pull the package from the datadrop:

First@bin["Values"] // Activate
Collatz[5]
(* A string with some package information is generated here *)
(* {5, 16, 4, 2, 1} *)

I played briefly with data semantics since Package is a valid $InterpreterType; however, I did not see any immediate benefit to my dummy code outside of requiring more text to parse the Association.

$\endgroup$
1
  • $\begingroup$ interesting. tks for sharing. +1 $\endgroup$
    – Murta
    Feb 2, 2016 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.