On Wednesday, June 16, 2021 at 3:19:06 AM UTC+8 Ben Greenman wrote:

> On 6/15/21, Britt Anderson <britt.u...@gmail.com> wrote: 
> > Thanks for the help to my specific problem. More generally, what should 
> > have clued me in to a contract or type error when the only message 
> received 
> > had to do with y plot bounds? Just looking for practical advice to help 
> me 
> > figure out things on my own going forward. 
>
> There's nothing in this program that could have clued you in besides 
> the empty plot. 
>
> Next time, I'd write tests for my function before sending it to plot's 
> `function` renderer.


I think this is an interesting case, and I am not sure that writing tests 
would have helped.  

With the benefit of hindsight, it is easy to see what is going on, but, if 
I were to write tests for this function, I would have noticed that `(d 0)` 
throws a contract error and made sure I only pass flonums to the test -- 
the function itself is correct after all, it is just that it expects only 
certain kind of numbers (i.e 0.0 but not 0, 1.0 but not 1, etc).  Even 
adding a contract to this function would not have helped, since the plot 
package would have discarded those as well.  For some examples how why this 
plot feature is useful, see this 
comment: https://github.com/racket/plot/issues/97#issuecomment-861887283

Alex.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/341b0191-b2c7-4663-91f3-3c0cc3ff7d92n%40googlegroups.com.

Reply via email to