RosettaCodeData/Task/Respond-to-an-unknown-method-call/Mathematica/respond-to-an-unknown-method-call.math
2015-11-18 06:14:39 +00:00

6 lines
155 B
Text

obj[foo] = "This is foo.";
obj[bar] = "This is bar.";
obj[f_Symbol] := "What is " <> SymbolName[f] <> "?";
Print[obj@foo];
Print[obj@bar];
Print[obj@baz];