Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
14
votes
How can one define a custom data object?
As Michael Pilat explained here it is more robust to use MakeBoxes, rather than Format.
Using MakeBoxes:
MakeBoxes[diag[m_?MatrixQ], _] ^:=
InterpretationBox[RowBox[{"diag", "[", #, ",", #2, "]"} …
8
votes
Accepted
Longest and Shortest won't work in ReplaceList?
To me this is an interesting problem, however I think the question is a misguided one.
Briefly: Longest and Shortest only change the order in which an expression is searched for a match. They are not …
5
votes
Opposite of Alternatives
Usually one does not need what you ask for. E.g. a pattern for an even integer greater than 10:
x_Integer?EvenQ /; x > 10
(_Integer is not strictly necessary here as only integers will pass EvenQ …
11
votes
Accepted
Permanently extending the behaviour of functions (like decorators)
Based on your requirements I would move the original symbol to a new context.
wrapper[fn_, mod_] :=
Module[{ctxt = Context[fn], name = SymbolName[fn], x},
Context[fn] = "wrapper`" <> ctxt <> To …
93
votes
What does the construct f[x_] := f[x] = ... mean?
Memoization is perhaps the most common application, but it is not the meaning of that construct.
More generally it is a construct for a function that redefines itself. This has many uses beyond memo …
4
votes
Accepted
Implement settable properties
Well that's a hairy one. I like it though, as it forced me to think about aspects of evaluation that I am normally oblivious to. Unfortunately that thinking didn't lead to any great insights. My on …