MathGroup Archive 2007

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

Search the Archive

Re: How to make delayed functions from text info

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81155] Re: [mg81117] How to make delayed functions from text info
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Fri, 14 Sep 2007 03:35:27 -0400 (EDT)
  • References: <18610053.1189686202270.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

strings=t1 /. {fname_String, {lower_}, {upper_}, _} :>
   StringJoin[fname, "[b_,t_]:=If[", ToString@lower, "<t<=",
    ToString@upper, ",b,0]"]

{"AA[b_,t_]:=If[15.<t<=19.,b,0]", "AC[b_,t_]:=If[17.<t<=21.,b,0]"}

ToExpression@strings;

Bobby

On Thu, 13 Sep 2007 05:23:26 -0500, P_ter <peter_van_summeren at yahoo.co.uk>  
wrote:

> Hello,
> I have a list like this t1= {{"AA", {15.}, {19.}, 4.}, {"AC", {17.},
> {21.}, 4.}}
> It means: AA[b_,t_]:= If[15<t<=19,b,0] Etc.
> The problem is that I have a few hundred of these elements in a list. 
> But when I do:
> (ToExpression[#[[1]]][b_,t_]:= Evaluate[If[#[[2,1]]< t<=  
> #[[3,1]],b,0]])& /@ t1
> I get out {Null, Null}, although AA and AC exist with ?AA,?AC
> But I want to see these delayed functions in a list:
> lst = {AA[b_,t_]:=If[15.<t<=19.,b,0],AC[b_,t_]:=If[17.<t<=21.,b,0]
> ..}
> I would like to say: lst[[1]] and get this delayed function. Is that  
> possible?
> Also I wonder if ?(AA,AC) could be done, such that I get all the  
> definitions in a row. Any idea?
> with friendly greetings,
> P_ter
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: RE: Problem with FrameTicks and BarLabels
  • Next by Date: Re: FrameTicks lengths
  • Previous by thread: Re: How to make delayed functions from text info
  • Next by thread: Re: How to make delayed functions from text info