On Sun, Jun 14, 2009 at 7:15 PM, Yuvaraj Athur
Raghuvir<[email protected]> wrote:
> Is there  a J idiom / verb that implements a design-by-contract or
> input partameter type checking? For e.g.  scalar vs vector, boxed vs
> open tests with friendly messages will help particularly when writing
> wrappers to external dlls.

Do you mean something like this?

contract=:1 :'[ ass...@u'
rawtypesmatch=: -:&(3!:0)

isboxed=: a:&rawtypesmatch contract

   isboxed 1 2 3
|assertion failure: assert
|       isboxed 1 2 3
   isboxed ;:'always pick good names'
+------+----+----+-----+
|always|pick|good|names|
+------+----+----+-----+

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

Reply via email to