<!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.16809" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2>Sorry, on plt-dev now. </FONT><FONT
face="Courier New" size=2>Below is my first trial of math-wrapper with some
tests. Would this come close to what you expect? Comments are
appreciated.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>In the source text of scheme/math sinh and
cosh are commented as real sinh and real cosh, but as far as I can judge they
work for complex numbers too. The documentation of sinh and cosh does not
delimit the argument to be real. The wrapper allows complex
arguments.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>If you are satisfied, I am in for another
simple assignment.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Jos</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>PS Matthias, thanks for your answer to my
question.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>; Typed Scheme wrapper for
scheme/math</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>#lang typed-scheme</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define-type-alias N->N (Number ->
Number))</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(require/typed scheme/math<BR> (pi
Number)<BR> (sqr N->N)<BR> (sgn N->N)<BR> (conjugate
N->N)<BR> (sinh N->N)<BR> (cosh N->N))</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define: (rsgn (r : Number)) :
Number<BR> (unless (real? r) (raise-type-error 'sgn "real"
r))<BR> (sgn r))</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2>(provide<BR> pi<BR> sqr<BR> (rename-out (rsgn
sgn))<BR> conjugate<BR> sinh<BR> cosh)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>#|<BR>Should math not provide
tanh?<BR>(define: (tanh (z : Number)) : Number (* -i (tan (* +i
z))))<BR>(provide tanh)<BR>|#</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>; Some simple tests on
math-wrapper</FONT></DIV>
<DIV><FONT face="Courier New" size=2>#lang typed-scheme<BR>(require
"math-wrapper.ss")<BR>(unless<BR> (and<BR> (= (sqr +i) -1)<BR>
(= (sqr -1) 1)<BR> (= (sgn 0) 0)<BR> (= (sgn -0.1) -1)<BR>
(< (magnitude (- (sinh -i) (* -i (sin 1)))) 1.e-10)<BR> (<
(magnitude (- (cosh -i) (cos 1))) 1.e-10)<BR> (= (conjugate -i)
+i)<BR> (= pi 3.141592653589793)<BR> (eq?<BR>
(call/cc<BR> (lambda: ((cc : (Any ->
Any)))<BR> (define: (exit (x : Any)) : Any (cc
'ok))<BR> (with-handlers ((void exit)) (sgn
+i))))<BR> 'ok))<BR> (error 'math-wrapper-test "check
fails"))</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>----- Original Message ----- </FONT>
<DIV><FONT face="Courier New" size=2>From: "Sam TH" <</FONT><A
href="mailto:samth@ccs.neu.edu"><FONT face="Courier New"
size=2>samth@ccs.neu.edu</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>To: "Jos Koot" <</FONT><A
href="mailto:jos.koot@telefonica.net"><FONT face="Courier New"
size=2>jos.koot@telefonica.net</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Sent: Wednesday, February 25, 2009 2:23
PM</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Subject: Re: [plt-dev] Re: [plt-scheme]
Call for Participation: Writing Typed Scheme wrapper modules</FONT></DIV></DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT></DIV><FONT
face="Courier New" size=2>Jos -<BR><BR>Are you on the plt-dev list? If so,
I'd prefer to do discussion there.<BR><BR>Thanks,<BR>sam th<BR><BR>On Wed, Feb
25, 2009 at 8:06 AM, Jos Koot <</FONT><A
href="mailto:jos.koot@telefonica.net"><FONT face="Courier New"
size=2>jos.koot@telefonica.net</FONT></A><FONT face="Courier New" size=2>>
wrote:<BR>> In the typed-scheme reference I see base types Number and
Integer. I want a<BR>> type for reals, because many numerical functions
accept/return reals but not<BR>> complex numbers. Is this possible?
How?<BR>> Jos<BR>>
_________________________________________________<BR>> For list-related
administrative tasks:<BR>> </FONT><A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme"><FONT
face="Courier New"
size=2>http://list.cs.brown.edu/mailman/listinfo/plt-scheme</FONT></A><BR><FONT
face="Courier New" size=2>><BR>><BR><BR><BR><BR>-- <BR>sam th<BR></FONT><A
href="mailto:samth@ccs.neu.edu"><FONT face="Courier New"
size=2>samth@ccs.neu.edu</FONT></A></BODY></HTML>