$ 1 2 3 4 5
5
+/ 1 2 3 4 5
15
The program outputs a matrix of numbers (not a list of numbers):
$ ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5'
1 5
use enfile to make them into a list of numbers:
+/ , ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5'
15
since:
$ , ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5'
5
or input the whole row to +/ using the rank conjunction:
+/"1 ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5'
15
Note that:
+/ ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5',LF,'1 2 3 4 5'
2 4 6 8 10
and,
+/"1 ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5',LF,'1 2 3 4 5'
15
15
On Thu, Feb 12, 2009 at 1:37 PM, Steven Taylor <[email protected]> wrote:
> +/ 1 2 3 4 5
> 15
>
> +/ ( [: ".;._1 ','&,);._1 LF , '1,2,3,4,5'
> 1 2 3 4 5
>
> Are the numbers still in string format?
>
> Reason: J familiarisation and would like to run some tests.
>
> thanks
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm