# CWM: Mathematical Built-Ins

From: Sean B. Palmer <sean@mysterylights.com>
Date: Sat, 1 Dec 2001 03:33:21 -0000
Message-ID: <00a201c17a19\$2b544a80\$cc560150@localhost>
To: "Tim Berners-Lee" <timbl@w3.org>, "Dan Connolly" <connolly@w3.org>
Cc: <www-archive@w3.org>
```Hi,

* sbp thought of doing an arithmetic built-in next: cwm_math.py

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
).

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 ). 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 .

Cheers,

 List of the properties: sumOf, differenceOf, productOf,
quotientOf, remainderOf, negationOf, exponentiationOf, memberCount,
greaterThan, notGreaterThan, lessThan, notLessThan, equalTo,
notEqualTo.
 python cwm.py math-test.n3 -think -purge > math-test-out.n3
 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/> .

```
Received on Friday, 30 November 2001 22:35:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:31:39 UTC