How do i create a library with the assistant

Hello, i'm in need of some help.
I'm searching how to use the library browser to create a module usable with with().
In fact i have to learn how to add or remove function to an existing library.
And when i use the assistant, i see int the window a module and when i double click on the module i enter in it and i can see the fonction inside it. But when i add some functions in .m files the assistant add them in the root and not in the module. To express it clearly watch the figure

Module And i want Module
| |
| --- function1 |---function 1
|---function 2

and with the assistant i obtain

function 2
Module
|
|---function1

But if you can help me just to show me how to create a module usable with with from nothig it would be very helpfull too.
Thanks a lot

modules and libraries

If I understand correctly, there isn't a way to do what you want. That is, given an existing module there is no straightforward way to add an export to that module. Even modifying an export of a module isn't generally possible (there are some hackish ways, but they have limits). This is a drawback of the modular approach compared to the old table-based package approach used in Maple R5—while the modular approach is more robust and better from the programmar's (creator's) viewpoint, it is less malleable for the user.

It is, of course, possible to add a new module to an existing archive, though usually it is better to just create a new archive and insert it in the libname path. Use LibraryTools[Save]. To make a module ``withable,'' give it the package option. For example:

mymodule := module()
export A,B:
option package;
  A := proc() ... end proc:
  B := proc() ... end proc:
end module:
LibraryTools:-Save(mymodule,"mylib.mla"):
JacquesC's picture

module design

This is not a drawback, it is an explicit design decision. Modules are supposed to be 'static' objects, not 'dynamic' like tables. This means that, for example, member extraction can be optimized.

It is rare that you really want a package to change under dynamic control. And if you really want that, then you still have tables. So modules were designed to cover the most common situation in a more robust manner. In some ways, it is a bit different than other pieces of Maple design, which tend to emphasize utmost dynamic flexibility. But all that flexibility does come at a cost, so it is useful to have other features that are more idiot-proof.

dynamic

It isn't dynamic control, per se, that is the issue, but rather the ability of a skilled user to extend and/or modify an existing package but without the source code. Previously that could be done. Now it isn't practical or even possible. I doubt that the loss is significant and am confident that it is outweighed by the increased robustness of the modular approach, however, there have been times when I wished I could tweak an existing procedure or add an export to an existing package. With the old (and ugly) table-based packages that could be done.

JacquesC's picture

It can still be done, to a certain extent

Producing a new module that is a modification of the old one is relatively straightforward. Then you might be able to rebind the name -- though, like with procedures, that is not failsafe. I know I have used ToInert/FromInert to fiddle around with modules before. Fiddling around with module members of an anonymous module, well that does seem to be impossible (or more exactly, current tools do not let one do that; it's a fun way to crash maple).

acer's picture

fun competition

Fewest keystrokes to crash Maple 11 in TTY interface?

I guess that I mean bus-error/seg-fault/stack-limit-exceeded/lost-kernel-connection as opposed to runaway in CPU cycles or memory limit exceeded.

acer

JacquesC's picture

Oh, that sounds like fun!

Why don't you make a blog posting of it, which will be a better place to store that information that in this thread. I would rather like to see how many keystrokes it takes to crash the kernel, as you describe.

You should set the rules of the game -- what counts. For example, do the ; and <return> count? Maybe they do, since the bug might be in the command-line editing features!

ok thank you very much

ok thank you very much

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}