Programming in J 
Author Message
 Programming in J

Question :

I have a question for you in J.
How do you write the following simple APL program in J
[1] "Enter a series of numbers"
[2]  num <- quad
[3]  total <- +/num
[4]  "the total of the series is",total

I would appreciate a reply.
I can not understand why J does not
program as easily as APL.

----------------------- Answer :

read=: 3 : 0
1!:2&2 y.
1!:1[1
)

testread=: 3 : 0
a=:read 'Enter a series of numbers'
'the total of the series is ',": +/ ".a
)

testread''

Enter a series of numbers
2 3 4 5
the total of the series is 14

J programs a little bit differently than other APL:s

Once you learn how to use it you will find that it
programs even better than other APL:s

/Gosi



Sat, 08 Apr 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. JS-EAI with *JS*-callback

2. js.exception 3279.js

3. JS for functional programming?

4. JS for functional programming?

5. NB. gray.js: a J verb that generates a grayscale postscript image from a 2d array

6. lapackTest.js

7. profile.js

8. J script file profile.js

9. JS valueOf() in RB ?

10. prefs.js question

11. JS / VRML / HTML / camera binding

12. help: js generated vrml

 

 
Powered by phpBB® Forum Software