Pascal wrote: > I wrote something else cool instead: > > Parsing function parameters outside of the function: > last section at: > http://www.jsoftware.com/jwiki/PascalJasmin/J%20tricks%20with%20assign
I haven't read that whole page yet, but if you're interested in silly tricks with assign, maybe you'd like this (and the pages it links to): http://rosettacode.org/wiki/Named_parameters#J Basically, it lets you declare formal parameters for J verbs, conceptually like the "function foo(string name, int age)" of other languages, and then refer to these parameters, reliably and transparently, inside your verb (e.g. 'if. age > 10 do. 'Hello Mr.' , name else. 'Hey ',name',' is your dad around?' end.) . Auxillary names are defined to let you know whether a user specified a given parameter, or it took its default value. All names are completely, authentically local, and so evaporate when the verb exits. An additional script, added later, emulates the calling conventions of other languages (e.g. foo['Bobby',10] or foo[name='Bobby',age=10] etc). And though these things exist and were fun to write, I don't see any serious use for them in J. Our language has its own conventions, offered in pursuit of its own objectives, which are more often than not at odds with the conventions of most mainstream languages. For example, it would be hard to marry rank and named parameters in any cohesive and useful way; since rank is utterly central to J programming, we probably won't see much use of named parameters. -Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
