Here's my shot using generators. It's probably much slower than yours
due to all the continuation jumps. This way keeps all four states in
your "state machine" in one place.
;;
(require racket/generator)
(define (list-of-ranges-of-ones v)
(define vec (append (vec
(What's racket's policy on posting our own work to the mailing
list? Sorry if this seems like spam.)
(planet gcr/render-pdf) now implements more of the libpoppler
glib API. You can now render PDF files to picts or bitmap%s,
gather the locations of all letters on the page, or can search
for strings
The other answers covered plotting, but for picts from the
slideshow library (for example, those returned by plot/pict), you
can use (show-pict some-pict) from slideshow/pict, which will
display that pict in a new frame.
One hour ago, prad wrote:
> i'm not using drscheme.
>
> how do i display thi
Yes! Hear, hear! Having to explicitly write all the references
out and get their types right is a pain point for me. Maybe it's
encouraged by the design recipe, but sometimes I get jealous of
languages like Clojure, which (from what I understand) would let
me write something like this:
;; initials
bitmaps first, but doing so in a portable way.
Maybe it's best to provide both ways? Making a pdf-page->bitmap%
function with the kosher bitmap% get-handle way, and a
render-pdf-to-dc! function. I'll investigate this.
8 hours ago, Jens Axel Søgaard wrote:
> 2012/5/8 Michael W :
>
cairo contexts...
16 minutes ago, Eli Barzilay wrote:
> Three hours ago, Michael W wrote:
> >
> > I'm not rasterizing to a bitmap% or anything like that. Instead,
> > I'm asking poppler to draw directly to the dc<%>'s cairo context
> > (Eli and
Note: You need a fairly recent build of DrRacket.
> The latest stable release is not new enough.
>
> /Jens Axel
>
> 2012/5/7 Michael W :
> > This is wonderful. Do you mind if I publish a planet package
> > using this code?
> >
> > 2 months a
This is wonderful. Do you mind if I publish a planet package
using this code?
2 months ago on Sunday, Mar 18, 08:29AM, Jens Axel Søgaard wrote:
> 2012/3/17 Neil Van Dyke :
> > Jens Axel Søgaard wrote at 03/17/2012 09:17 AM:
> >
> >> Is it possible to display pdfs in snips without converting them t
Here's a solution based on for/fold that hasn't been suggested
yet. Runs in O(n) time.
(let-values ([(results last-sum)
(for/fold ([sofar '()]
[value 1])
([i (in-range 2 22)])
(values (cons value sofar)
Using 'eval' is really slow; I suspect that's what's killing your
performance here. Also, parsing a string to an expression every
time might hurt too.
Here's my crack at it:
https://gist.github.com/2462109
This one takes 36 seconds on my laptop. Memory usage is pretty
constant at about 33M. (Sorry
Hey, Racketeers!
So I have a program that does a bunch of expensive image
processing, but I want it to interactively draw its results to a
canvas% as it runs.
Only problem is events: I also want it to, say, stop right when I
close the window or furiously mash Esc, for example.
I've found that th
hack to emulate web socket style two-way
> communication.
>
> On 2012-03-29, at 7:18 PM, Michael W wrote:
>
> > So is it possible to disable the timeout on the web server? Or is
> > this a /very bad idea/?
> >
> > Right now I'm constructing my own dis
So is it possible to disable the timeout on the web server? Or is
this a /very bad idea/?
Right now I'm constructing my own dispatcher chain with the
low-level server API. My intent is to build a streaming HTTP
service similar to the Twitter streaming API that will send a
short one-line message to
I'd also love to know if there's a better way. A
bitmap%->opengl-tex-handle function would be absolutely
scrumptious.
Part of the reason seems to be that Racket stores images as ARGB
bytes, but OpenGL doesn't support that, hence the need for all
the byte swizzling.
For what it's worth, I have som
x) (in-vector b (max 0 (- x 1))(min s (+ x 2]
[n (for*/sum ([R (s board r)] [C (s R c)]) C)])
(if (if (positive? C)
(<= 3 n 4)
(= 3 n))
1 0)
12 minutes ago, Michael W wrote:
&g
Hey there! Inspired by this article, I tried (quite
unsuccessfully) to make a very short, very contrived Game of
Life just for fun.
http://news.ycombinator.com/item?id=357938
How can we make this shorter?
; 8< ;; 8< ;;
#lang racket
(define glider
'((0 0 0 0 0 0
5 hours ago, Eli Barzilay wrote:
> That is completely incorrect. There is nothing special about
> quasiquotes that makes them more resistant to injection over any kind
> of other templates.
Pardon?
Now I'm curious. Xexprs *know* they're XML, so they escape normal
strings like you'd expect -- I
the rsound package directly, and either split
> > your package in two to reduce dependencies or just live with a
> > possibly unnecessary dependency.
>
> +1
>
> Also, from a reusability perspective, I think Michael W has the right
> idea with producing a few related-but-sepa
Hello everyone!
I'm making an Ogg Vorbis library for racket, and it's convenient
to also be able to convert Ogg files to rsounds for (planet
clements/rsound). To this end, I have an rsound-compat module in
my package.
Not everyone who uses my package will want to pull down (planet
clements/rsound
Hey there, Neil!
When racket allocates something, it lives in memory that's
managed by the garbage collector unless you say otherwise. By
contrast, when the C library allocates something, racket's
garbage collector has no clue about it -- that's what (free) is
for.
By default, (malloc) allocates
Hey there!
After struggling to document my first planet package, I find that
either Scribble or PLaneT is incorrectly rendering the links in
my package documentation's table of contents. Is this a bug or am
I doing something wrong?
To see the issue, visit:
http://planet.plt-scheme.org/package-sou
y can't you just use an input specification for the pointer?
>
> (_ fun [vf : (_ptr i _OggVorbis_File)])
>
> As long as you can define the OggVorbis_File struct with the ffi.
>
> If not your solution is probably fine.
>
> On 01/22/2012 03:59 PM, Michael W wrote:
> >
([file (malloc)])
> (cpointer-push-tag! file _OggVorbis-file-pointer
> file)
>
> On 01/22/2012 02:14 PM, Michael W wrote:
> > Hello!
> >
> > In the FFI library, is there a way to cast one pointer type
> > straight to another? I'm working with
Hello!
In the FFI library, is there a way to cast one pointer type
straight to another? I'm working with libvorbisfile (PLaneT
package forthcoming) which expects me to allocate my own
OggVorbis_File cstruct and pass that everywhere.
I ask because (malloc _OggVorbis_File) returns a _pointer, not a
Yes, I think so. collects/mred/private/mrcanvas.rkt:205 defines
the on-paint method in canvas% as:
(lambda ()
(if (eq? paint-cb default-paint-cb)
(super-on-paint)
(paint-cb this (get-dc
where paint-cb is a field that takes paint-callback.
2 hours ago, Justin Zamora wrote:
st-ref a 4)
(list-ref a 5) (list-ref a 6))]
[(close) (close)])))
Note the changed list-ref numbers.
Or, here's the pull request: https://github.com/plt/racket/pull/68
24 minutes ago, Michael W wrote:
> Wow, that's really fast! Thanks for looking into this.
&
%' class now has a `text-outline' method (as of the latest in
> the git repo).
>
> At Sun, 25 Dec 2011 00:00:44 -0700, Michael W wrote:
> > Merry Christmas, Racketeers!
> >
> > Is there an easy way to draw text to a bitmap% with a gradient?
> >
> &g
Merry Christmas, Racketeers!
Is there an easy way to draw text to a bitmap% with a gradient?
I briefly looked into adding linear-gradient% and
radial-gradient% support to slideshow/pict but unfortunately we
can't draw text using an arbitrary brush% as the draw-text method
of dc% ignores that.
My
Hey there, Racketeers! Hope you're having a nice thanksgiving if
you're in America.
(send) supports apply-style calling by calling it with a dotted
parameter. How can I call a method with a list of *keyword*
arguments? I essentially want to do keyword-apply but on a
method, and I don't quite have
Hello! Thanks for making racket! It's the coolest.
The web server template documentation:
http://docs.racket-lang.org/web-server/templates.html has several
great examples of templates, but it doesn't mention whether
strings included in templates are entity-escaped XML or not.
More seriously, sear
30 matches
Mail list logo