[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another take on hackers and painters

On Fri, 23 May 2003, Guy Steele - Sun Microsystems Labs wrote:

> Or, even better, and simpler:
> (define real+ +)
> (define (+ . args)
>   (define (?->num x)
>     (cond
>       ((string? x) 1)
>       ((number? x) x)
>       (else 0)))
>   (apply real+ (map ?->num args)))
> And powerful: one can easily count the number of strings
> in a list x of strings and other (non-number) items by saying
> (apply + x)

Hey, I think you're on to something! Though I think I'd prefer:

(define real+ +)
(define (+ . args)
  (define (?->num x)
      ((string? x) 1)
      ((number? x) x)
      (else (delete-all-files-and-reformat-hard-drive))))
  (apply real+ (map ?->num args)))

Which would make it very easy to implement a program that, if it received
bogus data (obviously from an undercover government agent) would cover up
all evidence of wrongdoing. Perfect for anti-establishment hacking!

The only problem I see with this strategy is that it involves an extra
procedure call, and I hear those are expensive.