Re: Problem with HoldForm & Unevaluated
- To: mathgroup at smc.vnet.net
- Subject: [mg94520] Re: Problem with HoldForm & Unevaluated
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 15 Dec 2008 07:47:05 -0500 (EST)
- References: <gi2umq$9vg$1@smc.vnet.net>
Hi, printf[] should have the attribute HoldAll. Regards Jens Syd Geraghty wrote: > Hi all, > > A seemingly simple function has me baffled and I would appreciate a > solution. > > I am trying to define a personal print function that prints > "Unevaluated function string" = Evaluated function! > > I have tried many examples in guide/EvaluationControl documentation > without getting what I want. > > A simple example; > > printf[fn_] := Print[HoldForm[fn], " = ", fn]; > > printf[Rationalize /@ {-1.7, 1.39646, -0.37188}] > > Print[HoldForm[Rationalize /@ {-1.7, 1.39646, -0.37188}], " = ", > Rationalize /@ {-1.7, 1.39646, -0.37188}] > > gives the LHS evaluated: > > {-(17/10),69823/50000,-(9297/25000)} = {-(17/10),69823/50000,- > (9297/25000)} > > Instead of the hoped for output: > > Rationalize/@{-1.7,1.39646,-0.37188} = {-(17/10),69823/50000,- > (9297/25000)} > > Using Unevaluated seemed to me should fix it but does not. > > Thanks in advance for your help. > > Cheers ... Syd > > PS I've tried Mathematica 5.2 as well as 7.0 > > > > Syd Geraghty B.Sc, M.Sc. > > sydgeraghty at mac.com > > Mathematica 7.0.0 for Mac OS X x86 (64 - bit) (21st November, 2008) > MacOS X V 10.5.4 > MacBook Pro 2.33 Ghz Intel Core 2 Duo 2GB RAM > > > > > > > > > >