Fork me on GitHub
#off-topic
<
2023-02-19
>
Benjamin07:02:15

I'm not sure why but suddenly something in my mind clicked and I see :<- as a sad fish now

😆 13
Benjamin07:02:42

In reference to some clojure talk about re-frame

Amit Gold09:02:53

i dont see it

4
😆 2
thom09:02:24

If you ever want to complete the rest of the zoo, the Haskell Lens operators should suffice: https://hackage.haskell.org/package/lens-5.2/docs/Control-Lens-Operators.html

respatialized17:02:04

https://www.val.town/ val.town looks like an interesting tool that helps glue together all of those little (Typescript) scripts that either awkwardly share a big monorepo or fight for catchy individual project names with one another. Seems to blend aspects of http://glitch.com , github gists, and heroku in a useful way. The namespacing aspect in particular makes me think a similar project for Clojure(script) might be useful.

respatialized17:02:49

or, if you can use regular JS, perhaps ClojureScript support could be bootstrapped on top of it?

wcalderipe19:02:12

I’m playing with the personal financial data I’ve been pulling from https://app.youneedabudget.com/ while building a double-entry bookkeeping application to learn the domain. However, I’m struggling with some simple concepts and would love some insights. Let’s say I went out to have lunch at Acme restaurant with my partner and paid the whole bill of $100 to make things easier. We often split bills 50/50. Following the double-entry bookkeeping, that would be something between the following lines: • Credit: Cash (assets) account $100 • Debit: Eating Out (expenses) account $50 • Debit: Reimbursements (income) account $50 I have two questions: 1. Is that model right? 🙈 2. What’s the best place to store the name of the merchant/payee in this situation?

jkrasnay20:02:16

That doesn’t sound quite right. You have $150 in credits and only $50 in debits. Total credits and total debits should be equal for each transaction.

👌 1
jkrasnay20:02:39

Credit cash for $100 sounds right. Cash is an asset account, so credit here means you’re reducing the asset by $100.

jkrasnay20:02:29

For the other two it depends on what you’re trying to track. If you’re expecting your partner to later reimburse you their $50 share, then the third entry should be a debut of $50 of accounts receivable (AR). AR is also an asset account, so a debit here is an increase in the amount you expect to receive.

plus_one 1
jkrasnay20:02:29

When your partner pays you back, you would add a transaction to debit cash $50 (your cash increased) and credit AR $50 (the amount you expect to receive decreased)

wcalderipe20:02:22

Thanks a lot for clarifying it. I didn't know the concept of ARs before. I'll definitely look into it.

wcalderipe20:02:33

How would you store the payee of that transaction? I'm kinda losing information about the transaction, meaning if it doesn't have the Acme restaurant name on it, right? I'm struggling with this right now, and I'm starting to feel that my struggle maybe means I'm trying to force something into a model that isn't for it.

jkrasnay20:02:53

Ultimately it depends on what you want to track. A single expense account for “Expenses” is usually too coarse-grained. You may instead choose a sub-account to track “Entertainment Expenses” or something, so that you can keep them separate from other kinds of expenses.

jkrasnay20:02:44

If you ate at Moe’s a lot and you wanted to track how much you spent specifically at Moe’s you could create a sub-account just for that.

jkrasnay20:02:42

Typically, though, that level of detail would just be on the description for the original transaction, e.g. “Lunch with Pat at Moe’s”

wcalderipe20:02:53

Ok.. I think I got it. If I had an account to track expenses at Moe's, I would end up with something like the following, right? • Credit: Cash (assets) account $100 • Debit: Moe's (expenses) account $50 • Debit: Reimbursements (AR) account $50

wcalderipe20:02:07

> Ultimately it depends on what you want to track. I want to 1) push this information to other report applications that I don't know yet what data they will require and 2) start playing with report generation on my side. I felt that double-entry bookkeeping would enforce me to have most of the information but I may be wrong here since I don't know the domain.

wcalderipe20:02:03

Does it make sense from an accounting point of view to store the payee in the transaction itself, or should it be within the posting? I feel that storing it in the memo will complicate my life in creating reports later. Credit: Cash (assets) account $100 Debit: Eating Out (expenses) account $50 Debit: Reimbursements (AR) account $50 Payee: Moe's

jkrasnay20:02:40

I don’t think there’s one “right” way to do it. There’s nothing wrong with a “Moe’s” expense account, other than that you might end up with hundreds of such accounts. Or you could, as you suggest, have a separate Payee table and link to that (although I would probably link it to the expense entry rather than to the transaction as a whole). Both approaches would be legitimate double-entry accounting.

👌 1
wcalderipe21:02:22

So, to validate, that would be: • Credit: Cash (assets) account $100 • Debit: Eating Out (expenses) account $50 / payee Moe's • Debit: Reimbursements (AR) account $50 / payee Moe's

jkrasnay21:02:20

That sounds reasonable. The AR entry is between you and your partner so it’s not clear why you would link that to Moe’s, but it’s not “wrong” if you have a use for it.

wcalderipe21:02:51

Because both postings sum the total spent on Moe's. That was my rationale. Otherwise, I would have to add the payee on the credit posting. But that feels weird as well.

