Hi, * sbp thought of doing an arithmetic built-in next: cwm_math.py * tim says go ahead! Done, <<cwm_math.py>>. CWM can now do addition, multiplication, subtraction, division, remainders, negation, exponentiation, count the members in a DAML list, and do the normal truth checking functions, only sub classed for numeric values (cf. list of actual property names [1]). I hope you don't mind, but I simply nicked a SWAP namespace:- http://www.w3.org/2000/10/swap/math# I've written up the schema, and attached it as <<math.n3>>. The test file is also attached as <<math-test.n3>>, the output as <<math-test-out.n3>> (command line at [2]). The "biggest" test is:- [[[ { :x math:sumOf ([ math:quotientOf ("7" "2") ] [ math:exponentiationOf ([ math:remainderOf ("7" "2")] "10000000") ] [ is math:memberCount of ("a" "b" "c" "d" "e") ]) } log:implies { :x :valueOf "(7 / 2) + ((7 % 2)^10000000) + 5 [should be 9.5]" } . ]]] which gives the correct output:- [[[ "9.5" :valueOf "(7 / 2) + ((7 % 2)^10000000) + 5 [should be 9.5] . ]]] <<llyn.py>> is also attached, since I needed to modify it to recognize the built-ins. Note also the development process [3]. Cheers, [1] List of the properties: sumOf, differenceOf, productOf, quotientOf, remainderOf, negationOf, exponentiationOf, memberCount, greaterThan, notGreaterThan, lessThan, notLessThan, equalTo, notEqualTo. [2] python cwm.py math-test.n3 -think -purge > math-test-out.n3 [3] http://ilrt.org/discovery/chatlogs/rdfig/2001-12-01.txt 01:20:58 -- Kindest Regards, Sean B. Palmer @prefix : <http://webns.net/roughterms/> . :Sean :hasHomepage <http://purl.org/net/sbp/> .
This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:14 GMT