<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16441" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=yinso.chen@gmail.com href="mailto:yinso.chen@gmail.com">YC</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=jos.koot@telefonica.net
href="mailto:jos.koot@telefonica.net">Jos Koot</A> ; <A
title=plt-scheme@list.cs.brown.edu
href="mailto:plt-scheme@list.cs.brown.edu">PLT Scheme List</A> ; <A
title=nikander@nc.rr.com href="mailto:nikander@nc.rr.com">Robert Nikander</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, June 11, 2007 12:47
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [plt-scheme] (typeof
obj)</DIV>
<DIV><BR></DIV>
<DIV>This is something I wonder as well... given that internally Scheme *does
know* about the type of a value, why isn't there a function that expose the
information? Type-based dispatching is after all a legitimate
development technique. </DIV></BLOCKQUOTE>
<DIV><FONT face=Arial><FONT size=2><FONT face=Arial size=2>I am not
sure whether or not Scheme *does know* THE type of a value. I am sure
the PLT team has more knowledge of that. My way of looking at it is that there
are predicates that know whether or not a value satisfies them. Furthermore
there is the question how far you want to go in specifying the type. Is a list
of numbers simply a list or is it 'a list of numbers'? The number of predicates
you may think of is unlimited.</FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>Jos Koot</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>Thanks,<BR>yinso <BR><BR></DIV>
<DIV><SPAN class=gmail_quote>On 6/10/07, <B class=gmail_sendername>Jos
Koot</B> <<A
href="mailto:jos.koot@telefonica.net">jos.koot@telefonica.net</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>-----
Original Message -----<BR>From: "Robert Nikander" <<A
href="mailto:nikander@nc.rr.com">nikander@nc.rr.com</A>><BR>To: "PLT
Scheme List" <<A href="mailto:plt-scheme@list.cs.brown.edu">
plt-scheme@list.cs.brown.edu</A>><BR>Sent: Sunday, June 10, 2007 6:28
PM<BR>Subject: [plt-scheme] (typeof obj)<BR><BR><BR>> Is there a way to
get a type-name symbol or type object for any scheme<BR>>
object?<BR><BR>Of course there is a way, but you may not like
it:<BR><BR>(define (types-of x) (filter identity (map (lambda (predicate
typename) (and<BR>(predicate x) type-name)) predicates
type-names)))<BR>(define predicates (list integer? procedure?, etc)
<BR>(define type-names '(integer procedure, etc))<BR><BR>Of course the
procedure returns a list of types, for a 1 is an integer, a<BR>rational, a
real and a complex number.<BR>You also can think of adapting procedure
make-struct-type, such as to add their <BR>predicates and names to the
lists.<BR>Same for define-struct, let-struct ...<BR>Same for
classes.<BR><BR>If you want only one type returned in stead of a list, two
conditions must be<BR>met:<BR>First: for every two types A and B either A
and B disjunct or A a subset of B or <BR>B a subset of A.<BR>Second:
carefully compose the lists of predicates and their names.<BR>Jos
Koot<BR><BR>><BR>> (type 1) => 'integer<BR>><BR>>
or<BR>><BR>> (type 1) => #<type integer> <BR>> (type (type
x)) => #<type type><BR>><BR>><BR>> Rob<BR>>
_________________________________________________<BR>> For
list-related administrative tasks:<BR>> <A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A><BR>><BR><BR>_________________________________________________<BR> For
list-related administrative tasks:<BR> <A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>