| f/ Improved (a) |
initial writing: 2005-09-23 last updated: 2005-09-23 |
If f is atomic then f/ on y where y has no items (that is, 0=#y) will attempt to determine the neutral of f . Therefore, in many cases f/y will now give a sensible answer instead of signalling a domain error. For example:
(+-*)"0/ i.0 0
The process of determining the neutral of atomic f is modelled by the adverb neutral .
neutral=: 1 : 0
assert. 0 0 -: }. u. b. 0
c=. __ _ 0 1
f=. u. ::2:"0
t=. c (f/ , f~/) 0 1
assert. ($t) -: 2*(#c),1
assert. 0 1 e. t
(t i. 0 1) { ,~c
)
+ neutral
0
* neutral
1
>. neutral
__
(+-*)"0 neutral
0
^. neutral
|assertion failure: neutral
| 0 1 e.t