arc> (ssexpand '+.a.b)
.a.b
arc> (ssexpand 'a.+.b)
(andf a. .b)
... but I guess this usage is sacrificed for the greater good of having andf compression. Gentle reminder that #\& wouldn't conflict with a pre-existing builtin function, while making intuitive sense.
Another little surprise:
arc> (ssexpand '++x)
x
arc> (ssexpand 'x++)
x
It's a pity to silently drop pre- and post-fix #\+, instead making special cases for '+ and '++. These are probably "valuable semantic space" - eg expand ++x to (++ x).
Final surprise: I wanted to try all the ssyntax together.
I fiddled a bit with ac.scm to get what I wanted. The problem is that expand-ssyntax invokes expand-compose even if there is only a non-initial #\~ in the symbol. But expand-compose does nothing with non-initial #\~, so my test expression never gets expanded. This fix triggers expand-compose iff #\~ is the first character. Making #\~ have lower precedence than #\+ (as a comment in ac.scm suggests) should also do the trick, but I haven't tried that. (warning: manual diff)
(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)))))
+ (or (eqv? (string-ref name 0) #\~)
+ (has-ssyntax-char? name (- (string-length name) 1))))))
(define (has-ssyntax-char? string i)
(and (>= i 0)
(or (let ((c (string-ref string i)))
- (or (eqv? c #\:) (eqv? c #\~)
+ (or (eqv? c #\:)
(eqv? c #\+)
;(eqv? c #\_)
(eqv? c #\.) (eqv? c #\!)))
(has-ssyntax-char? string (- i 1)))))