Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!utcsri!rpi!uwm.edu!spool.mu.edu!umn.edu!csus.edu!sfsuvax1.sfsu.edu!emclean
From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Can the interation index be accessed in u^: n ?
Message-ID: <1992Dec22.110411.19261@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Distribution: NA
Date: Tue, 22 Dec 1992 11:04:11 GMT
Lines: 32

NB. 
NB.    I find that in for statments it is often useful to have
NB.    access to the interation index, but I haven't found
NB.    how to access it. So have cooked up the following 
NB.    example to illustrate my point.  One third of the
NB.    time the verb h returns y. appended with half of the
NB.    tail of y. ,  one third of the time y. with double of the 
NB.    tail of y. appended, and one third of the time it returns
NB.    y. with 1000 times the interation index appended. 
NB.    Unfortunately, and not suprisingly, my attempt below
NB.    yeilds a value error since $.  is only implicitly assigned
NB.    to i. ns . I can easily imagine that one can not access the 
NB.    interation index but perhaps someone else has some ideas,
NB.    like on how to assign and access $. ?

Thanks,

Emmett emclean@sfsuvax1.sfsu.edu

   v =.''&$@:(1&?)@(3"_)
   s =. , -:@{:
   t =. , +:@{:
   r =. , (1000&*)@#@$.
   h =.  s`t`r@.v
   h 2
2 1
   h 2
2 4
   h 2
2 4
   h^:10 (2)
value error
