Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*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 2001

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

Search the Archive

Re: displaying unevaluated arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31121] Re: [mg31115] displaying unevaluated arguments
  • From: BobHanlon at aol.com
  • Date: Fri, 12 Oct 2001 03:36:38 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2001/10/10 7:43:47 PM, mcoleman at bondspace.com writes:

>Is there a simple way to create the string form of an argument passed 
>to a function/module? For instance, let
>
>f[x_] := Module[ Some Mathematica Code... .];
>
>Assume that y is defined as a list of numbers. If I evaluate
>
>   f[{y^2,Sin[y],Log[y],Map[Cos[#]&,y]}], 
>
>I would like to get back   "{y^2,Sin[y],Log[y],Map[Cos[#]&,y]}" ,
>rather than the evaluated numerical values. When I create a function, 
>HoldForm does not seem to work. The arguement is always evaluated
>first.
>

SetAttributes[f, HoldFirst];

f[x_] := ToString[HoldForm[x]];

y= 2;

f[{y^2,Sin[y],Log[y],Map[Cos[#]&,y]}]


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: What variables are in a function and displaying surds
  • Next by Date: HELP!!!
  • Previous by thread: displaying unevaluated arguments
  • Next by thread: Re: displaying unevaluated arguments