If she is looking to treat verbs as strings, 128!:2 will do the job (but
only for monads).

So one approach might be:

stringdyad=:1 :0
  (m,'&>/') 128!:2 ,&<
)

   1 2 3 '=' stringdyad"0/ 1 2 3 4
1 0 0 0
0 1 0 0
0 0 1 0

But '=' stringdyad"0 does not look so good for the verb for table.

   1 2 3 '='stringdyad"0 table 1 2 3 4
┌─────────────────────┬───────┐
│('=&>/' 128!:2 ,&<)"0│1 2 3 4│
├─────────────────────┼───────┤
│1                    │1 0 0 0│
│2                    │0 1 0 0│
│3                    │0 0 1 0│
└─────────────────────┴───────┘

So taking your gerund suggestion as an approach, we can turn the string
into a gerund (this only works for verbs from the dictionary), and:

evoke=:1 :0

(<m)`:6

)

   1 2 3 '='evoke table 1 2 3 4
┌─┬───────┐
│=│1 2 3 4│
├─┼───────┤
│1│1 0 0 0│
│2│0 1 0 0│
│3│0 0 1 0│
└─┴───────┘

Thanks,

-- 
Raul

P.S. I do not know what definition you were using for 'r' - not knowing the
definitions makes the code unreadable.


On Wed, Oct 8, 2014 at 7:46 AM, Joe Bogner <[email protected]> wrote:

> Linda,
>
> Your question is fairly cryptic and it's unclear why it's posted to beta
> instead of programming. May I suggest that you take a step back and write a
> phrase describing what you are intending to do? It's like a stumped student
> who walks up to a teacher with a sheet full of attempted solutions, but
> missing the problem statement.
>
> In any case, I'm interpreting your question as: How do evaluate a string
> representation of a verb?
>
> There are many options. The most common solutions are ". or 0!:1. You may
> also consider building an explicit string or evaluating a gerund. It seems
> like a gerund is the right way to go. Lastly, there may be a way with a
> conjunction, but I'm not sure about that.
>
>    ". '1',(r 6),'2'
> 3
>
> (0!:1) '1',(r 6),'2'
>    1>2
> 0
>
> It seems you are seeking 1 (r 6) 2
>
> Something like this might do:
>
> 1 (4 : ('x',(r 6),'y')) 3
>
> The gerund approach could look like this:
>
>    rf=:+`-`=`<`>`|
>    rf@.(? 6)
> -
>    4 rf@.(? 6) 3
> 7
>
>
> Hope this helps
>
> Joe
>
> On Wed, Oct 8, 2014 at 6:10 AM, Linda Alvord <[email protected]>
> wrote:
>
> > ]A=:i.3
> >
> > 0 1 2
> >
> >    ]B=:i.5
> >
> > 0 1 2 3 4
> >
> >    r=: 13 :'(? y){''+-=<>|'''
> >
> >    ]C=:r 6
> >
> > =
> >
> >    $r 6
> >
> >    $=
> >
> > $ =
> >
> >    A = / B
> >
> > 1 0 0 0 0
> > 0 1 0 0 0
> > 0 0 1 0 0
> >
> >    A = table B
> >
> > --T---------┐
> > │=│0 1 2 3 4│
> > +-+---------+
> > │0│1 0 0 0 0│
> > │1│0 1 0 0 0│
> > │2│0 0 1 0 0│
> > L-+----------
> >
> >    A (r 6) / B
> >
> > |domain error: scriptd
> > |   A    (r 6)/B
> > |[-12] c:\users\owner\j803-user\temp\36.ijs
> >
> >
> >
> > NB.  Here are some additional responses:
> >
> >    A C /B
> >
> > |domain error
> > |   A     C/B
> >
> >    A (r 6) table B
> >
> > |domain error
> > |   (((#~LF-.@e.])5!:5<'u');,.y),.({.;}.)":x,y     u/x
> >
> >    A (r 6)/ B
> >
> > |domain error
> > |   A    (r 6)/B
> >
> >
> >
> > Linda
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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