IIRC if. y do.
is false only if the leading atom of y is 0, otherwise it is true. it
should be already documented in J dictionary help file.


On Sun, Jun 21, 2020, 7:25 AM Paul Jackson <plj...@gmail.com> 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

Reply via email to