[Jprogramming] How best to Port MatLab structure to J
Raul Miller
rauldmiller at gmail.com
Sat Feb 2 02:09:19 UTC 2013
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
--
Raul
On Fri, Feb 1, 2013 at 7:09 PM, David Porter <dporter at cissoid.net> wrote:
> I am trying to port some old code from MatLab to J. It seems that it should
> be easy, but I am finding one aspect of it difficult.
>
> In MatLab I used their data structure with several sub-levels. Four
> features seemed very nice to me: 1, Many constants could be associated with
> a single overall name (say q1.) . 2, I could add new ones at will (say
> q1.test). 3, I could duplicate the whole thing with a single assignment
> (say q2 = q1). 4, The hierarchical nature of the structure is as obvious
> as it is easy to make or use.
>
> I assume that the use of locales is the answer to providing a similar
> facility in J. I am aware of the examples like plot that keep the plot
> variables in its own locale , but I must be missing some fundamental concept
> as I have struggled with this for a few days and cannot quite get my arms
> around it.
>
> Thanks,
> Dave Porter
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list