Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Rule replacement weird behavior' topicStudent Support Forum > General > "Rule replacement weird behavior"

Next Comment >Help | Reply To Topic
Author Comment/Response
Nicolas
04/07/13 07:33am

Hey there, I'm quite new to Mathematica and while playing with it, I encountered a behavior I can't explain by myself, would someone give me an explanation for this ?

In[705]:=
ClearAll[test5]
test5[x_, y_] :=
(x /. h_ :> h/2) :> y
test5[2, 3]

Out[707]=
h/2 :> 3

In[702]:=
ClearAll[test5]
test5[x_, y_] :=
(x /. h_ :> h/2) :> 54
test5[2, 3]

Out[704]=
1 :> 54

In the first exemple, why 'h' isn't replaced by '2' ?

Thanks for the time spent answering me.

Nicolas.

URL: ,

Subject (listing for 'Rule replacement weird behavior')
Author Date Posted
Rule replacement weird behavior Nicolas 04/07/13 07:33am
Re: Rule replacement weird behavior Bill Simpson 04/07/13 4:46pm
Next Comment >Help | Reply To Topic