Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. Include all bounds checking you need to write, or explain how the compiler or interpreter creates those bounds checks for you.

 
NB. z locale by default on path.
type_z_=: 3!:0
nameClass_z_=: 4!:0
signalError_z_=: 13!:8
 
NB. create a restricted object from an appropriate integer
create_restrict_ =: monad define
 'Domain error: expected integer' assert 1 4 e.~ type y  NB. or Boolean
 'Domain error: not on [1,10]' assert (0 -.@:e. [: , (0&<*.<&11)) y
 value=: y
)
 
add_restrict_=: monad define
 if. 0 = nameClass<'value__y' do.
  (value + value__y) conew 0{::coname''
 else.
  'value unavailable'signalError 21
 end.
)
 