Greetings, All. My first post. A bit lengthy. Sorry.
I am a life-long user of APL who turned to J two years ago and have more
or less settled into it, long enough to really appreciate its elegance.
My learning curve has been steep but very pleasurable, and useful.
I have read "Learning J" and all about foreign
conjunctions (especially, 1!:), but I seem to have missed something.
None of my APL "quote quad" expertise is related to how a user of a J script
can engage interactively with the script once loaded-- e.g., if the
script displays 'Please enter
birthdate', the user inputs, input gets error checked and assigned to a
variable.
I have a verb USRINPT in the script which uses (1!:2)&2 for prompts and
(1!:1)1 for user input assigned to a variable. The verb works fine in
the interpreter when I load the script and execute it myself with
USRINPT ''.
But, I want the USRINPT verb to execute upon loading the script, so the
user immediately sees the intro text re proper formation of dates (this
is fine), then the prompt 'Birthdate?' (this works too) and J returns to
the left margin awaiting input (this doesn't work).
That is, when I load the script that has the explicit definition
USRINPT in it, with next line USRINPT '' (execute USRINPT), the
(1!:2)&2 verb in USRINPT displays the prompt, but the assignment of user
input to variable line n=: (1!:1)1 doesn't happen. It's as though it's
not there. Of course, since the session has no values for the variables
supposed to be provided by n=: (1!:1)1, the script eventually shows an
error, and stops.
I'm not seeing something--about J foreign conjunctions or about scripts
(J is my first experience of programming with scripts).
I've looked and looked in the J docs. I would be grateful for a pointer
in the right direction.
Thanks, Tony
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm