[PRL] don't

Jed Davis jld at ccs.neu.edu
Wed Nov 11 14:38:21 EST 2009


On Wed, Nov 11, 2009 at 09:49:24AM -0500, Sam TH wrote:
> I think we should be more precise here.  (don 't 3) shouldn't be
> valid, and (don (quote t) (launch-the-nukes)) is right out.

But what about (eval '(don't 5))?

> (define-syntax (don stx)
>   (syntax-case stx ()
>     [(don (q t) . _)
>      (and (eq? (syntax->datum #'q) 'quote)
>           (eq? (syntax->datum #'t) 't)
>           (let* ([don-start (syntax-position #'don)]
>                  [don-end (+ don-start (syntax-span #'don) -1)]
>                  [q-start (syntax-position #'q)]
>                  [t-start (syntax-position #'t)])
>             (= t-start (+ 1 q-start) (+ 2 don-end))))
>      #'(void)]
>     [_ #'"Hi, I'm Don."]))

I have  *better* idea:

  : don't postpone \ ; immediate

If you think you need to not do something that takes more than a line to
express, then clearly what you really need is to factor your code more
so that you can express what not to do more concisely. 

-- 
sub p{(/\G`/gc&&&p&&&p)||/\.?./g}sub l(){$p=-pos;&p;$p+pos}sub s{/``(k)|
```(s)|`\.(.)|`(r)|`i/gx&&($1&&(($x,$y)=(l,l),s/...(.{$x}).{$y}\G/$1/)||
$2&&(($x,$y,$z)=(l,l,l),s/..(.{$x})(.{$y})(.{$z})\G/$1$3`$2$3/x)||$3ne""
&&(print$3)&&s/...\G//||(($4&&print"\n"),s/..\G//))}while(<>){_ while&s}



More information about the PRL mailing list