Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My current understanding about Mathematica is that everything, at the lowest level, ends up as replacement rules.
First question: is this true?
Second question: does Mathematica "gloss over" these rules by representing them as functions? doesn't seem to be expressed as a rule.

Third question: does the by value/by reference question have any when you "pass" a value to a Mathematica function?

share|improve this question
4  
Well, obviously a system based on rules only, would only be able to do endless expression rewritings, but not much more. Even if one can build such a model of computation consistently, this is not what we see in Mathematica. From the user's viewpoint, (many) built-in functions are terminals, because their actions are no longer governed by rules. For example, when Mathematica sees Sin[0.15], it calls the built-in numerical implementation of Sin to make a computation - at which point it arguably leaves the rule-based paradigm. And similarly for most other useful lower-level actions. –  Leonid Shifrin Oct 22 '13 at 1:56
1  
I was tempted to edit your title: "Do rules rule?" But my nose is still bleeding as a result of a limerick. –  belisarius Oct 22 '13 at 2:19
1  
Have a look at DownValues[f] that's where the rules are hiding in this case –  ssch Oct 22 '13 at 2:25
1  
David Wagners book, which is available as a free download here, has a good description of this. –  Mike Honeychurch Oct 22 '13 at 2:56
1  
@GeorgeWolfe Your simple function is a rule. The only top-level (user-defined) functions in Mathematica which are not rules, AFAIK, are pure functions (defined using Function). –  Leonid Shifrin Oct 22 '13 at 2:56
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.