MathGroup Archive 2000

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

Search the Archive

Re: Needs[] and <<

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

Murray Eisenberg <murray at> 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:


where the "alternative":


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


  • 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 <<