* Brainstorming Wisp and Guile for financial bookkeeping
@ 2023-10-02 17:05 Christine Lemmer-Webber
2023-10-04 19:34 ` Dr. Arne Babenhauserheide
0 siblings, 1 reply; 3+ messages in thread
From: Christine Lemmer-Webber @ 2023-10-02 17:05 UTC (permalink / raw)
To: guile-user
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Brainstorming Wisp and Guile for financial bookkeeping
2023-10-02 17:05 Brainstorming Wisp and Guile for financial bookkeeping Christine Lemmer-Webber
@ 2023-10-04 19:34 ` Dr. Arne Babenhauserheide
2023-10-04 22:29 ` Daniel Tornabene
0 siblings, 1 reply; 3+ messages in thread
From: Dr. Arne Babenhauserheide @ 2023-10-04 19:34 UTC (permalink / raw)
To: Christine Lemmer-Webber; +Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]
Christine Lemmer-Webber <cwebber@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Brainstorming Wisp and Guile for financial bookkeeping
2023-10-04 19:34 ` Dr. Arne Babenhauserheide
@ 2023-10-04 22:29 ` Daniel Tornabene
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Tornabene @ 2023-10-04 22:29 UTC (permalink / raw)
To: Dr. Arne Babenhauserheide; +Cc: Christine Lemmer-Webber, guile-user
sub'd!
On Wed, Oct 4, 2023 at 4:47 PM Dr. Arne Babenhauserheide <arne_bab@web.de>
wrote:
>
> Christine Lemmer-Webber <cwebber@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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-04 22:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 17:05 Brainstorming Wisp and Guile for financial bookkeeping Christine Lemmer-Webber
2023-10-04 19:34 ` Dr. Arne Babenhauserheide
2023-10-04 22:29 ` Daniel Tornabene
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).