[plt-scheme] problem running clock example for FrTime

From: Scott Hickey (sshickey at qwest.net)
Date: Wed Aug 12 11:33:34 EDT 2009

am working through the paper from 2004 on FrTime. There is a clock demo with sample source which doesn't run in version 4.2.
I think there are two problems.

First, the syntax for match has changed. I tried to update it but I still get the following error.
match: date does not refer to a structure definition in: date

Second,
seconds->date won't work with seconds as an argument. Calling
value-now gets pass the error but I'm guessing that's not going to make
the demo run correctly?


(require scheme/match)
(define clock
  (match (seconds->date (value-now seconds))
    [(struct date (sec min hr day mon yr _ _ _ _))
     (format " ̃a: ̃a: ̃a  ̃a- ̃a- ̃a"
             hr (pad min) (pad sec)
             day (pad mon) (pad (modulo yr 100)))]))

;; pads a number to two digits
(define (pad n)
  (if (< n 10)
      (format "0 ̃a" n)
      (number!string n)))

Thanks,

Scott Hickey
Senior Consultant
Object Partners, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090812/f19ae31c/attachment.html>

Posted on the users mailing list.