Tagged Questions
3
votes
1answer
111 views
Downvalues vs. Scoping for Functions
Regarding my recent question on using a default value for a function argument when a pattern was not met yielded some interesting answers, but the general consensus was "Yes this can be done, but ...
3
votes
2answers
108 views
Get DownValues that do not involve patterns?
Say I have a function with a few definitions that also implements memoization:
f[x_] := f[x] = x^2
f[x_, y_] := f[x, y] = x^2 + y^2
I then apply the function to ...
21
votes
0answers
296 views
How is pattern specificity decided?
Mathematica has a notion of pattern specificity, which is a partial ordering on patterns.
The rules (e.g. DownValues, ...
9
votes
1answer
150 views
Selectively clear DownValues
How can I clear a subset of a symbol's DownValues ?
For example, suppose I have created some DownValues for $f$ like this:
...
14
votes
5answers
761 views
The difference between 0. and 0
I have a function for which 0 is a special case:
f[A___, 0, B___] := 0
But since I am doing numerics, sometimes in the course ...