<!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><FONT face=Arial size=2>I wonder too, for all that is needed seems to be in
the C code. Chapter 2 of 'Inside PLT MzScheme' gives info on how type info is
recorded 'inside' MzScheme. The following is what I collected from looking
into the doc and the C code: C macro SCHEME_TYPE returns type-info. File
.../src/mzscheme/src/stypes.c enumerates scheme types used inside MzScheme. I
guess it would not be very difficult to add C code that collects the scheme-type
and uses it to collect a type-name from an array of strings. May be elsewhere
such an array already exists, I would not know. Adding a primitive that returns
the string may do what you are looking for. Jos Koot</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<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> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <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 7:49 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [plt-scheme] (typeof
obj)</DIV>
<DIV><BR></DIV>Agreed that it would be implementation dependent, but if the
type info has to be calculated every time on the fly it can be both
inefficient and incorrect (if all values are just bytes, it could satisfy more
than one disjointed types that lead to incorrect semantics), hence I venture
that Scheme value has type attached - but sure would love to be enlightened on
this point. <BR><BR>Regarding whether a list of number is a list or a list of
numbers - I can see that comes up with either predicates or type info, so
don't see a disadvantage one way or another, but predicate-based approach just
makes type dispatching more manual. <BR><BR>Anyhow - just wondering about the
reason(s) not to provide type info - sure love to know the historical design
decisions ;)<BR><BR>Thanks,<BR>yinso<BR><BR>
<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">
<DIV bgcolor="#ffffff"><SPAN class=q>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size-adjust: none; font-stretch: normal"><B>From:</B>
<A title=yinso.chen@gmail.com
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:yinso.chen@gmail.com" target=_blank>YC</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B>
<A title=jos.koot@telefonica.net
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:jos.koot@telefonica.net" target=_blank>Jos Koot</A> ; <A
title=plt-scheme@list.cs.brown.edu
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:plt-scheme@list.cs.brown.edu" target=_blank>PLT Scheme
List</A> ; <A title=nikander@nc.rr.com
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:nikander@nc.rr.com" target=_blank>Robert Nikander</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Monday, June 11, 2007 12:47 AM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><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></SPAN>
<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><SPAN class=sg>
<DIV><FONT face=Arial size=2>Jos Koot</FONT></DIV></SPAN>
<DIV><SPAN class=e id=q_113192334e3c113a_4>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 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 onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:jos.koot@telefonica.net"
target=_blank>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
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:nikander@nc.rr.com"
target=_blank>nikander@nc.rr.com</A>><BR>To: "PLT Scheme List" <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:plt-scheme@list.cs.brown.edu" target=_blank>
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
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme"
target=_blank>
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A><BR>><BR><BR>_________________________________________________<BR> For
list-related administrative tasks:<BR> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme"
target=_blank>
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></SPAN></DIV></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>