Arc Forumnew | comments | leaders | submitlogin
I fixed it!
9 points by Jesin 4489 days ago | 3 comments
I got arc2 to work on mzscheme 372.

Because mzscheme 372 responds to arc2 with a cryptic error containing nothing resembling a line number, I had to find a different way to locate the problem. After looking through ac.scm for a while, I found a solution. I loaded ac.scm in mzscheme, and then did this:

  (acompile "arc.arc")
What acompile does is compile .arc files into .scm files. Anyway, mzscheme spat out the same error message, but it left a file called arc.arc.scm in the arc2 folder. When it hit the error, rather than deleting the file, it stopped in the middle and left what it had already done. By recognizing the patterns left by certian macroexpansions, I was able to find the last part of arc.arc that it had successfully compiled. I managed to fix it by looking for things that appeared in the first part that failed that didn't appear in the part that succeeded. I did the same thing to the files mentioned in libs.arc, and was able to get just about everything up and running. I gave up on news.arc, though, as the macros are nested way too deep in there for me to untangle at the moment.

So, I ran

  diff arc2 arc2-fixed
and I think the diffs make it pretty obvious what mzscheme was reacting to. Now the question is, why does it reject that?

  diff arc2/arc.arc arc2-fixed/arc.arc
  < (let expander 
  <      (fn (f var name body)
  <        `(let ,var (,f ,name)
  <           (after (do ,@body) (close ,var))))
  > (let expander nil
  >   (def expander (f var name body)
  >     `(let ,var (,f ,name)
  >        (after (do ,@body) (close ,var))))
  diff arc2/html.arc arc2-fixed/html.arc
  < (let pratoms (fn (body)
  <                (if (or (no body) 
  <                        (all [and (acons _) (isnt (car _) 'quote)]
  <                             body))
  <                    body
  <                    `((pr ,@body))))
  > (let pratoms nil
  >   (def pratoms (body)
  >     (if (or (no body) 
  >             (all [and (acons _) (isnt (car _) 'quote)]
  >                  body))
  >         body
  >         `((pr ,@body))))
  diff arc2/libs.arc arc2-fixed/libs.arc
  <             "news.arc"))
  >             ;"news.arc"
  >             ))

3 points by cronin1024 4488 days ago | link

If you're using the "stock" version of arc (the one provided through this site and not Anarki) then I think the only change you need to make is what you'll find here:

Anarki already contains this patch, and given the amount of time since the Arc2 release, cloning the repository is probably your best bet.


1 point by Jesin 4487 days ago | link

Aah! Didn't know about that, thanks for bringing that up. Yes, the error did say something about (quote nil). That should make things much easier.


1 point by Jesin 4488 days ago | link

By the way, I think I said elsewhere that I've been rewriting arc.arc and cleaning it up a little. I have been paying attention to the comments, so if anything is a little messy but runs 3x as fast as the clean way, I'm leaving it as is.

Anyway, one of the comments is that, while iso takes 2 args now, it really should take n args. Here's what I came up with:

  (let iso1 nil
    (def iso1 (x y)
      (or (is x y)
          (and (acons x)
               (acons y)
               (iso1 (car x) (car y))
               (iso1 (cdr x) (cdr y)))))
    (def iso (x . xs)
      (if xs
          (and (iso1 x (car xs))
               (apply iso xs))
I also came up with this function, a macex that expands more than just the car:

  (def macex-all (e)
    (zap macex e)
    (if acons.e
        (map1 macex-all e)