Re: Mathematica daily WTF (programming everything
- To: mathgroup at smc.vnet.net
- Subject: [mg115234] Re: Mathematica daily WTF (programming everything
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 4 Jan 2011 18:50:34 -0500 (EST)
Real-world systems (and simulations thereof) are usually like your example, full of side-effects captured in databases. Bobby On Tue, 04 Jan 2011 03:24:26 -0600, Richard Fateman <fateman at cs.berkeley.edu> wrote: > On 1/3/2011 12:57 AM, Andrzej Kozlowski wrote: >> In any case, I cannot think of any scientific or mathematical problems >> that > can be more naturally formulated in terms of "side-effects" than in > terms > of "functions". Perhaps they exist and I my bias is due to several > decades > of doing mathematics but I seriously can't think of a single example. > Can you provide one? >> > > Surely this argument has been expressed by proponents of purely > functional programming languages, for which they have provided > mechanisms to get over the difficulties. > > OK, here is a problem: > simulate a stock market, where you have 1000 stocks with prices. > Every time step your program surveys 100,000 traders who wish > to buy or sell some number of shares of one of the stocks at > some price. When you find a match, namely compatible sell/buy > price and compatible number of shares, update the ownership of > the 100,000 traders to reflect the transaction. Do this forever, > periodically taking a snapshot/ backup of the situation, and > logging all transactions as they occur. > > I think AES had other examples in mind, simulating dynamical systems > or something. > > -- DrMajorBob at yahoo.com