Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: [TS 19859]--Re:creating code that writes other code ...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68555] Re: [TS 19859]--Re:creating code that writes other code ...
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Wed, 9 Aug 2006 04:20:35 -0400 (EDT)
  • References: <200608080500.k78500aJ031888@localhost.localdomain>
  • Sender: owner-wri-mathgroup at wolfram.com

I am not sure that I would want to write the definition to the present
working directory. However, perhaps I should write it to
$UserBaseDirectory/Applications/$Input (since $Input only becomes a
*relative* path [the context] if Get is executed on a context).
Perhaps it is good to be forced to decide between writing to the user
directories or writing to the installation directories.

On Tue, 8 Aug 2006 05:00:00 UT, mathgroup <mathgroup at smc.vnet.net> wrote:
>  -- Wolfram Research Technical Support --
>
> This is a response to your email.
> The reply to your question can be found at the bottom of this message.
> Our classification number for this message is: [TS 19859]
> Please give this number in any future correspondence
> related to this question. If you leave this number in
> the Subject: [mg68555] header in the form [TS 19859], it will
> automatically be reassigned to the original technician.
>
> From: "Chris Chiasson" <chris at chiasson.name>
To: mathgroup at smc.vnet.net
> Date: Fri, 4 Aug 2006 11:41:27 -0500
> Subject: [mg68555] creating code that writes other code ...
> To: mathgroup <mathgroup at smc.vnet.net>,"support at wolfram.com" <support at wolfram.com>
>
> L3079-4978
>
> In building a package, I need to have some code, "generate.m", that is
> able to (expensively) generate a function definition and put it in a
> file, "target.m". When loading normally, my "Package.m" file should
> just use the stored definition from the "target.m" file. When I want
> to re-derive "target.m", "Package.m" should execute "generate.m". I am
> sure WRI already has an internal system for this or something similar,
> but I don't know what that system looks like.
>
> I have also already come up with a system for doing this, but it
> requires Wolfram Workbench (which conveniently sets $Path[[1]] to the
> current Project's directory). I would like to avoid that requirement.
>
> The idea is that a person could do
>
> Package`expensiveCalculation=True
> <<Package`
>
> to recalculate the polynomial on loading or just
>
> <<Package`
>
> to use the stored definition in "target.m".
>
> The problem that I am running into is that Get *does not* change
> $Input to the *full path* of the input file if Get's argument is a
> context. Furthermore, Get searches $Path, so finding the exact copy of
> the Package.m that is being executed could be a pain (or impossible if
> the user has changed the name of the .m file and/or its directory).
>
> So, how may this task be done?
>
> --
> http://chris.chiasson.name/
>
>
>
>
>
>
> ----------------------------------------------------------------------------
>
> Hello Chris,
>
> Thank you for the email. Perhaps DumpSave could do the trick. Using
> DumpSave export the file to the Directory you are working in and use Get
> using the Path option.
> Get[name, Path->{"a", "a", ? }]
> Note that you could Append to the $Path variable, using
>
> $Path=AppendTo[$Path, "dir"]
>
> Please let me know if this works out for you, or if I have missed some part
> of your question.
>
> Sincerely,
>
> Pratik Desai
> Technical Support
> Wolfram Research, Inc.
> support at wolfram.com
>
>
> ----------------------------------------------------------------------------
>
> If this issue is resolved, please consider taking a few minutes
> to give us some feedback on your experience. Please visit
> http://support.wolfram.com/survey/?trackingnumber=19859
> and give your honest answers to these three short questions.
> Thanks for taking the time to help us improve.
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: Newbie question about column sums of arrays
  • Next by Date: Re: Newbie question about column sums of arrays
  • Previous by thread: Re: How do I create a parametric expression?
  • Next by thread: SImple Plot3D issue