[PRL] don't
Sam TH
samth at ccs.neu.edu
Wed Nov 11 09:49:24 EST 2009
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.
(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."]))
On Wed, Nov 11, 2009 at 8:42 AM, Dave Herman <dherman at ccs.neu.edu> wrote:
> They think they're pretty special:
>
> http://www.reddit.com/r/programming/comments/a26fe/dont/
>
> We can (kind of) do this, too:
>
> (define-syntax (don stx)
> (syntax-case stx ()
> [(don (q t) . _)
> (and (eq? (syntax->datum #'q) 'quote)
> (eq? (syntax->datum #'t) 't))
> #'(void)]
> [_ #'"Hi, I'm Don."]))
>
> > (don't (display "hello, world"))
> > (don't (delete-file "/etc/passwd"))
> > (don't (exit))
>
> And *my* version even comes with a bonus Don:
>
> > don
> "Hi, I'm Don."
>
> Dave
>
>
> _______________________________________________
> PRL mailing list
> PRL at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/prl
>
--
sam th
samth at ccs.neu.edu
More information about the PRL
mailing list