guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

poe.scm perfect-funcq bit rot


From: Kevin Ryde
Subject: poe.scm perfect-funcq bit rot
Date: Sun, 21 Sep 2003 09:22:34 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

I was silly enough to try poe.scm,

        (use-modules (ice-9 poe))
        (define p (perfect-funcq 123 noop))
        (p 'x)

and got

        In procedure caar in expression (caar alist):
        Wrong type argument in position 1: ()
        ABORT: (wrong-type-arg)

This is in funcq-assoc, and I think that function looks fairly
doubtful as it stands.

It seems to be assuming '() is false, which might be some bit-rot, and
I also can't see how it works its way down the given alist, it looks
like the and-map loop will only examine the first entry.

Perhaps (below),

        * poe.scm (funcq-assoc): Rewrite, don't assume '() is false, actually
        traverse the given alist.

This quietly drops the "let ((it ..." business, which I assume serves
no purpose.

This would probably be for 1.6 too, though it's all undocumented so
doesn't really rate.


;; return true if lists X and Y are the same length and each element is `eq?'
(define (eq?-list x y)
  (if (null? x)
      (null? y)
      (and (not (null? y))
           (eq? (car x) (car y))
           (eq?-list (cdr x) (cdr y)))))

(define (funcq-assoc arg-list alist)
  (if (null? alist)
      #f
      (if (eq?-list arg-list (caar alist))
          (car alist)
          (funcq-assoc arg-list (cdr alist)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]