Misprint in the Documentation?
- To: mathgroup at smc.vnet.net
- Subject: [mg116591] Misprint in the Documentation?
- From: Alexey <lehin.p at gmail.com>
- Date: Mon, 21 Feb 2011 04:20:30 -0500 (EST)
Hello,
On the Documentation page ref/Condition under "More information" field
we read: "lhs:=Module[{vars},rhs/;test] allows local variables to be
shared between test and rhs. You can use the same construction with
Block and With. =BB". The hyperlink at the end of the citation directs
at the example for Module:
In[1]:= f[x_] := Module[{u}, u^2 /; ((u = x - 1) > 0)]
In[2]:= f[0]
Out[2]= f[0]
In[3]:= f[6]
Out[3]= 25
This method in this example also works with Block:
In[1]:= f[x_] := Block[{u}, u^2 /; ((u = x - 1) > 0)]
In[2]:= f[0]
Out[2]= f[0]
In[3]:= f[6]
Out[3]= 25
But it is seemed to be irrelevant to With:
In[1]:= f[x_]:=With[{u},u^2/;((u=x-1)>0)]
In[2]:= f[0]
During evaluation of In[2]:= With::lvws: Variable u$ in local variable
specification {u$} requires a value. >>
Out[2]= With[{u$},RuleCondition[$ConditionHold[$ConditionHold[u$^2]],(u
$=0-1)>0]]
Is it misprint or I loose something?