brownplt / code.pyret.org

Website for serving Pyret to folks.
Other
24 stars 45 forks source link

Add boxplot range #360

Closed jpolitz closed 3 years ago

jpolitz commented 3 years ago

@schanzer this LGTM. One thought is that teachpacks that wrap it may want to do max <= min checking; the current behavior is that they seem to both work-ish

image
schanzer commented 3 years ago

Good call! Will do.

schanzer commented 3 years ago

@jpolitz how does one throw Pyret exceptions from the JS world? Or would this checking be done in chart.arr? It seems like there's no opportunity to do the checking in Pyret-land, but I could be wrong about that.

jpolitz commented 3 years ago

Wow sorry I missed this comment.

JS actually has access to make the best error messages. For something that's a function/method argument, you can emulate what images do. checkArgsInternalXXX is the best series of functions.

https://github.com/brownplt/code.pyret.org/blob/horizon/src/web/js/trove/make-image.js#L105 https://github.com/brownplt/code.pyret.org/blob/horizon/src/web/js/trove/internal-image-untyped.js#L247

jpolitz commented 3 years ago

checkArrayIndex is another similar function in the runtime:

https://github.com/brownplt/pyret-lang/blob/horizon/src/js/base/runtime.js#L4039