23. Contexts and Packages:  Homework

Last revision:  April 15, 1998

Author: YourNameGoesHere

Be sure that you complete the problems in this homework assignment in order, and that, upon returning to the notebook, you execute your previously completed cells in order.  Otherwise, the context manipulation may not work properly.

Initializing Names in a Context

Declare "x" and "y" in a new context "Dav`", initializing "x" to be 1 and "y" to be 2.  Check that your code works by asking "?Dav`x" and "?Dav`y".

Another Context

Define "x" and "y" in a new context "Cats`", initializing "x" to be 3 and "y" to be 4.  Check that your code works by asking "?Cats`x" and "?Cats`y".  Check that you haven't damaged the old variables by asking "?Dav`x" and "?Dav`y".

Changing Contexts

Set the default context (using an assignment statement with "$Context") to "Cats`", and find the values of "x" and "y".  Also request the values of "Dav`x" and "Dav`y".  Then set the default context back to "Global`".

Changing Context Search Paths

Set the context search path (using an assignment statement with "$ContextPath") to "{"Dav`", "Cats`", "Global`", "System`"}", and find the values of "x" and "y".