Hi Thomas,

you can use ⎕INP like this:

TEXT←⎕INP 'END-OF-TEXT' ⍝ the subsequent lines until 'END-OF-TEXT'
1 1 1 0 0 0
1 0 0 0 0 0
0 1 0 0 0 0
1 1 1 1 1 1
0 0 0 1 0 0
0 0 0 0 1 0
'END-OF-TEXT'

MATRIX←⊃⍎¨TEXT

/// Jürgen


On 02/19/2014 07:28 AM, baruc...@gmx.com wrote:
Hi Jürgen,

I  can now solve my first problems from the Project Euler with GNU APL.
I am very happy with that.

But I couldn't figure out how I can directly embed a matrix in a script file
(other than reshapping a huge single-line vector).

For instance, here is my solution in J programming language for problem n° 191 
(Project Euler) :

     matrix =: (". ;. _2) 0 : 0
       1 1 1 0 0 0
       1 0 0 0 0 0
       0 1 0 0 0 0
       1 1 1 1 1 1
       0 0 0 1 0 0
       0 0 0 0 1 0
     )
echo +/ (matrix&(+/ .*)) ^: 29 ] 1 1 0 1 0 0

Is there a way of including such a multiline matrix in a GNU APL script file?

Thank you very much,

best regards,



Reply via email to