[plt-scheme] frtime

From: geb a (geb_a at yahoo.com)
Date: Wed Jan 16 18:11:26 EST 2008

Thanks for the help!  I'll try that.


--- Gregory Cooper <greg at cs.brown.edu> wrote:

> Hi,
> 
> Since picture->file uses imperative I/O, it's
> probably best to keep
> this module in MzScheme and then lift / import the
> procedures you need
> into the FrTime program.  For example,
> 
> (require (lifted "camera01.ss" make-camera
> picture->file))
> 
> in FrTime should allow you to define a camera with
> time-varying
> properties, and the picture should change
> automatically when the
> camera's properties change.
> 
> Let me know if you run into any problems.
> 
> Cheers,
> Greg
> 
> On 1/16/08, geb a <geb_a at yahoo.com> wrote:
> > Hello,
> > I am trying to convert the following module to
> frtime
> > but I've run into several difficulties mainly
> > resolving the differences between mzscheme and
> frtime.
> > I was trying to set up a pipe between the camera
> and
> > output string but was unable to get it to compile.
> >
> > The purpose of the code is to provide an output
> string
> > holding a current photograph at any given instant.
> > Does it even make sense to use Frtime for this
> > purpose?
> >
> > Thank you in advance for all of your help.  I
> really
> > appreciate all of the past support.
> >
> > (module camera01  mzscheme
> >
> >   (require  (lib "url.ss" "net")
> >             (lib "etc.ss")
> >             (lib "process.ss"))
> >
> >   (define-struct camera (ip type direction mode
> > resolution quality interval size preset language
> ))
> >   ;a camera is a structure where ip..language are
> > strings ; deleted for brevity...
> >
> >   ;camera->string: camera -> string
> >   ;takes a camera and produces a string that
> > represents the required state of the camera.
> >   (define (camera->string a-camera)
> >     (string-append "http://"
> >                    (camera-ip a-camera)
> >                    "/"
> >                    (camera-type a-camera)
> >                    "?Mode=" (camera-mode a-camera)
> >                    "&Direction=" (camera-direction
> > a-camera)
> >                    "&Quality=" (camera-quality
> > a-camera)
> >                    "&Resolution="
> (camera-resolution
> > a-camera)
> >                    "&Interval=" (camera-interval
> > a-camera)
> >                    "&Size=" (camera-size a-camera)
> >                    "&PresetOperation="
> (camera-preset
> > a-camera)
> >                    "&Language=" (camera-language
> > a-camera)))
> >
> >
> >   (define camera1 (make-camera "10.1.50.1"
> > "SnapshotJPEG" "" "Refresh"  "640x480" "Clarity"
> "10"
> > "STD" "Move" "0"))
> >
> >
> >   (define (picture->file a-camera)
> >     (local [(define in (get-pure-port
> > (string->url(camera->string a-camera))))
> >             (define (read-loop out input)
> >               (let ([byte (read-byte input)])
> >                 (cond
> >                   [(eof-object? byte)
> > (close-input-port input)]
> >                   (else (begin
> >                           (write-byte byte out)
> >                           (read-loop out
> input))))))]
> >
> >       (let ((o (open-output-string)))
> >         (begin
> >           (read-loop o in )
> >           o)))))
> >
> >   ;example usage
> >   (picture->file camera1)
> >
> >
> >
> >
> >      
>
____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile.  Try it now. 
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> >
> > _________________________________________________
> >   For list-related administrative tasks:
> >  
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> 



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


Posted on the users mailing list.