sxml or guile bug?

2023-04-30 Thread Christopher Lam
Hi, we've identified an unusual behaviour in writing a test in gnucash. Can anyone reproduce and confirmit? I paste a simple .scm file, and its input test-file.html. Now, in sxml-bug.scm, modify the index - from -1 to -2 i.e. access the last/penultimate row etc. Odd negative indices work, even

Re: Simple list of key-value pairs?

2021-07-08 Thread Christopher Lam
IMO quotes and quasiquotes are being used perfectly well. You can use '(system #f). However I suspect building a list of intermediate strings is not desirable. And we may want to eliminate map and filter. How about building the query-string piecemeal then building the final string once? (define

Re: guile style

2021-06-19 Thread Christopher Lam
Agree set! is not a desirable form. It is not consistently optimisable. I cannot find the reference in the manual. Also consider the first form: you're building a list in 3 passes -- call iota to generate a list, call filter to navigate the list again, then fold to accumulate your answer.

Re: Unbound variable warning/exception

2020-12-20 Thread Christopher Lam
2020 at 21:36, Ludovic Courtès wrote: > Hi, > > Aleix Conchillo Flaqué skribis: > > > On Fri, Dec 18, 2020 at 5:26 PM Christopher Lam > > wrote: > >> > >> Hi guilers, I saw in guix the incredibly useful unbound-variable > exception > >

Re: vector-last / vector-ref with negative indices?

2020-12-20 Thread Christopher Lam
Easy - vector-ref with a negative index is not defined in r[5|7]rs. On Sun, 20 Dec 2020 at 06:59, Aleix Conchillo Flaqué wrote: > Hi, > > This month I'm trying to go through Advent Of Code one more year > (previous years I didn't get too far) and I've been finding myself > writing the same

Re: Unbound variable warning/exception

2020-12-19 Thread Christopher Lam
, Aleix Conchillo Flaqué > wrote: > > > > On Fri, Dec 18, 2020 at 5:26 PM Christopher Lam > > wrote: > >> > >> Hi guilers, I saw in guix the incredibly useful unbound-variable > exception > >> printer written by Ludovic. I've adapted for use in gnucash a

Unbound variable warning/exception

2020-12-18 Thread Christopher Lam
Hi guilers, I saw in guix the incredibly useful unbound-variable exception printer written by Ludovic. I've adapted for use in gnucash as https://github.com/Gnucash/gnucash/commit/6f951784 -- there are now in guile 3.0.4 many more unbound-var warnings than in 3.0.2 -- wouldn't it be a useful hint

Re: No Guile on Windows? (was: My Guile Hacker Handbook)

2020-07-27 Thread Christopher Lam
risk of falling behind. https://github.com/jralls/guile On Sat, 25 Jul 2020, 10:28 pm Eli Zaretskii, wrote: > > From: Christopher Lam > > Date: Sat, 25 Jul 2020 13:56:28 + > > Cc: guile-user , help-g...@gnu.org > > > > Gnucash 4.0 in windows is successfully

Re: No Guile on Windows? (was: My Guile Hacker Handbook)

2020-07-25 Thread Christopher Lam
Gnucash 4.0 in windows is successfully using libguile-2.2-1.dll from MSYS2. On Sat, 25 Jul 2020 at 06:32, Eli Zaretskii wrote: > > Date: Sat, 25 Jul 2020 00:48:35 -0300 > > From: David Pirotte > > Cc: Dmitry Alexandrov , guile-user@gnu.org, > help-g...@gnu.org > > > > fwiw, i've used msys2

Re: No Guile on Windows? (was: My Guile Hacker Handbook)

2020-07-24 Thread Christopher Lam
Ditto gnucash on windows does include guile 2.2 but it's a major pain point to get it to build. https://code.gnucash.org/logs/2020/07/16.html#T20:20:40 On Fri, 24 Jul 2020, 3:24 pm Dr. Arne Babenhauserheide, wrote: > > Eli Zaretskii writes: > > > > Sadly, Guile seems to care only about one

Re: srfi-9 vs make-record-type

2020-07-13 Thread Christopher Lam
be a more elegant solution but for now it'll do. See the set of related commits at https://github.com/Gnucash/gnucash/commits?after=00bbd32677fba00ae0e709dce0bb35e06f90305c+4 onwards. On Mon, 26 Aug 2019 at 12:20, Christopher Lam wrote: > Thank you Mark and John. > > On Mon, 5 Aug 2019 at 18

Re: "Missing" libraries/concepts found in other languages/ecosystems?

2020-07-10 Thread Christopher Lam
With respect to looking for guile examples, I've seen examples whereby LISPers would run some code, dynamically changing the code while running in production, and immediately the new code would be replaced in-memory. Not sure if this is possible in scheme. Any live pointers would be appreciated :)

gettext uses scm_from_locale_string instead of scm_from_utf8_string

2020-06-08 Thread Christopher Lam
Not sure if this is a design issue, but the subject explains it causes problems in use. Hence the following fix is needed and GnuCash can't use gettext. https://bugs.gnucash.org/show_bug.cgi?id=797746 https://github.com/Gnucash/gnucash/commit/b5aeca94b

Re: Happy birthday, Guile!

