Re: [CWM] Trignometric Module

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 UTC