[Jprogramming] NaN, p., and control structures

Henry Rich henryhrich at gmail.com
Sat Dec 30 04:08:12 UTC 2017


J's position on _. is that it is an abomination and we make no claims 
for what happens when _. appears in an argument and spend no time 
worrying about it.

Henry Rich

On 12/29/2017 10:50 PM, Louis de Forcrand wrote:
> Sorry for not trying this in j806, I should install it on my Mac.
> Will update.
>
> As for control structures treating _. as false, I was mistaken.
> I was actually comparing a float with _., and that returned 0.
> Nevertheless, I think control structures should signal _. instead of silently accepting it, and perhaps even comparison operators? Either that or have comparisons return _. as well. That would probably be more consistent.
>
> Louis
>
>> On 29 Dec 2017, at 22:41, bill lam <bbill.lam at gmail.com> wrote:
>>
>> This is what I got from J806
>>    foo
>> 3 : 0
>> if. _ - _ do.
>> echo 1
>> else.
>> echo 0
>> end.
>> EMPTY
>> )
>>    foo''
>> |NaN error: foo
>> |   _    -_
>>    bar
>> 3 : 0
>> if. _. do.
>> echo 1
>> else.
>> echo 0
>> end.
>> EMPTY
>> )
>>    bar''
>> 1
>>
>> foo is reasonable.
>> bar is also reasonable to me, because _. is not equal 0 so that
>> the condition is true.
>>
>> What is your code that treating _. as false?
>>
>> Also on my J806 linux64
>>    2 7 p.1e308j_
>> _j_
>>
>>
>> Пт, 29 дек 2017, Louis de Forcrand написал(а):
>>> What about control structures treating _. as false?
>>> I personally would make that an error, and I would also say that code that makes use of this should be considered bad style.
>>>
>>> Louis
>>>
>>>> On 29 Dec 2017, at 18:29, Henry Rich <henryhrich at gmail.com> wrote:
>>>>
>>>> Surely not intended.  Put it on the bug list.
>>>>
>>>> Henry Rich
>>>>
>>>> On 12/29/2017 6:06 PM, Louis de Forcrand wrote:
>>>>> On the Indeterminate vocabulary page of the dictionary it is written
>>>>>
>>>>> The only ways to create _. are as follows:
>>>>>    	direct entry of _.
>>>>>    	".
>>>>>    	3!:n
>>>>>    	DLL call (database, LAPACK, etc.)
>>>>>
>>>>> and
>>>>>
>>>>> Primitives on arguments not containing _. signal NaN error instead of producing _. .
>>>>>
>>>>> yet (in j64-805 on macOS 10.10.5)
>>>>>
>>>>>    2 7 p.1e308j_
>>>>> _.j_
>>>>>
>>>>> This is very dangerous, as comparison with _. seems to yield _. and it also seems that control structures treat _. as false instead of signalling an error (which is in my opinion a very bad idea).
>>>>> Are both these behaviours intended?
>>>>>
>>>>> Thanks,
>>>>> Louis
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>>> ---
>>>> This email has been checked for viruses by AVG.
>>>> http://www.avg.com
>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> -- 
>> regards,
>> ====================================================
>> GPG key 1024D/4434BAB3 2008-08-24
>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list