Raul, The problem for me is not in explicit vs tacit but in overall speed. If it was a way to achieve what I need I would not much care about how verbs are defined. Your 'set' verb is basically what I need, but it is even slower than workaround I started with (the setA verb which can be called from tacit definition):
6!:2 ' ''a''&set"0 i. 1000000' 19.6907 a 999999 setA =: 3 : ' a=: y'"0 6!:2 'setA i. 1000000' 4.93576 The toy example with a checking of a parantheses balance should give a sense of a problem. The real task I have at hand is to parse and then analyze huge log files (hundreds of megabytes). The parsing of each line is somewhat context sensitive: each line may modify the context and the result for the next line will be different. So I have to reffer to and to modify the state when going through the file line-by-line. If I write explicitly basically I will get the perfomance of a shell script. Tacitly - well, this thread is about it. And this is not uncommon problem, see this thread: http://www.jsoftware.com/pipermail/programming/2007-October/008606.html I think Edushka has the same problem - he could not store the state (accumulator) while running through file. Note, that his question remained without answer. Another point is the support for object-oriented style of programming. If there is no way to modify the state from tacit verbs - OOP in J will never be close to OOP in 'real' OOP languages - it just doesn't scale. So the question is: is it possible (and if not what prevents it) to add a pair of verbs which would allow assign values to local and global names from tacit code? What prevents copulas from being verbs, btw? Regards, Danil 2007/11/10, Raul Miller <[EMAIL PROTECTED]>: > > On Nov 9, 2007 3:47 PM, Dan Bron <[EMAIL PROTECTED]> wrote: > > The short answer to your question is that a fundamental difference > between > > tacit and explicit code is that the former can *not* assign variables. > > I would state this differently. As I understand it, explicit definition > is the > name the dictionary uses for m : n > > Given that as the basis for the concept of "explicit", the fundamental > difference between tacit and explicit code has to do with the treatement > of local variables. > > With tacit code, variables from the current explicit code's > variable space will be used. > > get=: ".bind > set=: [ ,get '=.3!:2 a.{~' , ":@(a.i.3!:1)@] > > a=:0 1 > 'a' get _ > 0 1 > 3 :'''a''get _+a=.2+y' 2 3 > 4 5 > 'a' set 6 7 > 6 7 > a > 6 7 > 3 :'''a'' set y' 8 9 > 8 9 > a > 6 7 > > P.S. a nicer version of that set verb would be: > serialize=: 3 :'5!:5<''y''' > set=: [ ,get '=.' , [EMAIL PROTECTED] > > But I did not want to quibble about whether or not this uses explicit > definition to set the variable. > > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
