> Ok, hopefully third try is a charm after netscape and system crashes...
> 
> Christopher Browne wrote:
> 
> > I've done considerable work over the last week "cleaning up" the
> > various reports, with the notable intent of factoring out common code
> > with a view to moving towards supporting multiple output formats.
> >
> > I've put together some "HTML generator" functions to create cells and
> > rows in a moderately intelligent way.
> 
> Bravo, this is sorely needed!

The slick part is that this shortens the code considerably.

> > But to the point, I'm effectively reverse-engineering some chunks of
> > reports, and having some trouble grasping average-balance.scm.  Some
> > of the functions are *rather* long, notably runavg-options-generator,
> > reduce-split-list, as well as the main function that gets attached to
> > the menu.  I've been factoring out chunks of the functions to try to
> > make it a bit more comprehensible, and having particular difficulty
> > with some functions where it is not clear what the input is supposed
> > to look like.
> 
> Lots of fun, isnt't it? Though I am new to scheme, I must say that I find it
> counterintuitive, inflexible and an absolute headache to debug.

You'll want, for sure, to compare "old" to "new."  Most of the uses of (append 
this that) will be going away, as well as some uses of (map (lambda (x) (stuff 
x) that).

> > Notably, (get-averages indata) is supposed to calculate an average on
> > *something.* I'm not sure what that something is.  I have a feeling I
> > could make most of the function go away, but am not certain how.
> >
> > Matt, can you elaborate a bit on:
> > - get-averages
> > - allsubaccounts
> > - the calculation being performed by reduce-split-list
> >
> 
> Well, allsubaccounts takes a scheme list of accounts
> 
> and returns a big list which includes the original accounts, as well as
> 
> all of their sub-accounts (recursively all of the way down).
> 
> reduce-split-list takes a list of transactions from several accounts and buck
ets them into a set
> 
> of date ranges, with summary data for each.
> 
>     arguments are:
> 
>         dl: a list of date-ranges each having (begindate enddate '() )
> 
>         tl: is a scheme list of transactions from multiple accounts over the 
entire date range
> 
>         pt: is legacy and no longer used, should be removed
> 
>         av: is a structure created using structure.scm which has one entry fo
r each account in the
> 
>              transaction query --it is used for storing the running balances 
between time ranges
> 
>               I since remember seeing somewhere that guile has its own associ
ative mapping classes which
> 
>               would make structure.scm unnecessary...but I haven't gone back 
to change anything.
> 
>     What is returned from reduce-split-list is a list of summaries each of wh
ich is
> 
>     ( begin  end  average-balance  minbalance  maxbalance  net-gain  gain los
s)
> 
>       note that "begin" and "end" are both string representations of dates
> 
> 
> 
>     get-averages just takes the list of summaries returned by reduce-split-li
st and averages each numerical
> 
> "column"
> 
>     Say we have the following list of results
> 
> ( ( "01/01/2000" "01/07/2000"   10  10  0   5  5  0)
> 
>   ( "01/08/2000" "01/14/2000"   12  12  0   5  7  -2))
> 
>  get-averages would return:
> 
>   ( ""             ""            11 11  0   5  6  -1 )
> 
>     Note that get-averages should accept any "list-of-lists" of any length
> 
> (as long as the sub-list lenght is consistent) and average the elements.
> 
> With my limited scheme know-how, this is what I was able to do.
> 
> If there are more efficient/elegant/effective approaches, please bring them o
n in !!!
> 
> Thats all for now. Please let me know if you need more.
> 
> I would certainly agree that we need to centralize the report generation.
> 
> IMHO, some of these functions would really be best implemented in the main en
gine itself.
> 
> One that comes to mind right away would be a "report-account-balance" 
>function which would return
> an account's balance for any given day:time.

That should be enough to get me going, thanks.
--
"We use  Linux for all our mission-critical  applications.  Having the
source code  means that  we are not  held hostage by  anyone's support
department."  -- Russell Nelson, President of Crynwr Software
[EMAIL PROTECTED] - <http://www.hex.net/~cbbrowne/lsf.html>



--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]

Reply via email to