[plt-scheme] how to creating a new "primitve type"

From: YC (yinso.chen at gmail.com)
Date: Tue May 8 15:44:58 EDT 2007

Hi all -

say that I want to create a new primitive type (something like path or
string) so it has the first class status (for the lack of a better term) as
the other primitive types.  How is this done, and Is this doable only in
scheme or does it involve working on C code?

Example - social security number.

> (define s1 #ssn"123-45-6789")
> s1
> (ssn->string s1)
> (ssn? s1)
> (equal? s1 #ssn"123-45-6789")
> (equal? s1 #ssn"987-65-4321")

Any pointer is appreciated ;)  Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070508/e835dcf9/attachment.html>

Posted on the users mailing list.