The tag has no usage guidance.

learn more… | top users | synonyms (1)

4
votes
0answers
44 views

How to set a property in an object with association syntax?

I have a simple object orientation example using this solution: ...
6
votes
1answer
121 views

How does thing[“property”] syntax work?

Many builtin "things" support the (usually undocumented) syntax thing["property"], and usually the available properties can be listed using thing["Properties"] (thing["Methods"] might work too). ...
1
vote
0answers
60 views

Custom Head for Encapsulation

Often when I'm writing a project in Mathematica, the number of arguments I must provide to functions spins out of control. I need a sort of object-oriented encapsulation approach. I've already had a ...
4
votes
3answers
213 views

How to combine Date and Time objects into DateTime object?

Considering a DateObject d and TimeObject t: ...
3
votes
0answers
60 views

how implement OOP [duplicate]

I have a task implement OOP in wolfram mathematica. I think write class Point and inherit from it class Rectangle. In C# or C++ it's very easy, but I don't know how do it in wolfram mathematica. All ...
3
votes
1answer
162 views

Inheritance in Mathematica using pattern matching on UpValues

Edit: I think in my original post, I missed emphasizing the main point. This is mainly a pattern matching question. If you're interested in the 'why' of this question, please read the original post ...
1
vote
1answer
98 views

Experiment with TagSetDelayed involving Part

Reading Associating Definitions With Different Symbols, I was intrigued by this: You can think of upvalues as a way to implement certain aspects of object-oriented programming. A symbol like ...
1
vote
0answers
37 views

How to implement a set method? [duplicate]

I'm trying to program using object orientation in Mathematica. For this i need to implement get and set methods. Lets consider that we are working with a person class, that have the fields name and ...
5
votes
0answers
96 views

Modify NDSolve`StateData (if possible)

I am trying to solve a PDE that needs to be scaled constantly (refer to this). @andre suggests I modify NDSolve`StateData. Now, the problem is, I'm not used to ...
48
votes
2answers
2k views

Once more on object orientation in Mathematica: does it have to be so hard?

Recently I came across a set of problems which would be solved most easily within an object-oriented approach. I first attempted to solve them by other means, but found the complexity of the code ...
3
votes
1answer
331 views

Do “objects” in Mathematica have to be declared?

A while ago I learned a trick which allows one to imitate object-oriented programming in MMA using SubValues: ...
21
votes
2answers
1k views

Code Readability and Object-Oriented Code

The basic problem I have been running into is making readable code, where in other languages I am more familiar with I might have been using class or struct like objects. For example, you can imagine ...
7
votes
1answer
2k views

How can I implement object oriented programming in Mathematica?

Roman Maeder's object oriented programming package is nice, but I'm hoping someone can suggest a sleek and novel implementation that is easy to use.