The "assert" monad can be improved as follows:

assert=: 13!:8 @ ($&12) @ (0 e. ,)



----- Original Message ----- 
From: "Miller, Raul D" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Wednesday, April 19, 2006 8:18 AM
Subject: RE: [Jprogramming] constraint idioms

Roger Hui wrote:
> Asserts have advantages over your proposed technique:
> - It's clearer what asserts are doing.
> - It's possible to turn asserts on and off (9!:34 and 9!:35).
> On the other hand, asserts require the use of
> explicit definition.  Both techniques are better than 

I suspect you've forgotten about the assert monad:

   assert
0 0"_ $ 13!:8^:((0: e. ])`(12"_))
   assert 1
   assert 0
|assertion failure: assert
|       assert 0
   9!:34''
1
   9!:35]1
   assert 0
|assertion failure: assert
|       assert 0


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to