Newsgroups: comp.lang.apl
Path: watmath!watserv1!torn!utcsri!rpi!usenet.coe.montana.edu!decwrl!csus.edu!sfsuvax1.sfsu.edu!vpcsc4
From: vpcsc4@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: More J Questions : Printing intermediate values of y.
Message-ID: <1992Jul30.033946.20747@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Distribution: NA
Date: Thu, 30 Jul 1992 03:39:46 GMT

  More J questions.
 
1. In the function below is it possible to print y. for
  each value of i ? I suppose this can be done with
  1!:1&2 but how?

   lu
+---------------------------------------------------------+-++
| l =. u =. 0 0 $ ''                                      |:||
| i =. 0                                                  | ||
| n =. ''$ $ {. y.                                        | ||
|loop)                                                    | ||
| l   =. l, < (i # 0 ) , 1, f =. }. ({."1 y.) % ({. {. y.)| ||
| u   =. u, < (i # 0 ) ,{.y.                              | ||
| y.  =. (}."1 }. y.) - (}.{.y.)*"(1 0) f                 | ||
 <<< PRINT y. TO THE SCREEN HERE. >>>>
| i   =. >: i                                             | ||
| $.=. ((i<n)#loop),end                                   | ||
|end)                                                     | ||
| y.  =. ( < |: >,l ), (< >,u)                            | ||
+---------------------------------------------------------+-++
By the way, which is the convention, to print lu as shown above,
or lu as shown below.  There's no point in always printing both
versions.

<>  What is the syntax to branch to labels, say s1) s2) and s3)
    contingent upon some variable , say choice_var, which takes
    execution to s1, s2, and s3 if choice_var is 0 1 or 2. 
    Something like :

    $.=. (choice_var=i.2)#s1,s2,s3

    (This gives a syntax error.)

Thanks,
Emmett McLean
vpcsc4@sfsuvax1.edu
