Arc Forumnew | comments | leaders | submitlogin
[patch] lone ~ crashes arc
7 points by sjs 6165 days ago | 1 comment
Entering a single tilde crashes arc without any error message. Obviously Arc should not crash, but what exactly should it do? The only sane thing I could think of is to have it return the no function (ie. a bare ~ is an alias for no). So instead of this:

  arc> ~
  %
We have:

  arc> ~
  #<procedure: no>
  arc> (~ nil)
  t
  arc> (~ t)
  nil
I've pushed the change to anarki (the git "wiki").

  diff --git a/ac.scm b/ac.scm
  index 9e9d9e1..bddbf25 100644
  --- a/ac.scm
  +++ b/ac.scm
  @@ -101,7 +101,9 @@
   (define (expand-ssyntax sym)
     (let ((elts (map (lambda (tok)
                        (if (eqv? (car tok) #\~)
  -                         `(complement ,(chars->value (cdr tok)))
  +                         (if (null? (cdr tok))
  +                             'no
  +                             `(complement ,(chars->value (cdr tok))))
                            (chars->value tok)))
                      (tokens #\: (symbol->chars sym) '() '()))))
       (if (null? (cdr elts))


3 points by pg 6163 days ago | link

Thanks, this seems right; am using this.

-----