Arc Forumnew | comments | leaders | submitlogin
Backquoted Dotted-List Bug (e.g: "`(5 . 6)")in Arc-wiki
7 points by shlomif 6099 days ago | 6 comments
Hi all!

It seems that Arc-wiki (perhaps also arc2) has the following bug:

<<<<<<<< shlomi:~/Download/unpack/prog/lisp/arc/arc-wiki$ ./arc.sh Use (quit) to quit, (tl) to return here after an interrupt. arc> `(5 . 6) Error: "map: expects type <proper list> as 2nd argument, given: (5 . 6); other arguments were: #<procedure:.../arc-wiki/ac.scm:214:14>" arc> >>>>>>>>

`(5 . 6) works fine in SBCL, MZScheme, and Guile, so I don't see any reason for it to be broken here.

I'd appreciate it if anyone can commit a fix.



3 points by eds 6099 days ago | link

The error seems to be in ac-qq1, line 209, which uses map to look at nested structures in a quasiquote.

  ((pair? x)
   (map (lambda (x) (ac-qq1 level x env)) x))
And apparently scheme's map can't handle dotted lists.

Unfortunately I don't scheme well enough to know if another primitive does what we want... Otherwise we'll have to write a new version of map for use by quasiquote. (Or rewrite quasiquote to not use map at all, but that might be more work.)

I could do this but happen to be a little busy right now. (I wouldn't mind if someone were to beat me to it.)

-----

4 points by mec 6099 days ago | link

Someone in an earlier thread of mine suggested this fix:

  ((pair? x)
   (cons (ac-qq1 level (car x) env) (ac-qq1 level (cdr x) env)))

-----

2 points by shlomif 6099 days ago | link

Thanks!

I applied the following patch eventually:

{{{{{{{{{ ((pair? x) - (map (lambda (x) (ac-qq1 level x env)) x)) + (let ((t (lambda (f) (ac-qq1 level (f x) env)))) + (cons (t car) (t cdr)))) }}}}}}}}}

-----

2 points by eds 6098 days ago | link

By the way, what is with the "{{{{{{{{{" and "<<<<<<<<" in your posts? (You can mark text as code by indenting it.)

-----

3 points by mec 6098 days ago | link

To use the auto code format add 2 newlines and the code indented by two spaces;

  like this

-----

2 points by shlomif 6098 days ago | link

Hi! Thanks for the tip.

I normally use "{{{" and "<<<<" as delimiteres in a plaintext . But obviously it doesn't work very well here, so I'll keep in mind to use indentation instead.

Thanks again.

-----