Re: Problem with HoldForm & Unevaluated
- To: mathgroup at smc.vnet.net
- Subject: [mg94494] Re: [mg94468] Problem with HoldForm & Unevaluated
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 15 Dec 2008 07:42:19 -0500 (EST)
- Reply-to: hanlonr at cox.net
SetAttributes[printf, HoldFirst] ; printf[fn_] := Print[HoldForm[fn], " = ", fn]; printf[Rationalize /@ {-1.7, 1.39646, -0.37188}] HoldForm[Rationalize /@ {-1.7, 1.39646, -0.37188}] = { -17/10, 69823/50000, -9297/25000} Bob Hanlon ---- Syd Geraghty <sydgeraghty at me.com> 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 -- Bob Hanlon