Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread David Storrs
On Mon, Jun 24, 2019 at 5:19 PM Shu-Hung You < shu-hung@eecs.northwestern.edu> wrote: > > > FWIW, (write "foo") writes "\"foo\"" to the file. Maybe you want > write-string or write-bytes? > *facepalm* I think I want a better brain. Thank you. Matthew, thanks for the clarification about ap

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Shu-Hung You
On Mon, Jun 24, 2019 at 4:09 PM David Storrs wrote: > > I actually did try writing something at the extended position, although I > removed it before posting the above. Even with a write, it still does not do > as expected. In fact, the results are even stranger: > > #lang racket > > (define (

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Matthew Flatt
I think that part is because you've opened the file in 'append mode. At the OS level, 'append means "move to the end of the file before each write". So, 'append and `file-position` to extend a file size just don't work helpfully together. I'll improve the docs. At Mon, 24 Jun 2019 17:09:05 -0400

[racket-users] Call for Participation: ICFP 2019

2019-06-24 Thread 'Sam Tobin-Hochstadt' via users-redirect
= Call for Participation ICFP 2019 24th ACM SIGPLAN International Conference on Functional Programming and affiliated events August 18 - August 23, 2019 Berlin, Germany http://icfp19.sigplan.org/ Early Registration until July 1

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread David Storrs
I actually did try writing something at the extended position, although I removed it before posting the above. Even with a write, it still does not do as expected. In fact, the results are even stranger: #lang racket (define (say . args) (displayln (apply ~a args))) (define the-path "./test-fil

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Jon Zeppieri
On Mon, Jun 24, 2019 at 4:51 PM Jon Zeppieri wrote: > > `lseek` docs say: > > > The lseek() function shall allow the file offset to be set beyond the end > > of the existing data in the file. If data is later written at this point, > > subsequent reads of data in the gap shall return bytes with

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Jon Zeppieri
I *think* that the docs are wrong here. `file-position` maps onto `lseek` on posix systems (pretty sure about this after a quick perusal of the code) and `lseek` docs say: > The lseek() function shall allow the file offset to be set beyond the end of > the existing data in the file. If data is la

[racket-users] file-position does not extend file as expected

2019-06-24 Thread David Storrs
Consider the following test script: #lang racket (define (say . args) (displayln (apply ~a args))) (define the-path "./test-file") (when (file-exists? the-path) (delete-file the-path)) (say "before open, file exists?: " (file-exists? the-path)) (let ([the-port (open-output-file the-path #:mode

[racket-users] Re: Creating movable Fonts on a Canvas

2019-06-24 Thread Amir Teymuri
Wow, this is a great blog! Many Thanks! On Monday, June 24, 2019 at 2:52:35 AM UTC+2, Alex Harsanyi wrote: > > Have a look at the `snip%` and `pasteboard%` classes: you can represent > each glyph using a `snip%` and the pasteboard will handle the moving it > with the mouse. You can derive the `