[racket] Reading drracket files into text%

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Aug 31 15:19:43 EDT 2010

Ah. Well, I guess the right thing to do is to just chop the first
three lines out of the file. You should probably check for some
keyword in the header file to make sure that it really is the header
generated by drracket.

If the file contains images, then the three lines of header will be
encoded in drracket's funny format. So you can just use load-file and
then do the chopping at the text% level. (This path will work
regardless of the save file format, so probably you want to just use
it all the time.)

Let me know if you'd like some example code (if Matthias's isn't sufficient).

Robby

On Tue, Aug 31, 2010 at 2:13 PM, Ryan Golbeck <rmgolbec at cs.ubc.ca> wrote:
> I'm modifying the handin-server collection to include an option where
> our students can retrieve "starter" files for assignments and labs.
> Since these files will be saved on the server directly from DrRacket,
> rather than through the handin infrastructure, the files include these
> three lines of meta data.
>
> I was hoping to use pretty much the same infrastructure already
> provided in the handin-server and client to transmit the files, so I
> was trying to massage the starter files into the same format that the
> client already expects when it retrieves a submitted assignment.  So,
> I'm running into the problem that these first three lines are in files
> saved by DrRacket, but not in files that the handin-server saves for a
> submitted assignment.
>
> So I don't specifically have to read it into a text% object.  But I'm
> not sure the best way to handle them.
>
> Thanks for the help!
> -ryan
>
> On Tue, Aug 31, 2010 at 12:10 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> You have to specially remove those lines yourself in that case.
>>
>> But if you say a little more about why you want to read something into
>> a text% object, I may give a different answer (it isn't clear what you
>> want to do with this stuff).
>>
>> Robby
>>
>> On Tue, Aug 31, 2010 at 1:49 PM, Ryan Golbeck <rmgolbec at cs.ubc.ca> wrote:
>>> What's the proper way to read a file produced by DrRacket into a text% object?
>>>
>>> Using load-file produces problems when DrRacket has created a file
>>> where the first three lines contain meta data information about the
>>> language to use.
>>>
>>> Thanks,
>>> -ryan
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/users
>>>
>>
>>
>


Posted on the users mailing list.