jkrasnay22:02:04

It sounds like you’re trying to get the double-entry effect for payee as well, but the structure you describe doesn’t do that. The trick of double-entry accounting is that the debits and credits for each transaction sum to zero, so you can’t forget to post the AR entry, for example. The way you’re linking to payee doesn’t preserve that property. If you forget to link the AR to Moe’s, the transaction still balances.

jkrasnay22:02:49

If your objective is to explicitly track how much you’ve spent on Moe’s, it sounds to me that you just want a Moe’s expense sub-account.

skylize05:02:40

> Debit: Reimbursements (AR) account $50 / payee Moe's > I agree that this seems quite odd. The AR debit is a record that your partner owes you money. Moe's has already received their cash. Now you have a receivable of $50 from Judy.

pithyless15:02:43

@UHD67JRL4 if you're not familiar with ledger, beancount, et al. I highly recommend checking them out. Plain text accounting applications have a simple way of representing double-entry bookkeeping and their docs related to accounting and application usage will probably help (both in understanding how to model your real-world transactions and also how to potentially model the domain in code). https://plaintextaccounting.org/#accounting

wcalderipe16:02:24

Thanks a lot, @U05476190 You're right. I have many articles from Beancount bookmarked. They're great (especially this https://beancount.github.io/docs/the_double_entry_counting_method.html about the basics of double-entry accounting). Sometimes, even going through them, I still need clarification about how to solve some problems: like the payee example shared here. I was looking at Fava (UI for Beancount early today). They seem to store the payee at the transaction level. See a transaction example https://fava.pythonanywhere.com/example-beancount-file/journal/?filter=payee%3A%22%5ECafe+Modagor%24%22+payee%3A%22%5ECafe+Modagor%24%22#context-0187b90b6513a827454fc62185682e2b. It's great to have some visuals when exploring a new concept.

pithyless16:02:02

I explored the PTA landscape a little (as an ex-YNAB user) and remember among others reading this article that may be relevant to your OP: https://beancount.github.io/docs/sharing_expenses_with_beancount.html

pithyless16:02:10

ah, you linked to the same doc. Oops :)

skylize19:02:11

Using the system described by that beancount article, any cash accounts are shared assets. Personal names are attached only as a reference to ease tracking investments from the primary investor of a particular cash account. At some later date, you transfer to/from personal income accounts to clear out the balances owed by/to individual investors. So something like this for your original question: --- • Fund William's cash account -Assets:Cash:William $100 -Income:Cash:William -($100) • Dinner at Acme restaurant -Assets:Cash:William -($100) -Expenses:Food $100 (note: Judy funds her $50 under-investment into your cash account, which can then be used to pay back your over-investment into that shared cash asset account.) • Clear personal balances -Assets:Cash:William $50 -Income:Judy -($50) -Assets:Cash:William -($50) -Income:Cash:William $50 --- That article also tracked credit cards separately from actual cash, which would complicate this further (since you probably used a CC to pay for a $100 dinner). But this cash-only example shows the basic idea.

borkdude19:02:05

I have some tests which test babashka error message output but it seems some stuff has changed in jdk11 -> jdk17+. e.g. I now get Cannot invoke \"String.substring(int)\" because \"s\" is null" while before I just got java.lang.NullPointerException Is anyone aware if this can be influenced by some jdk setting or so? It's a bit annoying having to maintain different tests for different jdk versions

borkdude19:02:48

I see.. helpful nullpointer exceptions... https://hg.openjdk.org/jdk/jdk/rev/e3618c902d17

p-himik19:02:31

Maybe a possible alternative would be to add a flag to bb to output the exception in a machine-readable way?

borkdude19:02:54

The test tests a human-readable error report :)

borkdude19:02:03

But maybe I can just choose something that's not based on an NPE

p-himik19:02:56

Mmm, that reminds me of a pixel-by-pixel comparison of UI screenshots during tests... Personally, a huge anti-fan of those. :D IMO you end up testing the underlying low-level functionality more than your own stuff. But maybe it's more reasonable in this case than it sounds to me, dunno.

borkdude19:02:05

The more annoying part is that the native image seems to still have the old error message

borkdude19:02:31

I know what you're talking about but I've detected important regressions before using this test, so it's worth the pain to me

👍 1
borkdude19:02:33

ugh, with a different exception:

(mismatch
  (expected
   "Message:  class clojure.lang.Keyword cannot be cast to class clojure.lang.Associative (clojure.lang.Keyword and clojure.lang.Associative are in unnamed module of loader 'app')")
  (actual
   "Message:  clojure.lang.Keyword cannot be cast to clojure.lang.Associative"))
:)

borkdude20:02:35

some regexes to the rescue...

p-himik20:02:32

And those messages aren't standardized, are they? I.e. they're free to improve or "improve" them how they see fit, "they" being every maintainer of every JDK that you want to be compatible with.

☝️ 1
seancorfield02:02:33

The helpful error messages started as an option in jdk 13 or 14 I think and then became the defaults at some point?

Martynas Maciulevičius09:02:04

> not based on an NPE Does your own RuntimeException give the same output? At least you could match the class then