The line
  if. currHi >: ( pivotLo * (1+swing) )
has no "do.".

Part of the problem is the excessive number of control statements.  I
suspect there's a much simpler formulation of this algorithm

On Tue, Feb 21, 2012 at 3:37 AM, Aai <agroeneveld...@gmail.com> wrote:
> Missing a 'do' ? see in between
>
> On 21-02-12 07:33, PackRat wrote:
>> When loading a script to test, I get an immediate "control error" when
>> I give the command to load it.  The following is the portion of the
>> script that has all of the control structures.  I've drawn an arrow
>> pointing to the line where the error is supposed to have occurred.  I'm
>> probably "blind" to the error because I'm just not seeing the problem.
>>
>> ================================================================
>>
>> for_i. i.(#a) do.
>>
>>    currHi=. ".>  (i { H)
>>    currLo=. ".>  (i { L)
>>    currCl=. ".>  (i { C)
>>
>>    if. (0=i) do.
>>      diffHi=. 0
>>      diffLo=. 0
>>    else.<-------- control error here
>>      prevHi=. ".>  ((i-1) { H)
>>      prevLo=. ".>  ((i-1) { L)
>>      diffHi=. currHi - prevHi
>>      if. 0<:diffHi do. pivotHi=. currHi end.
>>      diffLo=. prevLo - currLo
>>      if. 0<:diffLo do. pivotLo=. currLo end.
>>    end.
>>
>>    if. diffLo>diffHi do.
>>      if. currLo<: ( pivotHi * (1-swing) ) do.
>>        xx=. xx , currLo
>>      else.
>>        xx=. xx , ( {: xx )    NB. repeat previous value
>>      end.
>>    else.
>>      if. currHi>: ( pivotLo * (1+swing) )
>
>
>
> *Missing a 'do'*
>
>
>
>
>>        xx=. xx , currHi
>>      else.
>>        xx=. xx , ( {: xx )    NB. repeat previous value
>>      end.
>>    end.
>>
>> end.
>>
>> ================================================================
>>
>> The same error (at the same line) occurs if the following lines:
>>
>>    if. 0<:diffHi do. pivotHi=. currHi end.
>>    . . .
>>    if. 0<:diffLo do. pivotLo=. currLo end.
>>
>> are instead expanded to:
>>
>>    if. 0<:diffHi do.
>>      pivotHi=. currHi
>>    end.
>>    . . .
>>    if. 0<:diffLo do.
>>      pivotLo=. currLo
>>    end.
>>
>>
>> I would appreciate any assistance in "opening my eyes"--thanks in
>> advance!
>>
>>
>> Harvey
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> Met vriendelijke groet,
> @@i = Arie Groeneveld
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to