Sometimes my logic classes echo back at me from years past, and I feel compelled to write A and not B, or in arc terms, hopefully, a&~b. Here's an example:
[ time passes ...]
I would expect (t nil nil nil t), but it doesn't work! Arc just hangs.
arc> ; a function to detect multiples of d
arc> (def m (d) (fn (n) (is (mod n d) 0)))
arc> ; odd numbers that are not multiples of 7.
arc> (map odd&~m.7 (range 5 9))
Here is a possible solution that simply demotes ~-ssyntax, so that &-ssyntax gets expanded before ~. I can't tell if it might break other stuff though:
This is only a quick fix; I think part of the underlying problem is that expand-ssyntax triggers expand-compose if it detects "~" anywhere in the symbol, but expand-compose only expands "~" when it occurs at the beginning of the symbol.
(define (expand-ssyntax sym)
((cond ((insym? #\: sym) expand-compose)
((or (insym? #\. sym) (insym? #\! sym)) expand-sexpr)
((insym? #\& sym) expand-and)
((insym? #\~ sym) expand-compose) ; ** demote complement **
; ((insym? #\_ sym) expand-curry)
(#t (error "Unknown ssyntax" sym)))