What is the function of the 'assert' keyword in the J programming language? -
what function of combining assert
, -:
in j? under circumstances apply assert
in order proceed? thank much.
assert
name defined verb
assert=: 0 0 $ 13!:8^:((0 e. ])`(12"_))
which looks complicated testing 0
anywhere in vector using (0 e. ])
if there 0 (12"_)
,which way write verb returns 12
no matter argument, sent 13!:8
foreign conjunction signals errors. not surprisingly 12
signals assert
error want having used assert
. 0 0 $
in front assures after error interaction begins on next line.
the monadic form -:
(half) not come play when used assert
. dyadic -:
(match) comes play way see if 2 things match each other , returns 1
if , 0
otherwise. means standard way of using assert
, -:
in form.
assert (expected result) -: (computed result)
if computed result matches expected result there no assert
error, if not assert
error raised. using numerous assert
tests allows test driven development environment.
Comments
Post a Comment