MathGroup Archive 2000

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

Search the Archive

Re: Needs[] and <<

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23107] Re: Needs[] and <<
  • From: Gavin Scott <gscott at netcom.com>
  • Date: Wed, 19 Apr 2000 02:30:41 -0400 (EDT)
  • Organization: MindSpring Enterprises
  • References: <8d3qq8$odh@smc.vnet.net> <8d96df$igt@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Murray Eisenberg <murray at math.umass.edu> wrote:
: << is a special input form for Get.

: <<name reads in a file, evaluating each expression in it, and returning
: the last one. 

: Needs["context`", "file"] loads file if the specified context is not
: already in $Packages. 

: But you probably knew that difference.  As to reasons The Book uses the
: first rather than the second, I can only speculate.  Shorter to type,
: for one; does no harm (except for some wasted time), for another.

In some cases you not only want the package loaded, but you want to 
be sure that you get the side effects of the evaluation of the expressions
in the package.  The most obvious case would be something like:

<<RealTime3D`

where the "alternative":

Needs["RealTime3D`"]

would only work the first time it was evaluated for a given kernel instance.

G.


  • Prev by Date: Re: NestWhile
  • Next by Date: A 3D-list-plot problem
  • Previous by thread: Re: Needs[] and <<
  • Next by thread: Re: Needs[] and <<