I don't see the point of these complications: "inlocale".
The mechanism is already in __numloc and _txtloc_ syntax.

   scripts_z_=: 0!:0       NB. named and implicitly inherited from "z"

   scripts_qq_ 'zz=: 3 : '' y+2 '' '
   zz_qq_ 3
5
   q1=: conew'qq'
   scripts__q1 'zz3=: 3 : '' y+3 '' '
   zz__q1 3
5
   zz3__q1 3
6

   zz4__q1=: 3 : ' y+4 '   NB. better: natural name definition
   zz4__q1 3
7

   erase__q1 <'zz4'        NB. already defined
1
   zz4__q1 3
|value error: zz4__q1
|       zz4__q1 3




----- Original Message ----
> From: Yuvaraj Athur Raghuvir <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Monday, May 18, 2009 1:49:51 PM
> Subject: [Jprogramming] Understanding Conjunctions & Adverbs
> 
> Hello,
> 
> To add and remove verbs dynamically to a class from an instance, I wrote the
> following:
> 
> addv =: (0!:0) inlocale
> remv =: (erase@<) inlocale
> 
> I designed inlocale based on the JfC code for InLocales Conjunction [1]
> 
> inlocale =: 2 : 0
> l =. gcurrent ''
> class =. {. @ copath n
> cocurrent class
> u y
> cocurrent l
> ''
> )
> 
> This works in my tests.
> 
> cocurrent 'base'
> 
> 
>    1. test01 =: 3 : 0
>    2.  c =. conew 'myclass'   NB. use copathnl__c '' to inspect
>    3.  try. hello__c ''
>    4.  catch.
>    5.   vs =. 'hello =: 3 : 0',CRLF,'smoutput ''hello''',CRLF,')'
>    6.   c addv vs
>    7.   hello__c ''
>    8.  end.
>    9.  smoutput copathnl__c ''
>    10.  c remv 'hello'
>    11.  smoutput copathnl__c ''
>    12.  destroy__c ''
>    13. )
> 
> 
> However, I do not understand two points:
> 
> 1) When to design inlocale as an adverb (1 : 0) and when as a conjunction(2
> : 0)?
> 2) How does inlocale get the 'n' it wants in the execution of the statement
> number 6 & 10 in the test code?
> 
> If this is already written down somewhere, please do point me to the
> reference.
> 
> Thanks,
> Yuva
> 
> 
> [1]
> http://www.jsoftware.com/help/jforc/writing_your_own_modifiers.htm#_Toc191734500
> ----------------------------------------------------------------------
> 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