axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] 2.6.10


From: Camm Maguire
Subject: [Axiom-developer] 2.6.10
Date: Fri, 11 Jul 2014 15:08:19 -0400

Greetings!

vmlisp.lisp:

(defun getl (sym key )
  (cond ((consp sym) (cdr (assq key sym)))
        ((symbolp sym) (get sym key))))

sym in this function is bound to ordinary lists (i.e. non-alists), such
as (ans 1).  The assq would fail normally in GCL 2.6.8 in which there
are no immediate fixnums, i.e. all fixnums are boxed.  Taking the 'car'
on such a fixnum will return garbage, but not segfault.  In 2.6.10, most
fixnums are represented by bit patterns outside the heap to lower
allocation costs.  Here the assq will segfault instead of fail.  May I
suggest one of the following:

(defun getl (sym key)
  (cond ((consp sym) ;safe
         (cdr (member-if (lambda (x) (when (consp x) (eq key (car x)))) sym)))
        ((symbolp sym) (get sym key))))

(defun getl (sym key )
  (cond ((consp sym) ;assumes an alist can be detected by the first element
         (when (consp (car sym)) (cdr (assq key sym))))
        ((symbolp sym) (get sym key))))

Take care,
-- 
Camm Maguire                                        address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

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