loads the given context and establishes alias as a context alias for that context.
- Needs["context`"] calls Get["context`"]. By convention, the file loaded in this way is the one that contains a package that defines context`.
- Needs["context`"] automatically adds "context`" to $ContextPath, making all symbols in "context`" available without qualification.
- Needs["context`""alias`"] adds "alias`""context`" to $ContextAliases, providing the ability to use a shorter or easier to type alias to access symbols in that context. Contexts loaded with this form are not added to $ContextPath.
- Needs["context`"None] makes no modifications to $ContextPath or $ContextAliases.
- Needs["file`"] typically reads in a file named .
Examplesopen allclose all
Basic Examples (2)
Read in the file for the Computer Arithmetic Package if it has not already been read:
The commands defined by the package are ready for use:
Read in the Computer Arithmetic package with the alias ca`:
Symbols can be accessed using the context alias:
Symbols can also be accessed using the original context name:
Read in the Computer Arithmetic package without adding it to the context path:
Using the function Ulp with the context fails:
Properties & Relations (3)
The form Needs["context`""alias`"] modifies $ContextAliases:
The form Needs["context`"] modifies $ContextPath:
Once[Get[package]] is similar to Needs[package]:
Wolfram Research (1988), Needs, Wolfram Language function, https://reference.wolfram.com/language/ref/Needs.html (updated 2021).
Wolfram Language. 1988. "Needs." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Needs.html.
Wolfram Language. (1988). Needs. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Needs.html