This isn't actual software, it was just me looking at a pile of
Beancount / Ledger files I've made over the years and thinking,
"what if this was just a DSL on top of Guile?"

And then I also thought: "what if instead of making a custom DSL,
we just used Wisp?"

Here's I think how you might write an entry:


* 2020 03 30 "Starting balance"
  Assets:Retirement:IRA               : USD 1321 84
  Equity:OpeningBalance

Which would translate to:

(* 2020 03 30 "Starting balance"
   (Assets:Retirement:IRA  (USD 1321 84))
   (Equity:OpeningBalance))


If we wanted to make it look like Ledger/Beancount, it would look more
like:

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

Actually, that's both valid Wisp and Beancount!  You could parse this
as:

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


Except... IEEE floating point numbers aren't great for financial things,
so hence me thinking maybe you'd separate them (even though it looks
very yucky).  And I thought it would be nicer if the first thing was the
constructor, and I figured I might make the dates separate fields, but
you could switch most of these out in post-processing (with some risks
over the floating point stuff... notably risks Ledger also takes,
infamously).

Here's another example of Beancount syntax for asserting a balance:

  2020-01-03 balance Assets:Banking:Checking   7337.43 USD 

Yeah anyway you could read that in Wisp too.

As for special fields, eg check numbers, keywords could work:


* 2020 01 03 "Tangled Woodworking" ""
  #:check 1835
  #:invoice 2853
  Assets:Banking:Checking  : USD -4075.00
  Expenses:House:RepairsImprovements
  
(* 2020 01 03 "Tangled Woodworking" ""
   (#:check 1835)
   (#:invoice 2853)
   (Assets:Banking:Checking (USD -4075.00))
   (Expenses:House:RepairsImprovements))


or


* 2020 01 03 "Tangled Woodworking" ""
  . #:check 1835
  . #:invoice 2853
  Assets:Banking:Checking  : USD -4075.00
  Expenses:House:RepairsImprovements
  
(* 2020 01 03 "Tangled Woodworking" ""
   #:check 1835
   #:invoice 2853
   (Assets:Banking:Checking (USD -4075.00))
   (Expenses:House:RepairsImprovements))


Those dots wouldn't be needed if Arne hadn't reversed agreeing with me
that keywords should always be part of a previous expression without
needing that dot foo ;)

Anyway.  Just a thought.  I haven't written software for this.  I have
thought it could be nice to do my finances at the REPL though. :P
Feel free to steal this idea, or not...

 - Christine

Reply via email to