Skip to content

Instantly share code, notes, and snippets.

@mflatt
Created June 28, 2017 01:23
Show Gist options
  • Save mflatt/36b7f5f927b50460ea4369d83e5d56f2 to your computer and use it in GitHub Desktop.
Save mflatt/36b7f5f927b50460ea4369d83e5d56f2 to your computer and use it in GitHub Desktop.
(with-output-to-file "testfile.ss"
(lambda ()
(printf "(\n")
(let loop ([i 1000])
(unless (zero? i)
(printf "x ")
(loop (sub1 i))))
(printf ")\n"))
'truncate)
(define sfd
(let* ([ip (open-file-input-port "testfile.ss")]
[sfd (make-source-file-descriptor "testfile.ss" ip)])
(close-port ip)
sfd))
(parameterize (#;[current-make-source-object
(lambda (sfd bfp efp)
(make-source-object sfd bfp efp))])
(call-with-input-file "testfile.ss"
(lambda (in)
(time
(let loop ([j 100000])
(unless (zero? j)
(file-position in 0)
(get-datum/annotations in sfd 0)
(loop (sub1 j))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment