MathGroup Archive 2008

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

Search the Archive

Re: If and symbol creation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90413] Re: If and symbol creation
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 8 Jul 2008 07:49:09 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <g4v2ve$iej$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

use the full context

If[True, 1, Needs["Calendar`"]; fun = Calendar`DayOfWeek]

Regards
   Jens


Mark Fisher wrote:
> 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
> 
> 


  • Prev by Date: How to find the Max of a Piecewise function
  • Next by Date: PlotRange Trouble
  • Previous by thread: If and symbol creation
  • Next by thread: Re: If and symbol creation