Discussion:
[racket] Considering backward-incompatible change to Plot
Neil Toronto
2015-03-17 16:33:47 UTC
Permalink
Plot has been converted to Typed Racket in the upcoming Racket 6.2.

I'm strongly considering taking this opportunity to improve the API. The
change is backward-incompatible, however, so I need input from those of
you who use Plot a lot.

In particular, recent experience with Pict3D makes it clear that the
type of the `plot` function shouldn't be this:

(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))

but should be this instead:

(-> (Treeof (U nonrenderer renderer2d)) ... Plot)

where a `Plot` instance is a value that can be queried for its
properties (such as the legend, plot bounds, ticks, etc.) and just
happens to print in DrRacket as an interactive snip. The type of
`plot3d` would be changed to return `Plot3D` instances.

Casual uses wouldn't see any change at all.

However, functions that receive or return plots, *which also put
contracts on plots*, would have to change to use `plot?` instead of
(is-a?/c snip%), or use (require plot/snip), a new compatibility module,
instead of (require plot).

How many programs of yours would this change break?

Any objections? Any suggestions?

Neil ⊥
____________________
Racket Users list:
htt
Vincent St-Amour
2015-03-17 17:49:46 UTC
Permalink
I use Plot a lot, but pretty much only use `plot-pict` and `plot-file`,
so this change wouldn't affect me.

Not sure how useful that information is to you, but here it is anyway. :)

Vincent



At Tue, 17 Mar 2015 12:33:47 -0400,
Post by Neil Toronto
Plot has been converted to Typed Racket in the upcoming Racket 6.2.
I'm strongly considering taking this opportunity to improve the API. The
change is backward-incompatible, however, so I need input from those of
you who use Plot a lot.
In particular, recent experience with Pict3D makes it clear that the
(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))
(-> (Treeof (U nonrenderer renderer2d)) ... Plot)
where a `Plot` instance is a value that can be queried for its
properties (such as the legend, plot bounds, ticks, etc.) and just
happens to print in DrRacket as an interactive snip. The type of
`plot3d` would be changed to return `Plot3D` instances.
Casual uses wouldn't see any change at all.
However, functions that receive or return plots, *which also put
contracts on plots*, would have to change to use `plot?` instead of
(is-a?/c snip%), or use (require plot/snip), a new compatibility module,
instead of (require plot).
How many programs of yours would this change break?
Any objections? Any suggestions?
Neil $B"](B
____________________
http://lists.racket-lang.org/users
____________________
Racket Users list:
http://lists.racket-lang.org/users
Spencer Florence
2015-03-17 17:51:28 UTC
Permalink
I've been using plot heavily for https://github.com/florence/convex-hulls,
which pulls a bitmap% from the snip% to render it as a gif. As long at the
Plot object can get me a bitmap% or its underlying vector, I would love the
new interface.

or maybe I should just be using `plot-pict`...
Post by Neil Toronto
Plot has been converted to Typed Racket in the upcoming Racket 6.2.
I'm strongly considering taking this opportunity to improve the API. The
change is backward-incompatible, however, so I need input from those of
you who use Plot a lot.
In particular, recent experience with Pict3D makes it clear that the
(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))
(-> (Treeof (U nonrenderer renderer2d)) ... Plot)
where a `Plot` instance is a value that can be queried for its
properties (such as the legend, plot bounds, ticks, etc.) and just
happens to print in DrRacket as an interactive snip. The type of
`plot3d` would be changed to return `Plot3D` instances.
Casual uses wouldn't see any change at all.
However, functions that receive or return plots, *which also put
contracts on plots*, would have to change to use `plot?` instead of
(is-a?/c snip%), or use (require plot/snip), a new compatibility module,
instead of (require plot).
How many programs of yours would this change break?
Any objections? Any suggestions?
Neil ⊥
____________________
http://lists.racket-lang.org/users
Neil Toronto
2015-03-17 17:56:52 UTC
Permalink
That looks like an awesome project. I could probably even use the convex
hull implementations in Pict3D.

You could use `plot-bitmap` or `plot/dc` as well, FWIW.

I'll count this as a +1, then. :)

Neil ⊥
Post by Spencer Florence
I've been using plot heavily for
https://github.com/florence/convex-hulls, which pulls a bitmap% from the
snip% to render it as a gif. As long at the Plot object can get me a
bitmap% or its underlying vector, I would love the new interface.
or maybe I should just be using `plot-pict`...
Plot has been converted to Typed Racket in the upcoming Racket 6.2.
I'm strongly considering taking this opportunity to improve the API. The
change is backward-incompatible, however, so I need input from those of
you who use Plot a lot.
In particular, recent experience with Pict3D makes it clear that the
(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))
(-> (Treeof (U nonrenderer renderer2d)) ... Plot)
where a `Plot` instance is a value that can be queried for its
properties (such as the legend, plot bounds, ticks, etc.) and just
happens to print in DrRacket as an interactive snip. The type of
`plot3d` would be changed to return `Plot3D` instances.
Casual uses wouldn't see any change at all.
However, functions that receive or return plots, *which also put
contracts on plots*, would have to change to use `plot?` instead of
(is-a?/c snip%), or use (require plot/snip), a new compatibility module,
instead of (require plot).
How many programs of yours would this change break?
Any objections? Any suggestions?
Neil ⊥
____________________
http://lists.racket-lang.org/__u__sers
<http://lists.racket-lang.org/users>
____________________
Racket Users list:
http://lists.ra
Spencer Florence
2015-03-17 18:04:45 UTC
Permalink
Unfortunately the algorithms only work in 2D, and probably aren't actually
efficient. I have been meaning to generalize some of them now that Pict3D
exists :) And they would probably serve as reference implementations.
Post by Neil Toronto
That looks like an awesome project. I could probably even use the convex
hull implementations in Pict3D.
You could use `plot-bitmap` or `plot/dc` as well, FWIW.
I'll count this as a +1, then. :)
Neil ⊥
Post by Spencer Florence
I've been using plot heavily for
https://github.com/florence/convex-hulls, which pulls a bitmap% from the
snip% to render it as a gif. As long at the Plot object can get me a
bitmap% or its underlying vector, I would love the new interface.
or maybe I should just be using `plot-pict`...
Plot has been converted to Typed Racket in the upcoming Racket 6.2.
I'm strongly considering taking this opportunity to improve the API.
The
Post by Spencer Florence
change is backward-incompatible, however, so I need input from those
of
Post by Spencer Florence
you who use Plot a lot.
In particular, recent experience with Pict3D makes it clear that the
(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))
(-> (Treeof (U nonrenderer renderer2d)) ... Plot)
where a `Plot` instance is a value that can be queried for its
properties (such as the legend, plot bounds, ticks, etc.) and just
happens to print in DrRacket as an interactive snip. The type of
`plot3d` would be changed to return `Plot3D` instances.
Casual uses wouldn't see any change at all.
However, functions that receive or return plots, *which also put
contracts on plots*, would have to change to use `plot?` instead of
(is-a?/c snip%), or use (require plot/snip), a new compatibility
module,
Post by Spencer Florence
instead of (require plot).
How many programs of yours would this change break?
Any objections? Any suggestions?
Neil ⊥
____________________
http://lists.racket-lang.org/__u__sers
<http://lists.racket-lang.org/users>
Brian Mastenbrook
2015-03-17 23:02:54 UTC
Permalink
Post by Neil Toronto
How many programs of yours would this change break?
Any objections? Any suggestions?
add1 to the interface change. This won't break any of my programs; I either use plot interactively or plot-file.
--
Brian Mastenbrook
***@mastenbrook.net
http://brian.mastenbrook.net/


____________________
Racket Users list:
http://lists.racket-lang.org/users
Doug Williams
2015-03-18 22:38:07 UTC
Permalink
You know I use it a lot. Is there someway to check it out ahead of time? My
main concern is with my plots that are embedded in various GUI elements. I
sometimes did some weird things there,
Post by Neil Toronto
Plot has been converted to Typed Racket in the upcoming Racket 6.2.
I'm strongly considering taking this opportunity to improve the API. The
change is backward-incompatible, however, so I need input from those of you
who use Plot a lot.
In particular, recent experience with Pict3D makes it clear that the type
(-> (Treeof (U nonrenderer renderer2d)) ... (U Void (Instance Snip%)))
(-> (Treeof (U nonrenderer renderer2d)) ... Plot)
where a `Plot` instance is a value that can be queried for its properties
(such as the legend, plot bounds, ticks, etc.) and just happens to print in
DrRacket as an interactive snip. The type of `plot3d` would be changed to
return `Plot3D` instances.
Casual uses wouldn't see any change at all.
However, functions that receive or return plots, *which also put contracts
on plots*, would have to change to use `plot?` instead of (is-a?/c snip%),
or use (require plot/snip), a new compatibility module, instead of (require
plot).
How many programs of yours would this change break?
Any objections? Any suggestions?
Neil ⊥
____________________
http://lists.racket-lang.org/users
Continue reading on narkive:
Loading...