1 ! Copyright (C) 2005, 2006 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: xml io kernel math sequences strings xml.utilities tools.test math.parser ;
6 PROCESS: calculate ( tag -- n )
8 : calc-2children ( tag -- n n )
9 children-tags first2 >r calculate r> calculate ;
12 children>string string>number ;
22 children-tags first calculate neg ;
24 : calc-arith ( string -- n )
25 string>xml first-child-tag calculate ;
28 "<math><times><add><number>1</number><number>3</number></add><neg><number>-8</number></neg></times></math>"