After learning J really slowly for the past little while, I realized that
it was probably because all the examples had to do with array manipulation,
which was cool, but even though I was able to do reversals and ravels and
stuff, I still wasn't able to make a program that can ask for the user's
name.
Yesterday, I found out that on Chapter 28 of Learning J (wow, all the way
back there) there was a snippet similar to this:
put =: (1!:2) & 2
pname =: 3 : 0
put 'What is your name?'
name=.(1!:1) 1
'Your name is ', name
)
When I first tried to code that, I didn't put that prompt into a function
and it seemed to skip the input. The second time, I put the line pname ''
under the function and it said syntax error, but when the program is run
and one types pname '', it THEN works.
Is there a way to code this so that when the program is run, the first
thing that shows up is "What is your name?" and the program waits for the
user to input without having to run the program first and type something
like pname ''?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm