Re: [racket-users] Canvas animation performance

2021-01-11 Thread Doug Williams
While you may not be able to get high frame rates, there are some very nice
animations that are easy to produce, particularly in conjunction with the
plot package. Here is a short sample that animates a 3D plot.

#lang racket/gui

;;; 3D animated plot example.

(require plot
 (planet williams/animated-canvas/animated-canvas))

(define (main delta t-last)
  (parameterize ((plot3d-samples 21))
(let loop ((t 0.0))
  (define (f x y) (* (sin (* 2.0 x)) (sin (* 2.0 y)) (cos t)))
  (when (<= t t-last)
(let* ((dc (send canvas get-dc))
   (width (send canvas get-width))
   (height (send canvas get-height)))
  (plot3d/dc (contour-intervals3d f 0 pi 0 pi)
 dc 0 0 width height
 #:z-min -1 #:z-max 1)
  (send canvas swap-bitmaps)
  (yield)
  (loop (+ t delta)))

(define frame
  (instantiate frame% ("Test Plot Animation")))

(define canvas
  (instantiate animated-canvas%
(frame)
(style '(border))
(min-width 400)
(min-height 300)))

(send frame show #t)

(main (* 0.05 pi) 20.0)

Doug

On Mon, Jan 11, 2021 at 9:45 AM Doug Williams 
wrote:

> I use Racket regularly for animations and wrote an animated-canvas package
> that does double buffering to smooth the animations for complex animations.
> I think you are running into some fundamental issues with frame rates
> possible with the drawing package in Racket. I have attached a version of
> your code using the animated-canvas package. It isn't any faster, but can
> (at least on my machine) handle 50,000 (or even 100,000) lines, although
> slowly. If you need speed, you can try using the OpenGL package.
>
> Doug
>
> On Sun, Jan 10, 2021 at 11:50 PM making-a-racket 
> wrote:
>
>> Hello all,
>>
>> I am embarking upon a project to doing 2D graphics in Racket, so I am
>> starting off with various experiments, some of which include testing out
>> performance and replicating Processing examples.
>>
>> I definitely need to do some more reading, but I am wanting to post this
>> to get some leads into ensuring I'm utilizing the best performance of the
>> racket/draw library and for pointers to portions (or elaborations) of the
>> documentation.
>>
>> In trying to reproducing the LineRendering example that ships with
>> Processing, I'm seeing a big performance difference. The Processing sketch
>> is:
>>
>> public void setup() {
>>   size(800, 600, P2D);
>> }
>>
>> public void draw() {
>>   background(255);
>>   stroke(0, 10);
>>   for (int i = 0; i < 5; i++) {
>> float x0 = random(width);
>> float y0 = random(height);
>> float z0 = random(-100, 100);
>> float x1 = random(width);
>> float y1 = random(height);
>> float z1 = random(-100, 100);
>>
>> // purely 2D lines will trigger the GLU
>> // tessellator to add accurate line caps,
>> // but performance will be substantially
>> // lower.
>> line(x0, y0, x1, y1);
>>   }
>> }
>>
>> My Racket code which attempts to reproduce this example is this:
>>
>> #lang racket/gui
>>
>> (require racket/draw)
>>
>> (define WIDTH 800)
>> (define HEIGHT 600)
>>
>> (define frame (new frame%
>>[label "Lines"]
>>[width WIDTH]
>>[height HEIGHT]))
>>
>> (define pen (new pen%
>>  [color (make-object color% 0 0 0 0.1)]
>>  [width 1]
>>  [style 'solid]))
>>
>> (define (paint canvas dc)
>>   (send dc set-pen pen)
>>   (for ([i (in-range 1)])
>> (send dc draw-line
>>   (random 0 WIDTH)
>>   (random 0 HEIGHT)
>>   (random 0 WIDTH)
>>   (random 0 HEIGHT
>>
>> (define canvas (new canvas%
>> [parent frame]
>> [paint-callback paint]))
>>
>> (send frame show #t)
>>
>> (define (loop)
>>   (send canvas refresh-now #:flush? #t)
>>   (sleep/yield 0.033)
>>   (loop))
>>
>> (loop)
>>
>> However, I am not able to obtain anywhere near the performance of the
>> Processing sketch, which can draw 50,000 lines at about 12-13fps. It can do
>> 10,000 at about 40fps. My Racket example can barely do 10,000 lines and is
>> definitely below 10fps. I am using Racket CS 7.9 on Windows 10 on an XPS 15
>> i7 with dedicated GPU. Even p5.js' performance is well above the Racket
>> sample but below the Processing sketch. Another thing that I have not

Re: [racket-users] Canvas animation performance

2021-01-11 Thread Doug Williams
I use Racket regularly for animations and wrote an animated-canvas package
that does double buffering to smooth the animations for complex animations.
I think you are running into some fundamental issues with frame rates
possible with the drawing package in Racket. I have attached a version of
your code using the animated-canvas package. It isn't any faster, but can
(at least on my machine) handle 50,000 (or even 100,000) lines, although
slowly. If you need speed, you can try using the OpenGL package.

Doug

On Sun, Jan 10, 2021 at 11:50 PM making-a-racket 
wrote:

> Hello all,
>
> I am embarking upon a project to doing 2D graphics in Racket, so I am
> starting off with various experiments, some of which include testing out
> performance and replicating Processing examples.
>
> I definitely need to do some more reading, but I am wanting to post this
> to get some leads into ensuring I'm utilizing the best performance of the
> racket/draw library and for pointers to portions (or elaborations) of the
> documentation.
>
> In trying to reproducing the LineRendering example that ships with
> Processing, I'm seeing a big performance difference. The Processing sketch
> is:
>
> public void setup() {
>   size(800, 600, P2D);
> }
>
> public void draw() {
>   background(255);
>   stroke(0, 10);
>   for (int i = 0; i < 5; i++) {
> float x0 = random(width);
> float y0 = random(height);
> float z0 = random(-100, 100);
> float x1 = random(width);
> float y1 = random(height);
> float z1 = random(-100, 100);
>
> // purely 2D lines will trigger the GLU
> // tessellator to add accurate line caps,
> // but performance will be substantially
> // lower.
> line(x0, y0, x1, y1);
>   }
> }
>
> My Racket code which attempts to reproduce this example is this:
>
> #lang racket/gui
>
> (require racket/draw)
>
> (define WIDTH 800)
> (define HEIGHT 600)
>
> (define frame (new frame%
>[label "Lines"]
>[width WIDTH]
>[height HEIGHT]))
>
> (define pen (new pen%
>  [color (make-object color% 0 0 0 0.1)]
>  [width 1]
>  [style 'solid]))
>
> (define (paint canvas dc)
>   (send dc set-pen pen)
>   (for ([i (in-range 1)])
> (send dc draw-line
>   (random 0 WIDTH)
>   (random 0 HEIGHT)
>   (random 0 WIDTH)
>   (random 0 HEIGHT
>
> (define canvas (new canvas%
> [parent frame]
> [paint-callback paint]))
>
> (send frame show #t)
>
> (define (loop)
>   (send canvas refresh-now #:flush? #t)
>   (sleep/yield 0.033)
>   (loop))
>
> (loop)
>
> However, I am not able to obtain anywhere near the performance of the
> Processing sketch, which can draw 50,000 lines at about 12-13fps. It can do
> 10,000 at about 40fps. My Racket example can barely do 10,000 lines and is
> definitely below 10fps. I am using Racket CS 7.9 on Windows 10 on an XPS 15
> i7 with dedicated GPU. Even p5.js' performance is well above the Racket
> sample but below the Processing sketch. Another thing that I have noticed
> is that the Processing sketch uses about 90% of the integrated GPU (not the
> dedicated) while Racket only uses about 6% of the integrated GPU. If I try
> to draw 50,000 lines, then Racket (usually) freezes up.
>
> Any thoughts or pointers? If I understood the documentation correctly,
> refresh-now seemed to be the way to get the best frame-by-frame
> performance, but I am certainly still learning. Am I simply hitting the
> performance limit of the racket/draw library or is there something I can do
> to improve things?
>
> I'm still in the programming language/environment selection phase of my
> project, but I would really like to use Racket here.
>
> Thanks for any help!
>
> --
> 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/535064cd-bc10-42fe-a20a-30623d5b4ca3n%40googlegroups.com
> 
> .
>

-- 
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/CACvwowXzwEC9TMc220C9NNc-CR%2B6NJj4A1SXYRCRsp4xKZoebQ%40mail.gmail.com.


lines-animated-canvas.rkt
Description: Binary data


Re: [racket-users] animated plots?

2019-08-30 Thread Doug Williams
Feel free to move it over. I haven't had the opportunity to yet. And yes, I
did used to play Qix.

Doug

On Fri, Aug 30, 2019 at 9:30 AM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Thank Doug,
> That is awesome. Exactly what I was looking for.
>
> Would you mind if I ported the package to the new package server?
>
> I haven't looked at the code properly but I have a feeling you used to
> play Qix :)
>
> Stephen
>
>
>
> On Fri, Aug 30, 2019 at 3:54 PM Doug Williams <
> m.douglas.willi...@gmail.com> wrote:
>
>> Here is a simple 3D animation using the plot package and my
>> animated-canvas package.
>>
>> On Fri, Aug 30, 2019 at 8:45 AM Stephen De Gabrielle <
>> spdegabrie...@gmail.com> wrote:
>>
>>> Hi,
>>> does anyone know if it is possible to create animated plots with
>>> `(require plot)`?
>>>
>>> Kind regards
>>> stephen
>>>
>>> --
>>> 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/CAGHj7-Jpdn0ROvAguURJ1gzO4xQd0QcTsc-tfT4WWYVVcKFSDQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/racket-users/CAGHj7-Jpdn0ROvAguURJ1gzO4xQd0QcTsc-tfT4WWYVVcKFSDQ%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>

-- 
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/CACvwowX7D%3DyhLcsReXt3YQ4tUG%3DJkRf2R%2B%2B6q5YzXWyHXV_tew%40mail.gmail.com.


Re: [racket-users] animated plots?

2019-08-30 Thread Doug Williams
Here is a simple 3D animation using the plot package and my animated-canvas
package.

On Fri, Aug 30, 2019 at 8:45 AM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Hi,
> does anyone know if it is possible to create animated plots with `(require
> plot)`?
>
> Kind regards
> stephen
>
> --
> 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/CAGHj7-Jpdn0ROvAguURJ1gzO4xQd0QcTsc-tfT4WWYVVcKFSDQ%40mail.gmail.com
> 
> .
>

-- 
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/CACvwowWwnmOYiaYhTyaBWNPV7QX-WE-C1LKX6k0rHVZTZcXurg%40mail.gmail.com.


anim.rkt
Description: Binary data


Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread Doug Williams
I support them in various packages, but I rarely use them, per se. Those
packages would have to be updated, but it wouldn't be a big deal for me.

Doug

On Wed, May 29, 2019 at 9:52 AM Matthew Flatt  wrote:

> Does anyone use single-flonums in Racket?
>
> I don't mean `_float` or `f32vector`s, which convert C `float`s or
> 32-bit array elements into regular double-precision Racket flonums. I
> mean literals like `3.0f0` or functions like `real->single-flonum`,
> which produce a Racket number that uses only 32 bits for arithmetic.
>
> Chez Scheme doesn't support single-precision floating-point numbers,
> and adding them would be a lot of work --- for no benefit, if it turns
> out that no one is using those kinds of numbers.
>
> My guess is that no one uses them currently, because it's rare that
> you'd want to trade speed for *im*precision. Single-flonums in Racket
> are significantly slower than regular flonums, because they're not
> treated as a common case. The only use I can think of, and the one that
> inspired the original experiment, is to try to faithfully replicate a C
> `float` calculation in Racket, but even that possibility has issues.
>
> If no one uses single-precision floats, then I will suggest that we
> remove them from Racket by making numbers like `3.0f0` parse as flonums
> and making `real->single-flonum` raise `exn:fail:unsupported`.
> Obviously, this would be a backward-incompatible change. But if it
> causes little enough trouble, then it could be a good trade to avoid
> problems for Racket CS and future platforms.
>
> --
> 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/5ceeaac9.1c69fb81.118e3.f708SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CACvwowWy-q9Vr_GbBgxhRN9cQwGLk4ZO%3DsntG7yuwaRK%3D71oOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Tensorflow bindings?

2019-02-04 Thread Doug Williams
Also, I hadn't known about the wiki you linked to. I can add my inference
engine and interface to an RDF graph database (Eclipse rdf4j) interface
there.

On Mon, Feb 4, 2019, 9:49 AM Greg Trzeciak  Wasn't it a rhetorical question? :)
>
> Although I don't have use for TensorFlow at the moment - I would love to
> have the FFI bindings ready for when I will finally need it.
> The AI story in Racket at the moment is not as good is it could be:
> https://github.com/racket/racket/wiki/AI
>
>
> On Monday, February 4, 2019 at 5:07:58 PM UTC+1, Matt Jadud wrote:
>>
>> Hi all,
>>
>> https://www.tensorflow.org/install/lang_c
>>
>> Would there be interest/value in having FFI bindings for TensorFlow? If I
>> poke it with a stick, are there others who would be willing to contribute
>> to the development of a package that provided those bindings?
>>
>> I'm getting to the point with a project where I'm going to have to bail
>> out of Racket in order to do some machine learn-y stats work, and I'd
>> rather not have to switch languages just to do the analysis.
>>
>> Cheers,
>> M
>>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Tensorflow bindings?

2019-02-04 Thread Doug Williams
I have a start on them already, but they need work. I don't need them on my
project until the summer and they have been a low priority. I would be
happy to share them with anyone that wants to go at a faster pace.

On Mon, Feb 4, 2019, 9:49 AM Greg Trzeciak  Wasn't it a rhetorical question? :)
>
> Although I don't have use for TensorFlow at the moment - I would love to
> have the FFI bindings ready for when I will finally need it.
> The AI story in Racket at the moment is not as good is it could be:
> https://github.com/racket/racket/wiki/AI
>
>
> On Monday, February 4, 2019 at 5:07:58 PM UTC+1, Matt Jadud wrote:
>>
>> Hi all,
>>
>> https://www.tensorflow.org/install/lang_c
>>
>> Would there be interest/value in having FFI bindings for TensorFlow? If I
>> poke it with a stick, are there others who would be willing to contribute
>> to the development of a package that provided those bindings?
>>
>> I'm getting to the point with a project where I'm going to have to bail
>> out of Racket in order to do some machine learn-y stats work, and I'd
>> rather not have to switch languages just to do the analysis.
>>
>> Cheers,
>> M
>>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Questions about plot

2018-12-05 Thread Doug Williams
Matt,

I have done many extensions to plots for a variety of reasons. Most of my
extensions are a third option: Build on dc%. I typically make a new widget,
say based on a horizontal or vertical panel with one or more embedded
canvases. Then I use plot/dc to render directly on those canvases. I can
easily aligned multiple plots, add additional elements outside the plots
(in other embedded canvases), or overwrite the plot as I want. This works
great for plots that are embedded in graphical programs - I do a lot of
analysis work that way. I assume you could use plot/pict in a similar
manner, but I never have.

I'm not sure that helps your particular scenario. I would be glad to point
you to code snippets.

Doug

On Wed, Dec 5, 2018 at 4:22 PM Matt Jadud  wrote:

> Hi all,
>
> If I want to develop a new plot type, would I do best to:
>
> 1. Build on plot, or
> 2. Build on pict?
>
> I suspect #1.
>
> If I want to (say) have a number line, I would like to have an x-axis,
> centered in my plot area (vertically), and no y-axis. I've been reading the
> plot code for scatter plots, and I'm not clear where/how, if I were to
> implement in a similar way, where I would override/parameterize for
> changing the axes. (There's near and far axes (bottom and top) in 2D
> renderers, but I don't seem to get to decide where they go vertically in
> the plot space.)
>
> Then, would I be drawing to it using the utilities built into plot, or do
> I convert to a dc% in some way, and leverage pict, or... ?
>
> In short, I feel like I should be building on plot/extending plot, I don't
> want to reinvent wheels that are already invented, but I'm not yet sure
> where the best starting point is. Do I develop a new plot type, dig deeper
> into how axes are drawn, or do I do everything with overlays, or ...?
>
> Many thanks,
> Matt
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: IEEE 754 single precision float support

2018-04-11 Thread Doug Williams
>
>
> To be clear, I was just mentioning that I use single precision floats in
> our main application that is all written in C++, which is where the
> performance is critical/required. I'm trying to use Racket as a tool for
> understanding how we can maximize accuracy of our numerical algorithms
> under the restriction of single precision floats and the Racket code can be
> significantly slower since it is all intended to be run offline for the
> purposes of understanding how the floating point numbers behave against a
> reference implementation.
>

Have you looked at Neil Toronto's paper Practically Accurate Floating-Point
Math (
https://www.cs.umd.edu/~ntoronto/papers/toronto-2014cise-floating-point.pdf).
It is an excellent paper that discusses the use of Racket to analyze the
accuracy of floating-point computations.

Doug

-- 
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-26 Thread Doug Williams
I hit send a bit too fast. Here is the code (from the animate-canvas
package on PLaneT) for the 3D animation.

On Mon, Mar 26, 2018 at 8:39 AM, Doug Williams <m.douglas.willi...@gmail.com
> wrote:

> Another thing I like to do is to animate such plots. The plot package is
> (generally) fast enough to do this. This code uses my animated-canvas%
> package, which is still on planet. I've also attached a gif of it. [I had
> never used the animated gif routines in Racket before, but they were pretty
> easy to use.] I've also attached an an animation of one of the 3D plots
> from the plot manual.
>
> animation.rkt - Sanjeev's plot animated
> animation.gif - the animated gif (so you don't actually have to run the
> code to see the results)
>
>
> On Fri, Mar 23, 2018 at 3:17 PM, Sanjeev Sharma <throw...@gmail.com>
> wrote:
>
>> I've done no math in 20 years - used to do tons (with the not so great
>> graphics of the time) saw this intriguing plot & banged my head against a
>> wall for a couple of hours.
>>
>> Then I just settled down & read the manual systematically, pretending it
>> may have some info,  followed the examples and voila
>>
>> (require plot)(plot-new-window? #t)
>> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
>> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
>> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>>
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


anim.rkt
Description: Binary data


Re: [racket-users] Writing binary data

2016-10-18 Thread Doug Williams
David pointed out that I failed to do a reply all when I pointed him to the
packed-binary package on PLaneT that does what he wants. Here is the text
of that post in case anyone else ever needs it.

I have a packed-binary package on PLaneT that we use for for reading binary
data based on a similar capability in Python. It can read or write from
byte strings or directly to/from binary files. It uses format strings to
define the data types to read:

Character

C Type

Racket

x

pad byte

no value

c

char

char

b

signed char

integer

B

unsigned char

integer

h

short

integer

H

unsigned short

integer

i

int

integer

I

unsigned int

integer

l

long

integer

L

unsigned long

integer

q

long long

integer

Q

unsigned long long

integer

f

float

real

d

double

real

s

char[]

string

and for byte order, size, and alignment:

Character

Byte Order

Size and Alignment

@

native

native

=

native

standard

<

little endian

standard

>

big endian

standard

!

network (big endian)

standard
The documentation is at https://planet.racket-lang.
org/package-source/williams/packed-binary.plt/1/5/planet-doc
s/packed-binary/index.html.

And the PLaneT entry is at https://planet.racket-lang.
org/display.ss?package=packed-binary.plt=williams=2.

On Mon, Oct 17, 2016 at 6:38 PM, David Storrs 
wrote:

> What is the best way to write binary data such that I have control of the
> representation?  Basically, I want the Racket equivalent of the Perl 'pack
> ' and 'unpack
> '
> functions, where I can do:  pack('C', 202) and get back a one-byte binary
> representation of the decimal number 202 (or pack('s', 202) to get a 2-byte
> version) that I could then write to a port.
>
> The reason that I'm looking for this is that I'm going to be writing
> binary data across the network and I want to be able to control the
> representation.  For a fairly trivial example, I want to be able to decide
> how many bytes the number 202 should take up.[1]   Furthermore, I'd like to
> have an easy way to do quick and dirty testing; I thought that writing to a
> byte string would be that way, but I'm not having much success with it, as
> I haven't figured out how to make things go in as raw bytes instead of
> strings.
>
> I've looked at fasl, binary-class, the implementation of protobuf, and
> everything in the racket-lang docs that I could think of keywords for, with
> no luck.  This feels like it should be a straightforward task, so I'm
> frustrated with myself for not figuring it out more quickly.
>
>
> [1] I keep using the number 202 because that's the size of one particular
> message that I'm using in my text script and I'm trying to do RLE on it.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Windows and librsvg-2-2.dll

2016-09-26 Thread Doug Williams
Here is a very simple test that just loads an SVG icon from a file and
displays it. This runs on my 32-bit version on Racket Version 6.6 (under
Windows 10) with the above dlls above. I also included a screen shot.

Doug

On Mon, Sep 26, 2016 at 3:54 PM, Doug Williams <m.douglas.willi...@gmail.com
> wrote:

> I downloaded librsvg-2.40.1-2-w32-bin.zip from https://sourceforge.net/
> projects/ezwinports/files/. This contains the file librsvg-2-2.dll and
> all of its dependencies (18 total dlls). When run with the 32-bit version
> of Racket (version 6.6) and the rsvg module, this seems to work fine. I
> assume I would have to recompile them from source, which is also included
> at ezwinports, for a 64-bit version.
>
> I didn't try a new build script with the dependencies. Many of the
> dependencies are included with Racket already - I assume because it uses
> Cairo internally. So, it may not be that many new ones to add. I haven't
> tracked that down. Would native support for SVG be worth the additional
> libraries?
>
> Doug
>
> On Mon, Sep 26, 2016 at 3:35 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
>
>> In case you haven't noticed already, many of the relevant libraries are
>> distributed with Racket in the "lib" directory. I think they're
>> probably compiled in a way that's compatible with most
>> "librsvg-2-2.dll" builds, but if not, the best approach may be to start
>> with the compilation script in "racket/src/native-libs" and add entries
>> for new libraries, then cross-compile on a Unix system with MinGW.
>>
>> At Mon, 26 Sep 2016 14:31:34 -0600, Doug Williams wrote:
>> > I have been tracking them down, too. When I get back home I can send the
>> > list I have. I found the dependencies at exwinports on Sourceforge.
>> But, I
>> > haven't had time to try it yet.
>> >
>> > On Sep 26, 2016 10:44 AM, "Lehi Toskin" <lehi.tos...@gmail.com> wrote:
>> >
>> > > Using Dependency Walker, it says I'm missing a whole lot of system
>> files.
>> > > I'll have to investigate this thoroughly.
>> > >
>> > > --
>> > > 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.
>> > > For more options, visit https://groups.google.com/d/optout.
>> > >
>> >
>> > --
>> > 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.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


svg-test.rkt
Description: Binary data


Re: [racket-users] Windows and librsvg-2-2.dll

2016-09-26 Thread Doug Williams
I downloaded librsvg-2.40.1-2-w32-bin.zip from
https://sourceforge.net/projects/ezwinports/files/. This contains the file
librsvg-2-2.dll and all of its dependencies (18 total dlls). When run with
the 32-bit version of Racket (version 6.6) and the rsvg module, this seems
to work fine. I assume I would have to recompile them from source, which is
also included at ezwinports, for a 64-bit version.

I didn't try a new build script with the dependencies. Many of the
dependencies are included with Racket already - I assume because it uses
Cairo internally. So, it may not be that many new ones to add. I haven't
tracked that down. Would native support for SVG be worth the additional
libraries?

Doug

On Mon, Sep 26, 2016 at 3:35 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> In case you haven't noticed already, many of the relevant libraries are
> distributed with Racket in the "lib" directory. I think they're
> probably compiled in a way that's compatible with most
> "librsvg-2-2.dll" builds, but if not, the best approach may be to start
> with the compilation script in "racket/src/native-libs" and add entries
> for new libraries, then cross-compile on a Unix system with MinGW.
>
> At Mon, 26 Sep 2016 14:31:34 -0600, Doug Williams wrote:
> > I have been tracking them down, too. When I get back home I can send the
> > list I have. I found the dependencies at exwinports on Sourceforge. But,
> I
> > haven't had time to try it yet.
> >
> > On Sep 26, 2016 10:44 AM, "Lehi Toskin" <lehi.tos...@gmail.com> wrote:
> >
> > > Using Dependency Walker, it says I'm missing a whole lot of system
> files.
> > > I'll have to investigate this thoroughly.
> > >
> > > --
> > > 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.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > 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.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Windows and librsvg-2-2.dll

2016-09-26 Thread Doug Williams
I have been tracking them down, too. When I get back home I can send the
list I have. I found the dependencies at exwinports on Sourceforge. But, I
haven't had time to try it yet.

On Sep 26, 2016 10:44 AM, "Lehi Toskin"  wrote:

> Using Dependency Walker, it says I'm missing a whole lot of system files.
> I'll have to investigate this thoroughly.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Fwd: Re: [racket-users] What limits would you put on racket?

2015-07-26 Thread Doug Williams
I also forgot to reply to the list.
-- Forwarded message --
From: Doug Williams m.douglas.willi...@gmail.com
Date: Jul 23, 2015 9:21 AM
Subject: Re: [racket-users] What limits would you put on racket?
To: Sayth Renshaw flebber.c...@gmail.com
Cc:

If you're strictly comparing Racket to other Lisp dialects, I would say
there is never any reason to go to a different Lisp dialect. The main
exception would be if there is some specific, existing capability in a
different language that you require. But, that is not a dialect issue.

I regularly use Racket for complex analysis tasks. The mathematic and
plotting capabilities available are superior  (in my opinion) to other
dialects.

Your mileage may vary.

Doug Williams
On Jul 22, 2015 11:51 PM, Sayth Renshaw flebber.c...@gmail.com wrote:

 Hi

 Just getting reacquainted with Racket going back through HTDP 2nd edition
 and the edx intro course.

 Is there a point where you would say yeah Racket shouldn't go there, it's
 best at A B or C you should go to Chez, Sbcl, CCL etc.

 Sayth

 --
 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.
 For more options, visit https://groups.google.com/d/optout.


-- 
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.
For more options, visit https://groups.google.com/d/optout.