[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Easyffi question
From: |
John Cowan |
Subject: |
Re: [Chicken-users] Easyffi question |
Date: |
Mon, 22 Dec 2008 16:28:23 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Jim Ursetto scripsit:
> The `sx` egg does something similar -- transforming a list of strings
> into a null-terminated array of C strings. I derived a quick example
> from it and attached the code.
BTW, there is a bug in this code: if it's passed an improper list, it
goes off into hyperspace. It's never a good idea to test for () as
a list terminator in either C or Scheme: you should use something like
this:
(define (end? x)
(cond
((pair? x) #f)
((eq? x '()) #t)
(else (error "A proper list should not end with" x))))
(This is based on the Common Lisp predicate ENDP.)
--
But you, Wormtongue, you have done what you could for your true master. Some
reward you have earned at least. Yet Saruman is apt to overlook his bargains.
I should advise you to go quickly and remind him, lest he forget your faithful
service. --Gandalf John Cowan <address@hidden>