MathGroup Archive 2009

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

Search the Archive

How do I DistributeDefinitions inside a function?

  • To: mathgroup at
  • Subject: [mg97789] How do I DistributeDefinitions inside a function?
  • From: at
  • Date: Sat, 21 Mar 2009 05:20:47 -0500 (EST)


I have the following function:

LeaveOneOut[f_, items_] :=
   f[#1, items[[Complement[Table[i, {i, Length[items]}], #2]]]] &,

Which might be called as follows:

a = 10 Table[i, {i, 10}];
f[x_, items_] := Mean[items] + x;
DistributeDefinitions[a, f];
LeaveOneOut[f, a]

Notice that I need to explicitly call DistributeDefinitions. I would
like to modify LeaveOneOut such that it performs the
DistributeDefinitions call. I've tried a few things=97such as using
(Distribute....; Parallelize...) and Module[{}, Distribute....;
Parallelize...]=97but the arguments passed to LeaveOneOut don't seem to
be being distributed (old definitions are used instead). I'm a
relative Mathematica novice, so help=97and an explanation of why what I
have already tried doesn't work=97would very much be appreciated!



  • Prev by Date: Re: Incompatible units?
  • Next by Date: DirectSum (feature request)
  • Previous by thread: Re: Commutators with boson operators
  • Next by thread: Re: How do I DistributeDefinitions inside a function?