I'm trying to learn better about using "from" and "amend" (that is, 
trial and error with applications somewhat beyond the beginning level 
where I've been for a while).

To do some testing with the "from" verb applied to tables rather than 
lists, I was experimenting with the following explicit verb:

---------------------------------------------------

NB. testamend.ijs

require 'files strings'

ta=: 3 : 0

  qq=. '0';'1';'2';'3';'4';'5';'6';'7'
  qq2=. 2 4 $ qq
  pp=. 'aebfcgdh'

  p=. ''
  for_j. i.2 do.
    for_k. i.4 do.
      p=. p , ((". >((< j k) { qq2)) { pp)
    end.
  end.
)

---------------------------------------------------

Unfortunately, loading the script in J602 and executing the "ta" verb 
results in this:

   ta''
   |syntax error: ta
   |   p=.p,((".>((    <j k){qq2)){pp)

However, when I manually execute the critical part of the error line in 
the interpreter:

   (". >((< j k) { qq2)) { pp

using any values of 0 or 1 in place of j and 0 to 3 in place of k, the 
code works perfectly.

Why is this code sequence a syntax error in the script while it works 
OK directly in the interpreter?

Thanks in advance for your assistance in helping me understand this!


Harvey

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to