W3C home > Mailing lists > Public > www-archive@w3.org > September 2003

Re: [CWM] Trignometric Module

From: Karl Dubost <karl@w3.org>
Date: Wed, 24 Sep 2003 16:00:21 -0400
Cc: www-archive+n3bugs@w3.org, Dan Connolly <connolly@w3.org>, Sandro Hawke <sandro@w3.org>
To: Tim Berners-Lee <timbl@w3.org>
Message-Id: <BAB2C2FC-EEC9-11D7-AD8F-0003934BEBF0@w3.org>


Le mercredi, 24 sep 2003, à 13:18 America/Montreal, Tim Berners-Lee a 
écrit :
>> 	A schema ?
>> 	Should I complete this file?
>> 	http://www.w3.org/2000/10/swap/math.n3
>
> Yes, please.

ok doing that.

>> 	A test file ?
>
> Absolutely.  I suggest a separate one from math.n3
> A good one, with the corner cases you can think of as
> well as "normal" cases.

Right no, I see the following files:

http://www.w3.org/2000/10/swap/test/math/bug1.n3
http://www.w3.org/2000/10/swap/test/math/bug2.n3
http://www.w3.org/2000/10/swap/test/math/math-test.n3
http://www.w3.org/2000/10/swap/test/math/math-test-subset.n3

You suggest that:

http://www.w3.org/2000/10/swap/test/math/trigo.n3 (doesn't exist yet)


> One request.   I assume that the normal mode of operation
> is radians.   Then "degrees" as a function to return a number of 
> degrees
> makes sense.  However one would then expect "radians" to be the
> identity operation.  I suggest you remove math:radians altogether,
> and make math:degrees a Function and ReverseFunction.
> That allows cwm to work either way.

Yes it works in radians. I hope it's correct, I have done that.

class BI_degrees(LightBuiltIn, Function, ReverseFunction):
	"""
	degrees (x)
	Converts angle x from radians to degrees.
	Convert angle x from degrees to radians.
	"""
     def evaluateObject(self, subj_py):
		return degrees(numeric(subj_py))
	def evaluateSubject(self, obj_py):
		return radians(numeric(obj_py))

> You need to import the module from llyn so that it is registered
> as  built-ins.


done. I hope I have done nothing wrong.

In  http://www.w3.org/2000/10/swap/llyn.py revision 1.96

         import cwm_math    # Mathematics
         import cwm_trigo   # Trignometry
....
         cwm_math.register(self)
         cwm_trigo.register(self)

--
Karl Dubost - http://www.w3.org/People/karl/
W3C Conformance Manager
*** Be Strict To Be Cool ***
Received on Wednesday, 24 September 2003 16:00:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:36 GMT