Re: First shot at lisp mini-app - How to make it lispy and not lisp-c





jonathon wrote:

The original app is in Python with GTK as the interface.  It maintains
a list of accounts and their starting balances.  Transactions are saved
in a list in an object called the TransactionManager (TM).

At reconciliation time, each account queries the TM for transactions
referring to said account.  The amount is extracted from the
transaction, and added to (or subtracted from) the balance.  Simple.

First, in Python, when each account object is created, it receives a
reference to the TransactionManager.  In Lisp, should this just be a
global variable that each account object calls when needed, or should
it be stored in a slot within the account object?  What precedent would
there be for this kind of decision?

I am not sure why the object has to know the TM. The code posting transactions should know that. Sounds like you are trying to make account objects self-sufficient for some reason. Anyway, I would have a slot for TM in the Account class only if I planned to have several TMs, to have Account instances accept transactions from only one TM, and if my logic was going to be regularly posting to multiple accounts managed by different TMs. ie, Hard to imagine.


But this is all OO design, not Lisp vs. Python.


Second, what can I look for that would be an indication of too much like Python or C, where I should try to be more Lisp-ish, such as using macros, closures, etc?


You should consider writing a macro if you find yourself writing repeated patterns of code (boilerplate) which cannot be functions because they wrap variable chunks of code. Note that a closure containing the variable code could be passed to a function instead of using a macro, so a macro just looks a little cleaner.


kt


-- Cells? Cello? Cells-Gtk?: http://www.common-lisp.net/project/cells/ Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film

"Doctor, I wrestled with reality for forty years, and I am happy to state that I finally won out over it." -- Elwood P. Dowd

.



Relevant Pages

  • Re: Newbie question about db normalization theory: redundant keys OK?
    ... fan of persistent message queues. ... If your queue is ... Or if some of the queued transactions can be rolled ... geographically separated databases storing account balances. ...
    (comp.databases.theory)
  • RE: Carry forward balance of account
    ... your database contains hundreds of thousands of transactions. ... CurrentFiscalYear field in my Company table... ... Use the Income and Expense balances to calculate a net profit or loss ... Update the G/L AccumulatedProfitOrLoss account accordingly. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Display queried records with Null values (null recordcount)
    ... tables related to Assets and Transactions tables in the query, ... since AssetID from tblAssets is a foreign ... The query would return multiple rows per account, ...
    (microsoft.public.access.gettingstarted)
  • Re: Design Question - Accounts/Transactions
    ... The indexed view can't return anything about individual transactions. ... reason is that the indexed view contains only one row per account. ... you want an index that will help this query. ... One of the most important thing to get right is the clustered index. ...
    (microsoft.public.sqlserver.programming)
  • Re: T.J. Maxx data theft worse than first reported
    ... No, my intellectually deficient friend, retailers only need store the authorization code they receive from the card issuer". ... with just account number, amount and date. ... http://www.garlic.com/~lynn/2007c.html#15 Securing financial transactions a high priority for 2007 ...
    (bit.listserv.ibm-main)