Christine Lemmer-Webber <cweb...@dustycloud.org> writes:

> 2020-03-30 * "Starting balance"
>   Assets:Retirement:IRA                1321.84 USD 
>   Equity:OpeningBalance

I wondered whether we could make this executable as it is, but for that
we’d have to create one procedure for every date.

Since accounts have to be declared with something like

account ArneBab:Assets:Autorenhonorar:epubli

creating a proc per account would actually give us some compile-time
validation.

import : ice-9 optargs


define USD 'USD
define-syntax-rule (account name)
  define* (name #:optional value currency)
    list (quote name) value currency
define (entry description
        account-name1 value1 currency1
        account-name2 value2 currency2)
  ;; do something useful
  . description


define-syntax date
  λ : x
    syntax-case x : *
      : _ * description account1 account2
        #' apply entry : cons description : append account1 account2


define-syntax-rule : 2020-03-30 args ...
  date args ...


;; Missing piece: Running
;; define-syntax-rule (the-date args ...) (date args ...)
;; for each possible date.



And actually implementing some state tracking …

This already works (but only returns "Starting balance"):


account Assets:Retirement:IRA
account Equity:OpeningBalance
2020-03-30 * "Starting balance"
  Assets:Retirement:IRA                1321.84 USD 
  Equity:OpeningBalance


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

Attachment: signature.asc
Description: PGP signature

Reply via email to