scheme reporting help!!

Don Zickus dzickus at gmail.com
Tue Jan 27 21:53:00 EST 2009


Hello,

I was trying hacking on a budget reporting feature in the svn trunk
for my own curiosity.  Unfortunately, I apparently suck at Scheme.  I
thought the code looked intuitive enough that I could hack up
something simple without much pain but I was wrong.  In fact, now I am
frustrated because I seem to be stuck on initializing a variable of
all things.

I was hoping someone who knew Scheme could point out my error for me.
I have never ever touched Scheme before last weekend.

The following snippet of code seems to be the source of my problems:

@@ -140,6 +147,7 @@
     (let* ((num-periods (gnc-budget-get-num-periods budget))
            (period 0)
            (current-col (+ colnum 1))
+           (tdif-dif-total (gnc-numeric-zero))
            )
       (while (< period num-periods)
              (let* (
@@ -170,6 +178,13 @@
                                  (gnc:make-gnc-monetary comm dif-numeric-val)))
                     )

+                    ;; total difference (total period budget to total
period actual)
+                    (tdif-dif-total (gnc-numeric-add dif-numeric-val
+                                 tdif-dif-total GNC-DENOM-AUTO
+                                 (+ GNC-DENOM-LCD GNC-RND-NEVER)))
+                    (tdif-val (if bgt-unset? "."
+                                 (gnc:make-gnc-monetary comm tdif-dif-total)))
+
                (if show-budget?
                  (begin
                    (gnc:html-table-set-cell!

With the following error message:

In unknown file:
    ...
   ?: 35  [while-helper #<procedure #f (break continue)>]
   ?: 36  (do ((key (make-symbol "while-key"))) ((catch key (lambda () #) ...)))
   ?: 37* [catch #<uninterned-symbol while-key b5742cd0> #<procedure #f ()> ...]
   ?: 38* [#<procedure #f ()>]
   ?: 39* [#<procedure #f (break continue)> #<procedure #f ()>
#<procedure #f ()>]
   ?: 40* (do () ((#<primitive-procedure not> (< period num-periods))) ...)
In /opt/gnucash/trunk/share/gnucash/guile-modules/gnucash/report/budget.scm:
 153: 41* (let* (# # # # ...) (tdif-dif-total #) (tdif-val #) ...)
 182: 42* [#<<gnc-numeric> num: 0 denom: 1> #<<gnc-numeric> num:
-542131 denom: 100>]
/opt/gnucash/trunk/share/gnucash/guile-modules/gnucash/report/budget.scm:182:21:
In expression (tdif-dif-total (gnc-numeric-add dif-numeric-val
tdif-dif-total ...)):
/opt/gnucash/trunk/share/gnucash/guile-modules/gnucash/report/budget.scm:182:21:
Wrong type to apply: #<<gnc-numeric> num: 0denom: 1>

I have also attached the whole patch, in case that matters.  Thanks in advance.

Cheers,
Don

ps - please cc me as I am not subscribed to the list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: don.patch
Type: text/x-patch
Size: 3857 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20090127/81aa21a1/attachment.bin 


More information about the gnucash-devel mailing list