Re: [racket-users] IO in racket is painful

2017-07-22 Thread Matthew Butterick
> On Jul 22, 2017, at 12:30 PM, David Storrs wrote: > > One thing that would solve a lot of this issue would be if the pregexp syntax > added support for named captures as in Perl and the PCRE library that exports > them. > > Alternatively, if 'match' made the

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Matthias Felleisen
> On Jul 22, 2017, at 1:34 PM, kay wrote: > > When using 2htdp/image to create a text image, is this possible to specify a > "bounding box" for the image, so that the text could be wrapped to fit that > box? > > E.g., below line: > > (text "This wide, sharp telescopic

Re: [racket-users] IO in racket is painful

2017-07-22 Thread David Storrs
Oh, cool. I did not know about that. Thanks, Jon. On Sat, Jul 22, 2017 at 4:49 PM, Jon Zeppieri wrote: > On Sat, Jul 22, 2017 at 3:30 PM, David Storrs > wrote: > > > > Alternatively, if 'match' made the results of a successful regexp test > >

Re: [racket-users] IO in racket is painful

2017-07-22 Thread Jon Zeppieri
On Sat, Jul 22, 2017 at 3:30 PM, David Storrs wrote: > > Alternatively, if 'match' made the results of a successful regexp test > available to the bodies on the RHS then you could do the same thing by > accessing the result list. Perhaps if match would allow the RHS to be

Re: [racket-users] IO in racket is painful

2017-07-22 Thread David Storrs
One thing that would solve a lot of this issue would be if the pregexp syntax added support for named captures as in Perl and the PCRE library that exports them. Something like this: #lang at-exp racket (define str "[04, foo, 03.5]") (define pat @(pregexp @~a{\[(?\d+),\s*(?\w+),\s*(?[.\d]+)}))

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Neil Van Dyke
Notes on text wrapping/layout for anyone interested... There are a lot of approaches just for wrapping lines of text (even before you get into interacting with other aspects of page layout). The simplest is to assume a fixed-pitch font and a known max character width per line, and just scan

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread WarGrey Gyoudmon Ju
Yes, but you must implement it yourself. This simplest one works for fixed-width font (implemented with pict-lib, you get the idea): (define desc (lambda [txt size width #:head [head (blank 0 0)] #:style [fstyle null]] (define {desc0 txt size width fstyle}

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Robby Findler
This is a function that you'd have to implement yourself. You could break the string up on spaces and then put them beside or above each other, as appropriate. (A real word processing program uses a more complex algorithm that involves adjusting the spaces between words (and possibly elsewhere, I

[racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread kay
When using 2htdp/image to create a text image, is this possible to specify a "bounding box" for the image, so that the text could be wrapped to fit that box? E.g., below line: (text "This wide, sharp telescopic view reveals galaxies scattered beyond the stars of the Milky Way at the northern