MathGroup Archive 2011

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

Search the Archive

Misprint in the Documentation?


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?


  • Prev by Date: Chain of packets in MathLink: are packets always strictly ordered?
  • Next by Date: Re: Pattern matching
  • Previous by thread: Re: Chain of packets in MathLink: are packets always strictly ordered?
  • Next by thread: Re: Misprint in the Documentation?