On Mon, Nov 9, 2015 at 9:34 AM, Raul Miller <[email protected]> wrote:
> On Mon, Nov 9, 2015 at 8:22 AM, Joe Bogner <[email protected]> wrote:
>> 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:
> ...
>> sb=: 3 : 0
>> cocurrent 'base'
>> y
>> )
>
> http://www.jsoftware.com/help/dictionary/dx018.htm
>
> "
> 18!:4 y
> Switch Current. Switch the current locale to y at the end of the
> currently executing named verb. Initially the current locale is base .
> "
Thanks, I read that initially but still don't understand it,
specifically 'the end of the currently executing named verb'.
cocurrent
18!:4@boxxopen
If I type cocurrent 'base' , I would assume cocurrent is the
currently executing named verb and it switched to base after the end
of cocurrent
Given that understanding, why would it switch back at the end of the
explicit definition? Is that behavior documented somewhere?
>
> You either need to use ([ cocurrent bind 'base') instead of sb, or use
> 18!:4 in sb .
>
I had forgotten about bind
([ cocurrent@('base'"_1)) 2
http://code.jsoftware.com/wiki/Vocabulary/quotem
I typically use & to bind parameters. & cannot be used on cocurrent
because it's monadic, is that the correct interpretation?
NB. basic monadic verb
add1 =: 3 : 'y+1'
NB. no & allowed
(add1&3) 0
|domain error: add1
NB. bind works
(add1 bind 3) 100
4
NB. & works fine when defined dyadic
add1d =: 4 : 'y+1'
(add1 & 3) 1
4
NB. no bind on dyadic
(add1d bind 3) 1
|domain error: add1d
| (add1d bind 3)1
Is there a way to determine the valence of a tacit verb?
My first thought was ar, but that didn't seem to help:
5!:1 (<'cocurrent')
┌──────────────────────────────────┐
│┌─┬──────────────────────────────┐│
││@│┌───────────────────┬────────┐││
││ ││┌──┬──────────────┐│boxxopen│││
││ │││!:│┌──────┬─────┐││ │││
││ │││ ││┌─┬──┐│┌─┬─┐│││ │││
││ │││ │││0│18│││0│4││││ │││
││ │││ ││└─┴──┘│└─┴─┘│││ │││
││ │││ │└──────┴─────┘││ │││
││ ││└──┴──────────────┘│ │││
││ │└───────────────────┴────────┘││
│└─┴──────────────────────────────┘│
└──────────────────────────────────┘
> locale handling has to do with name resolution - not just in terms of
> what gets resolved, but also in terms of context.
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm