Arc Forumnew | comments | leaders | submitlogin
2 points by palsecam 5595 days ago | link | parent

I'm not sure if this correctly solves the right problem and without breaking other things, and I'm nearly certain there is a better solution anyway, but here is a pseudo-patch:

In ac.scm, add:

   + (define (map1-dotted func xs)
   +  "Limited 'map but it can handle a dotted list. Needed for 'ac-qq1."
   +   (cond ((pair? xs) 
   +          (cons (func (car xs)) (map1-dotted func (cdr xs))))
   +         ((not (null? xs)) (func xs))
   +         (#t xs)))  ; xs is null
In the definition of 'ac-qq1, change:

     [... conditions ...]
     ((pair? x)
   !  (map (lambda (x) (ac-qq1 level x env)) x))
by:

     [... conditions ...]
     ((pair? x)
   !  (map1-dotted (lambda (x) (ac-qq1 level x env)) x))
Result:

   arc> `(a . b)
   (a . b)
   arc> (with (a 1 b 2) `(foo (,a . ,b)))
   (foo (1 . 2))
   arc> (let foo 'bar `(,foo (a . b)))
   (bar (a . b))

I tried in Common Lisp and 'map doesn't work either with a dotted list. It seems like using 'map here, in 'ac-qq1, is attractive (simple) but not totally correct.