Calculating difference between two numbers

I’m trying to find the difference between two input numbers. i.e. the difference between delivered cherries and rejected cherries and that is going to give me accepted cherries.

'Delivered Cherries': number 'kg'
'Rejected Cherries': number 'kg'
'Type': text
'Accepted Cherries': number 'kg' = diff ( .'Delivered Cherries', . 'Rejected Cherries' )

You use diff for computing the difference between relative numbers, like

'Lead Time': number 'seconds' = diff 'date and time' (
	.'Delivery Time',
	^ .'Creation Time'
)
...
numerical-types
	'date and time' in 'seconds' // relative wrt a starting point, 'in' seconds

The numerical-type 'kg' in your example is for an absolute number. For absolute numbers you can use sum with a sign inversion to compute a difference:

'Accepted Cherries': number 'kg' 
	= sum ( .'Delivered Cherries', - .'Rejected Cherries' )
1 Like