Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9592

Re: fyi, small note on using Mathematica for object

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: fyi, small note on using Mathematica for object
Date 2012-04-13 08:51 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jm8pf0$isk$1@smc.vnet.net> (permalink)
References <201204060958.FAA22979@smc.vnet.net>

Show all headers | View raw


Any Head corresponds to a class. Suppose that head is "animal".

animal[any arguments, or no argument at all]

defines an object of that class.

Clear[method]
method[animal[arguments]] = (or :=) "any expression"

defines a method for the class.

That's all there is to it.

Bobby

On Fri, 06 Apr 2012 16:00:03 -0500, Ralph Dratman  
<ralph.dratman@gmail.com> wrote:

> Bobby,
>
> Please explain how you mean this. It is not a technique I have been
> able to find in the Virtual Book or other documentation.
>
> What corresponds to a class, and how does one use a class to create
> one or more object instances? How does one run a method from an
> object?
>
> A brief example would be most helpful.
>
> Thank you.
>
> Ralph
>
>
> On Fri, Apr 6, 2012 at 5:58 AM, DrMajorBob <btreat1@austin.rr.com> wrote:
>> Mathematica is already object-oriented WITHOUT all that. What a lot of
>> overhead for nothing.
>>
>> Bobby
>>
>> On Thu, 05 Apr 2012 04:49:54 -0500, Nasser M. Abbasi <nma@12000.org>  
>> wrote:
>>
>>>
>>> Just FYI,
>>>
>>> I wrote this small note on using Mathematica for object-based
>>> programming. I found that it works really well for me.
>>>
>>> Nothing too advanced, just a simple way of using Module[] but
>>> in a way to emulate object based programming that I did not know
>>> about before.
>>>
>>> http://12000.org/my_notes/object_based_in_mathematica/v1.html
>>>
>>> --Nasser
>>>
>>
>>
>> --
>> DrMajorBob@yahoo.com
>>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: fyi, small note on using Mathematica for object DrMajorBob <btreat1@austin.rr.com> - 2012-04-13 08:51 +0000

csiph-web