Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1919
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!news.mv.net!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | DrMajorBob <btreat1@austin.rr.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: HoldAll/HoldRest |
| Date | Sat, 30 Apr 2011 09:51:14 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <ipgm2i$8oh$1@smc.vnet.net> (permalink) |
| Lines | 61 |
| NNTP-Posting-Date | 30 Apr 2011 08:51:59 GMT |
| NNTP-Posting-Host | b9b93cc9.news.twtelecom.net |
| X-Trace | DXC=Sg[?:ieblcbE0G1fKX\WG`C_A=>8kQj6m;[h;PUXBgbdVonPDX8c=AmEFiONJ7[Gof:F?G=T7oFoh |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:1919 |
Show key headers only | View raw
No evaluation takes place in the expression 5, so: x = 5; ValueQ[x] ValueQ[5] True False We could also do this: ClearAll[valueQ, x] valueQ[x_?NumericQ] = True; valueQ[x_] := If[ValueQ@x, x, False, False] x = 5; valueQ@x valueQ@5 True True But I can't tell whether that's really what you want, or not. Bobby On Fri, 29 Apr 2011 06:33:59 -0500, Scot T. Martin <smartin@seas.harvard.edu> wrote: > Some kind of issue going on here between the interactions of HoldAll of > ValueQ[...] and HoldRest of If[...]. Anyone know the solution so that > Out[3] results in True? > = > = > In[1]:= valueQ = If[ValueQ[#], #, False] & > = > > = > Out[1]= If[ValueQ[#1], #1, False] & > = > > = > In[2]:= x = 5 > = > > = > Out[2]= 5 > = > > = > In[3]:= valueQ[5] > = > > = > Out[3]= False -- DrMajorBob@yahoo.com
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: HoldAll/HoldRest DrMajorBob <btreat1@austin.rr.com> - 2011-04-30 09:51 +0000
csiph-web