Every programming language created solved some problems more easily than existing languages. That was the reason the new language was created. People love to "prove" that one language is better than another is by insisting that the solution be done a certain way.
On Sat, Feb 2, 2013 at 6:28 AM, Raul Miller <[email protected]> wrote: > As has been pointed out, J's locales are not hierarchical. > > J's boxed structures are hierarchical but are not implicitly named. > > A question is: why do you need both a hierarchy and a way of making > copies of a part of that hierarchy? > > Why not use a single copy? > > What problem does the hierarchy solve? > > It's entirely possible to emulate the hierarchy in J, but there will > be performance costs for some operation. In your case you had three > operations: > > Defining an initial value > Copying a subtree > Accessing a final value > > I can think of one approach where access is fast, and another approach > where copy is fast, for example. But since I do not know why you want > this in the first place I do not know if either is appropriate. > > For example, you might use the letter 'z' to mark hierarchical breaks. > Here, you would implement copy using a routine which enumerates your > names and which makes fresh copies of them. > > For example, you might use indirect references to achieve your > hierarchical breaks. Here, you would implement access using a routine > which visits each locale to find the reference to the next locale. > > In either case, if you do not like the appearance of the mechanism > (and you probably should not find it appealing) you would build > routines to hide that appearance from arbitrary code. > > -- > Raul > > On Fri, Feb 1, 2013 at 10:49 PM, David Porter <[email protected]> wrote: > > Thanks Raul. That did help a little. > > > > What has me now is how to get the following: > > q1.tests.test1 > > q1.tests.test2 > > q1.tests.test3 > > > > Under each of the three tests there will be multiple named variables. > If I > > understand what coinsert does correctly, that is to put a new locale on > the > > search path before _z_, then I don't understand how you generate the tree > > structure described above. > > > > Then, again, maybe I am missing something that should be obvious... > > > > Dave > > > > On 2/1/2013 9:09 PM, Raul Miller wrote: > >> > >> locales will do, but there's different ways of assigning depending on > >> what you mean by "assign". For constants this is probably sufficient: > >> > >> cocurrent 'q1' > >> test=: 3.1415 > >> > >> cocurrent 'q2' > >> coinsert 'q1' > >> > >> cocurrent 'base' > >> > >> test_q1_ > >> 3.1415 > >> test_q2_ > >> 3.1415 > >> > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
