On Sun, Nov 8, 2015 at 12:07 PM, Raul Miller <[email protected]> wrote: > > It would be best, I think, if you paired up "to" on the right of the > sentence with a word on the left of the sentence which terminates the > dsl expression. My verbal imagination fails me at the moment, so I'm > going to use "from". > > With this, tbl could be a locale reference, and - 'to' would switch to > the locale and return its left argument. 'from' would switch you back > to 'base' locale and return a reference to tbl's locale. (You could > get fancy and maintain a locale call stack, but that gets you into > guarding against stack imbalances - easier to just say that mixing > dsls should happen in different explicit verbs, or with great care.) >
Thank you. I had this thought as well but couldn't get it to work. I may not have a full grasp on how cocurrent works I define st as 'switch to table locale' and sb as 'switch to base locale' I defined them explicitly My first attempt: coclass 'table' create=: 3 : 0 data=:y CURRENT=:coname'' ) add=: 4 : 0 data=:data__CURRENT+x ) sub=: 4 : 0 data=:data__CURRENT-x ) coclass 'base' sb=: 3 : 0 cocurrent 'base' y ) st =: 3 : 0 cocurrent 'table' CURRENT_table_ =: y y ) sb 5 add 2 add st tbl |value error: add | sb 5 add 2 add st tbl However this seems to work fine: (3 : 'y [ cocurrent ''base''') 5 add 2 add (3 : 'y [ cocurrent ''table''') tbl 5 6 7 8 9 10 11 12 13 14 My only guess is that cocurrent resets back to the original locale after executing an explicit definition (which would make some sense) I couldn't figure out to define sb and st explicitly. I kept crashing J when trying to bond 'table' to cocurrent: http://jsoftware.com/pipermail/programming/2015-November/043161.html ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
