"tacit if" behaves more rationally... returns/keeps the null.
'no'"_`('yes'"_)@.] ''
'no'"_`('yes'"_)@.({.!.0) ''
no
On Saturday, June 20, 2020, 07:25:48 p.m. EDT, Paul Jackson <[email protected]>
wrote:
I've grown accustomed to following some verbs with '' because there's no
way to write a niladic verb in J. Unfortunately I have a verb that uses its
argument to decide whether to update or not. That led me to learn the hard
way that '' is true.
try=: 3 : 0
if. y do.
'yes'
else.
'no'
end.
)
try ''
yes
I thought I could force a domain error, but no.
try {.''
yes
I thought maybe J was doing {. and that space is non zero, but {.a. is also
true, as was everything else I could think of. This may not constitute a
bug, but it is unexpected behavior.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm