Re: If and symbol creation
- To: mathgroup at smc.vnet.net
- Subject: [mg90571] Re: If and symbol creation
- From: Mark Fisher <particlefilter at gmail.com>
- Date: Mon, 14 Jul 2008 05:20:39 -0400 (EDT)
- References: <email@example.com> <firstname.lastname@example.org>
On Jul 8, 7:49 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de> wrote: > Hi, > > use the full context > > If[True, 1, Needs["Calendar`"]; fun = Calendar`DayOfWeek] > > Regards > Jens > > MarkFisherwrote: > > I'd like to use an If statement to conditionally load a package and > > make some assignments, but I'm running into a problem with > > CompoundExpression. Here's an example: > > > (Needs["Calendar`"]; fun = DayOfWeek) > > > This creates DayOfWeek in the Global context before the effect of the > > Needs statement takes effect. The same thing happens in an If > > statement. BTW, DayOfWeek gets put in the Global context even in the > > following: > > > If[True, 1, Needs["Calendar`"]; fun = DayOfWeek] > > > Anyway, do people do to avoid this problem? > > > --Mark Thanks.