J gurus (and non gurus) many thanks and your suggestions worked!

The parsing rule is what i needed to understand.



Sent from my iPhone

On Apr 15, 2017, at 10:18 AM, chris burke <[email protected]> wrote:

>> Why will it not accept NP in the place of the numeric literal 50?
> 
> "50 1" and "NP 1" are parsed differently:
> 
>   ;: '50 1'
> +----+
> |50 1|
> +----+
> 
>   ;: 'NP 1'
> +--+-+
> |NP|1|
> +--+-+
> 
> There is no rule for executing the noun noun pair in the second example, so
> you need the alternatives already suggested. See the Dictionary for more
> info.
> 
> 
> On Sat, Apr 15, 2017 at 6:41 AM, Michael Goodrich <
> [email protected]> wrote:
> 
>> OK J gurus, I fail to understand what appears to be an irregularity in J:
>> 
>> 
>>   X =. readtable 'X.txt'
>>   shpX =. $X
>>   dimX =. #shpX
>>   NP =. >{shpX
>>   Ones =. NP 1 $ 1
>> |syntax error
>> 
>> readtable => as defined in the primer
>> X.txt a column of 50 numbers one on each line
>> 
>> the idea here is to determine how many numbers are in X which is what NP is
>> set to.  J appears to agree with me that NP is the proper number (and is
>> indeed a number) since:
>> 
>>   NP
>> 50
>>   NP+1
>> 51
>> 
>> 
>> And J is happy if do:
>> 
>>   Ones0 =. 50 1 $ 1
>> 
>> Why will it not accept NP in the place of the numeric literal 50???????
>> 
>> I await your wisdom ...
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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