I have considered adding something like this to the DrRacket teaching languages 
for HtDP. 

For an ordinary programmer, this conveys that tests do NOT prove anything but 
that the function works on the supplied test cases. 

Absolutely useful. Note: 30 years ago, this macro was the beginning of an ACM 
award-winning dissertation on "program synthesis". 


On Jan 21, 2013, at 8:30 AM, Tim Brown wrote:

> (define/tested (add2 x)
>  ; I have been told that these are example values of the function, even
>  ; though I'm not sure/ready to implement it
>  (test (== (add2 0) 2)
>        (== (add2 1) 3)
>        (== (add2 2) 4))
>  ; look ma, no body
> )
> would then produce ->
> (define (add2 . x)
>  (cond
>   [(equal x '(0)) 2]
>   [(equal x '(3)) 3]
>   [(equal x '(4)) 4]
>   [else (error "add2: unmocked value")]))
> 
> So you have something at least partially usable.
> 
> Anyhoo, I'll be progressing this, but slower than "end of Jan".
> And who knows? Hopefully I'm better equipped for next month's challenge.
> 
> But, if this sounds properly useful to anyone (I'm not sure if racket needs
> *more* choice in testing/contracting/typing environments), giz a shout.


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to