[racket] Datalog suitable for an accounts package?

From: Mark Carter (mcturra2000 at yahoo.co.uk)
Date: Sun Sep 18 07:15:01 EDT 2011

I've been in the process of writing a little financial accounts package in Racket. I'm wondering if, instead of writing a lot of scheme code, a lot of funtionality could be more expressively and concisely be written in Datalog. I've never used Datalog before, nor Prolog, but I know it's something to do with "my father's mother's sister".

I've read the Datalog tutorial, and I wonder if it's worth digging deeper. Although my data is relatively simple, there are all sort of weird and wonderful ways that I want to slice and dice it.

I suppose the first question is: does Datalog support structures? 

Let's say I have a concept called an "equity transaction", or etran. It has the fields sym (symbol), date, tag, qty (quantity) and cost. 

So suppose I bought 100 shares in Apple on Dec 28 2001 at $11.21 (I wish!).The symbol for Apple is "AAPL". How would I express that fact in Datalog (assume that the tag is just some arbitrary symbol for now)?

Or am I completely barking up the wrong tree as to the likely suitability of Datalog to the problem at hand?

Posted on the users mailing list.