I'm not sure what sort of data mathlab is dealing with.  It sounds like you
might start with jijs.

Here is a script to paste in jijs

q1=:3.14159
q2=:2.71828
test=:+:
test1=:*:
test2=:+/
test3=:%

test q1
test q2

test test1 q1
test test2 q1
test test3 q1

test test1 q2
test test2 q2
test test3 q2

When you run the display you get:
   
   q1=:3.14159
   q2=:2.71828
   test=:+:
   test1=:*:
   test2=:+/
   test3=:%
   
   test q1
6.28318
   test q2
5.43656
   
   test test1 q1
19.7392
   test test2 q1
6.28318
   test test3 q1
0.63662
   
   test test1 q2
14.7781
   test test2 q2
5.43656
   test test3 q2
0.735759

Here are the same results from a script that look like it is written for
math students:

   A=:o.1
   B=:^1
   f=:+:
   g=:*:
   h=:+/
   i=:%
   
   f A
6.28319
   f B
5.43656
   
   f g A
19.7392
   f h A
6.28319
   f i A
0.63662
   
   f g B
14.7781
   f h B
5.43656
   f i B
0.735759

In J, q1 seems like a noun.  Also, test and test1 seem like verbs.
l
Maybe we need to see what q1, test and test1 are.

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Porter
Sent: Friday, February 01, 2013 10:49 PM
To: [email protected]
Subject: Re: [Jprogramming] How best to Port MatLab structure to J

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

Reply via email to