convert/package
convert an expression to a package
Calling Sequence
Parameters
Description
Examples
convert( e, 'package' )
e

expression
An expression $e$ (typically a module) can be converted to a package by using the call convert( e, 'package' ). The resulting package is returned.
If the input expression e is already a package, then it is returned unchanged.
If the input expression e is a module that is not a package, it is converted, in place, to a package and returned. No other expression may be converted to a package.
The main purpose of this conversion is to repair modules that are intended to be packages, but have not been correctly formed because of the omission of the package option.
m := module() export addSquares; addSquares:= proc(a,b) description "finds the sum of the squares of a and b"; a^2+b^2 end proc end module:
$\mathrm{addSquares}\left(2\,3\right)$
${\mathrm{addSquares}}{}\left({2}{\,}{3}\right)$
$m:\mathrm{addSquares}\left(2\,3\right)$
${13}$
$\mathrm{with}\left(m\right)$
Warning, m is not a correctly formed package  option `package' is missing
[addSquares]
$\mathrm{type}\left(m\,'\mathrm{package}'\right)$
${\mathrm{false}}$
$\mathrm{convert}\left(m\,'\mathrm{package}'\right)\:$
${\mathrm{true}}$
$\mathrm{with}\left(m\right)\;$$\mathrm{addSquares}\left(2\,3\right)$
$\left[{\mathrm{addSquares}}\right]$
See Also
module/package
type/package
with
Download Help Document
What kind of issue would you like to report? (Optional)