dynamic string names



Is it what you want?

f(list_1, list_2):= plot2d([[discrete,list_1],[discrete,list_2]],
                        [gnuplot_curve_titles,[sconcat("title ",nounify(list_1)),
                          sconcat("title ",nounify(list_2))]]);

Laurent.

> -----Message d'origine-----
> De : maxima-admin at math.utexas.edu 
> [mailto:maxima-admin at math.utexas.edu] De la part de sen1 at math.msu.edu
> Envoy? : lundi 14 ao?t 2006 15:45
> ? : Mario Rodriguez
> Cc : maxima at math.utexas.edu
> Objet : Re: [Maxima] dynamic string names
> 
> 
> Hi,
>   Thanks for the answers.  But, I was not clear on what I really want
>   to do.
> 
> I want to dynamically give titles to plots.
> 
> So, if we have two lists, called, list_1, list_2, I want to 
> be able to 
> write a function 
> f(list1, list2) which will do the following.
> 
> f(list1, list2):= plot2d([[discrete,list_1],[discrete,list_2]],
>                        [gnuplot_curve_titles,["title 'list_1' ",
>                          "title 'list_2'"]]);
> 
> so that if I enter
>    f(name_1, name_2)
> 
> I get
> 
>   plot2d([[discrete,name_1],[discrete,name_2]],
>                        [gnuplot_curve_titles,["title 'name_1' ",
>                          "title 'name_2'"]]);
> 
> The problem is that I don't see how to dynamically use the 
> quote in a string. Anything I put between two quotes is 
> output literally as it was written.
> 
> In other languages, one has something like \" to have the 
> quote protected in a string.
> 
> TIA,
>   -sen
> 
> 
> 
>   On Mon, 14 Aug 2006, Mario Rodriguez wrote:
> 
> > Hello,
> >
> >> I would like to do something like
> >>
> >> f(q):= " 'q' ";
> >>
> >> then type
> >>
> >> f(p);
> >>
> >> and have it print
> >>
> >> " 'p' "
> >>
> >> instead of
> >>
> >> " 'q' "
> >>
> >> Any ideas will be appreciated.
> >
> >
> > (%i1) f(p):= sconcat(" '", p, "' ")$
> > (%i2) f(torero);
> > (%o2)                              'torero'
> >
> > hth
> >
> >
> 
> -- 
>   
> --------------------------------------------------------------
> -------------
>   | Sheldon E. Newhouse            |    e-mail: 
> sen1 at math.msu.edu           |
>   | Mathematics Department         |       			
> 	   |
>   | Michigan State University      | telephone: 517-355-9684  
>               |
>   | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562  
>               |
>   
> --------------------------------------------------------------
> -------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu 
> http://www.math.utexas.edu/mailman/listinfo/maxima
>