Arc Forumnew | comments | leaders | submitlogin
3 points by rocketnia 2875 days ago | link | parent

Changing ac.scm's 'expand-ssyntax will make Arc's 'ssyntax predicate incorrect. The exception should be added in here, where there happen to already be a few exceptions that are currently meaningless:

  (define (ssyntax? x)
    (and (symbol? x)
         (not (or (eqv? x '+) (eqv? x '++) (eqv? x '_)))
         (let ((name (symbol->string x)))
           (has-ssyntax-char? name (- (string-length name) 1)))))
(This is quoted from Anarki 'cause the source is handier for me right now.)

Note, however, that calling Arc's 'ssexpand will expand a symbol regardless of whether it's an exception. I don't know whether this is a bug or not; the workaround is just to check with 'ssyntax first if it matters.

1 point by evanrmurphy 2873 days ago | link

Thanks for the tip, this is working well. The only minor issue I'm still dealing with on this is how to strip the dot of all special meaning except in the context of rest parameters.

By adding the dot ssyntax exception in ac and not applying the read-normal macro from the OP to #\., I've gotten this to work so long as dot is inside the scheme bars:

  ; Dot treated as a symbol when inside the bars

  arc> (= |.| 2)
  arc> (is (+ 1 1) |.|)

  ; It still works in the rest parameter context

  arc> (def foo (x . args)
         `(,x ,@args d))
  #<procedure: foo>
  arc> (foo 'a 'b 'c)
  (a b c d)

  ; But it doesn't work as a symbol without the bars.
  ; Note that (read-normal #\.) can make this work but
  ; it breaks the rest parameter case.

  arc> (= . 2)
  Error: "map: expects type <proper list> as 2nd argument,
  given: 2; other arguments were: #<procedure:ac-niltree>"
So I'm about 3/4 of the way there. :)