1. Getting rid of Control M's generated when Programs output advisory to emacs command shell
2. Set::setps error? Twitter.m's OOP-like approach?
ou might try with this "overloading" approach:
{NAME, BALANCE} = Range[2];
ClearAll[Account, create, getName, getBalance, deposit];
Account /: (f_[p___, Account[t_, n_], m___] /;
MemberQ[{Plus, Subtract, Times, Divide, Power}, f]) :=
Account[t, f[p, n, m]];
create[name_, balance_] := Account[name, balance];
getName[account_Account] := account[[NAME]];
getBalance[account_Account] := account[[BALANCE]];
deposit[account_Account, amount_] := account = account + amount;
This is the resulting behavior:
In[8]:= a=create["test",Random[Integer,{0,200}]]
Out[8]= Account(test,176)
In[9]:= getBalance[a]
Out[9]= 176
In[10]:= b=a+10
Out[10]= Account(test,186)
In[11]:= b=a 10
Out[11]= Account(test,1760)
In[12]:= b=10a
Out[12]= Account(test,1760)
In[13]:= b=a/10
Out[13]= Account(test,88/5)
In[14]:= b=10/a
Out[14]= Account(test,5/88)
In[15]:= b=a^2
Out[15]= Account(test,30976)
In[16]:= deposit[a,25]
Out[16]= Account(test,201)
In[17]:= deposit[b,25]
Out[17]= Account(test,31001)
In[18]:= a
Out[18]= Account(test,201)
In[19]:= b
Out[19]= Account(test,31001)
ADL
On Nov 3, 8:58 am, Erik Max Francis < XXXX@XXXXX.COM > wrote:
tica/
a
t
3. Getting rid of Control M's generated when Programs output advisory to emacs command shell
4. whats up with the Pentium M's
5. Repost: Jeff M's SBS 2003 Migration Process
6. ssh with -t outputs additional ^m's
7. Can i find all my m's file required function and save them is a folder
8. M's JSON parser v1.2 released
9. M's Lemma: For all primes p let 6=283
11. Set::setps error? Twitter.m's OOP-like approach?
13. Jeff M's SBS 2003 Migration process
14. Fetch data on ClientDataSet Master-Detail relation
15. Master-detail relation with TIBClientDataset ?