Arc Forumnew | comments | leaders | submitlogin
2 points by rntz 3103 days ago | link | parent

Hm. It doesn't seem to handle 'fn correctly.

    arc> src.indent-with
    (from "../anarki/lib/ppr.arc")
    (def indent-with (l)
      (fn (xs (o col 0))
          (pr "(")
          (indent-pairs car.xs (+ col 3 l))
          (pr ")")
          (indent-block cdr.xs (+ col 3))))t
'fn is usually indented as follows, as if it were a macro:

    (fn (xs (o col 0))
      (pr "(")
      (indent-pairs car.xs (+ col 3 l))
      (pr ")")
      (indent-block cdr.x (+ col 3))))
A simple fix is to add 'fn to 'indent-rules*:

    --- ../anarki/lib/ppr.arc       2009-06-16 15:42:12.000000000 -0400
    +++ ppr.arc     2009-06-16 20:15:39.000000000 -0400
    @@ -133,7 +133,8 @@
            or      ,[indent-basic _ 2 _2]
            nor     ,[indent-basic _ 3 _2]
            case    ,(indent-case 1)
    -       caselet ,(indent-case 2))))
    +       caselet ,(indent-case 2)
    +       fn      ,[indent-mac _ 2 1 _2])))

     (def ppr (x (o col 0) (o noindent nil))
       " Pretty print. This function displays arc code with proper


1 point by shader 3103 days ago | link

You edited your post before I could respond ;)

But yes, that is exactly the fix, and also why I wrote it that way. Unfortunately, I'm beginning to think that the order of the function arguments could have been planned a bit better. All of those numbers can be rather confusing.

I should probably comment my code too ;)

-----