ts=: 1 : '] 1 : m'

   '+/ % #' ts 1 2 3 4
2.5

   1 2 3 4 '+&.:*:' ts 1 2 3 4
1.41421 2.82843 4.24264 5.65685

    3 4 5 '(* ,: +)' ts 7 2 4
21 8 20
10 6  9




> From: Roger Hui <[EMAIL PROTECTED]>
> 
>    tstr=: '(* ,: +)'
>    foo=: + 1 : tstr
>    3 4 5 foo 7 2 4
> 21 8 20
> 10 6  9
> 
>    tstr1 =: '* ,: 2&[EMAIL PROTECTED]'
>    goo=: + 1 : tstr1
>    3 4 5 goo 7 2 4
> 21 8 20
>  9 4  6
> 
> 
> 
> ----- Original Message -----
> From: "Sherlock, Ric" 
> Date: Tuesday, November 25, 2008 23:21
> Subject: RE: [Jprogramming] Define tacit verb from string
> To: Programming forum 
> 
> > That method seems to work for simple verb trains but not more 
> > complicated sentences:
> > 
> >    tstr =: '* ,: 2&[EMAIL PROTECTED]'
> >    3 4 5 (;:tstr)`:6 (7 2 4)
> > |domain error
> > |   3 4 5    (;:tstr)`:6(7 2 4)
> > 
> > If I rewrite as simple train:
> >       tstr =: '* ,: 2: + ]'
> >    3 4 5 (;:tstr)`:6 (7 2 4)
> > 21 8 20
> >  9 4  6
> > 
> > But that might get a bit unwieldy as the sentence gets more 
> > complicated. Is there a more general method?
> > 
> > ---Henry Rich wrote:
> > >    tstr =: '* ,: +'
> > >    (;:tstr)`:6
> > > * ,: +
> > > +-+--+-+
> > > |*|,:|+|
> > > +-+--+-+
> > >    3 4 5 (;:tstr)`:6 (7 2 4)
> > > 21 8 20
> > > 10 6  9
> > >
> > > Henry Rich
> > >
> > ---Sherlock, Ric wrote:
> > 
> > > > For some tacit sentence eg:
> > > >    (* ,: +)
> > > >    3 4 5 (* ,: +) 7 2 4
> > > > 21 8 20
> > > > 10 6  9
> > > >
> > > > Defined as a literal string eg:
> > > >    tstr=: '(* ,: +)'
> > > >
> > > > How can I create a named (preferably tacit) verb?
> > > > The only thing I've been able to come up with is:
> > > >
> > > >    texp=: 4 : 0
> > > >    ". 'x ',tstr,' y'
> > > > )
> > > >    3 4 5 texp 7 2 4
> > > > 21 8 20
> > > > 10 6  9
> > > >
> > > > I have an uncomfortable feeling that there is simple and
> > > > elegant solution but my mind is numb!!
> 
> 
> ----------------------------------------------------------------------
> 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