2020-02-18 Thread Christopher Lam
A bit late, and perhaps not as sophisticated as some bigger modules here. Two functions defined as follows: nested-alist-set! nested-alist-get at https://github.com/Gnucash/gnucash/blob/1f83cfaf64d1cd3c8862b427dd043154f780a772/gnucash/report/html-chart.scm#L37 Consider a nested alist describing

Re: Pure (side-effect-free) calls into c/c++?

2020-01-11 Thread Christopher Lam
I can add a contribution! The good thing about memoize is it's simple to create. You forgot a catch however: if the memoized return-val is #f then your memoizer https://hg.sr.ht/~bjoli/misc/browse/default/memoize.scm will not recognise that #f is a valid cached return-val and will call the lambda

Re: a C<->guile O(2N) problem

2019-12-11 Thread Christopher Lam
ode with benchmarks. On Sun, 8 Dec 2019 at 13:15, Christopher Lam wrote: > Hello guilers > > I am asking for some help optimizing C<->guile while working on the > simplest of lispy data structures; the proper list. The C equivalent being > used is glib's g_list. > > I

a C<->guile O(2N) problem

2019-12-08 Thread Christopher Lam
Hello guilers I am asking for some help optimizing C<->guile while working on the simplest of lispy data structures; the proper list. The C equivalent being used is glib's g_list. In https://github.com/Gnucash/gnucash/blob/maint/common/base-typemaps.i#L142 these are converted via the simple but

Re: Interactive Debugging

2019-10-23 Thread Christopher Lam
Agree it'll be a major aid to decreasing the learning curve. For now the only way to analyse a variable in a script is to (pk) it, which is annoying when it's a record/alist etc. Need to refine the pk several times or write a custom printer. Not sure how much knowledge of debugger is required,

Re: srfi-9 vs make-record-type

2019-08-26 Thread Christopher Lam
Thank you Mark and John. On Mon, 5 Aug 2019 at 18:18, Mark H Weaver wrote: > The problem here is that 'make-person' is a macro. Macros are expanded > at compile time, and must therefore be available at compile time. > > When you compile 'm2.scm', those macros are not available, because >

srfi-9 vs make-record-type

2019-07-21 Thread Christopher Lam
Hi All In experiments converting legacy code to use srfi-9 records, I'm finding the latter doesn't travel well across modules. See simple code below -- m1.scm runs fine however m2.scm borks when creating srfi-9 record object Any clue why srfi-9 can't be exported? For various reasons I must keep

Re: string-ports issue on Windows

2019-05-26 Thread Christopher Lam
: Throw to key `decoding-error' with args `("scm_from_utf8_stringn" "input locale conversion error" 0 #vu8(102 233 118 114 105 101 114 32 49 57 55 48))'. Is this a bug? On Tue, 14 May 2019 at 12:42, Christopher Lam wrote: > Hi Mark > Final update - first, we've reuse

Re: string-ports issue on Windows

2019-05-13 Thread Christopher Lam
a lot of issues in guile-2.0 could be solved in Windows by upgrading to guile-2.2. So, GnuCash has now upgraded to guile-2.2 on Windows and the string-ports are now behaving. Thank you (twice) :) On Fri, 19 Apr 2019 at 10:26, Christopher Lam wrote: > Hi, > The patch *does* work and handles u

Re: string-ports issue on Windows

2019-04-19 Thread Christopher Lam
ide the scope of this post. Thank you again! On Thu, 18 Apr 2019 at 21:20, Mark H Weaver wrote: > Hi again, > > Earlier, I wrote: > > > Christopher Lam writes: > > > >> Hi Mark > >> Thank you so much for looking into this. > >> I'm reviewing the G

Re: string-ports issue on Windows

2019-04-16 Thread Christopher Lam
, 16 Apr 2019 at 17:29, Mark H Weaver wrote: > Hi Christopher, > > Christopher Lam writes: > > > I'm struggling with string-ports on Windows. > > > > Last para of > > https://www.gnu.org/software/guile/manual/html_node/String-Ports.html > > "Wit

string-ports issue on Windows

2019-04-15 Thread Christopher Lam
Dear All I'm struggling with string-ports on Windows. Last para of https://www.gnu.org/software/guile/manual/html_node/String-Ports.html "With string ports, the port-encoding is treated differently than other types of ports. When string ports are created, they do not inherit a character encoding

Re: SRFI 64: How do I create a test-runner stub

2019-03-07 Thread Christopher Lam
Hi In gnucash I've resorted to writing my own srfi-64 test-runner. See the entry point at (run-test-proper) at https://github.com/Gnucash/gnucash/blob/maint/gnucash/report/standard-reports/test/test-transaction.scm Its definition is at

Re: issues unit testing with srfi-64

2018-12-29 Thread Christopher Lam
Hi In gnucash I've resorted to writing my own srfi-64 test-runner. See the entry point at (run-test-proper) at https://github.com/Gnucash/gnucash/blob/maint/gnucash/report/standard-reports/test/test-transaction.scm Its definition is at

Re: a small example of a REPL server

2018-11-28 Thread Christopher Lam
I saw a cute oneliner recently that I didn't note down, the gist of it was as follows (let loop ((lp (interaction-environment)))   (display (eval (read) lp))   (newline)   (loop lp)) Note the second line is very nearly read-eval-print-loop ;-) On 28/11/18 6:53 pm, Catonano wrote: Could