Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

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: <g4v2ve$iej$1@smc.vnet.net> <g4vk8o$9qi$1@smc.vnet.net>

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.


  • Prev by Date: Mathematica kernel color printing (Linux)
  • Next by Date: Re: How to do a negative pattern?
  • Previous by thread: Re: If and symbol creation
  • Next by thread: How to make variable have package scope but not global scope.