[Jprogramming] Define tacit verb from string
Roger Hui
rhui000 at shaw.ca
Wed Nov 26 16:19:50 HKT 2008
tstr=: '(* ,: +)'
foo=: + 1 : tstr
3 4 5 foo 7 2 4
21 8 20
10 6 9
tstr1 =: '* ,: 2&+@]'
goo=: + 1 : tstr1
3 4 5 goo 7 2 4
21 8 20
9 4 6
----- Original Message -----
From: "Sherlock, Ric" <R.G.Sherlock at massey.ac.nz>
Date: Tuesday, November 25, 2008 23:21
Subject: RE: [Jprogramming] Define tacit verb from string
To: Programming forum <programming at jsoftware.com>
> That method seems to work for simple verb trains but not more
> complicated sentences:
>
> tstr =: '* ,: 2&+@]'
> 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!!
More information about the Programming
mailing list