thank you Dan, that is much more powerful than I expected.  A small change to 
ncS

ncS=:3 :'z=.y 1 :y label_. 4!:0 <''z'' ' :: _2: NB. nameclass of string


A cool feature you are using, is converting a tacit expression in a string to a 
tacit expression with:

t=. '@+'

   2 - ( ] 1 :t) 4
_6

which will work as long as the string doesn't contain u or m.

   ncS '@ +/ '
1


----- Original Message -----
From: Dan Bron <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Friday, February 28, 2014 10:43:15 AM
Subject: Re: [Jprogramming] is there a way to tell if a string evaluates to     
an adverb

Sorry for the short note, in on the subway 

   ncS=:3 :'z=.y 1 :y label_. nc<''z'' ' NB. nameclass of string

   ncS"0@;: 'a: + / @'
0 3 1 2

   isAdverb=: adverb = ncS

   isAdverb"0@;: 'a: + / @'
0 0 1 0

   arString=:3 :'z=.y 1 :y label_. 5!:1<''z'' '

   arString '//' NB. train of adverbs
+---------+
|+-+-----+|
||4|+-+-+||
|| ||/|/|||
|| |+-+-+||
|+-+-----+|
+---------+
   arString '+@' NB. bonded conjunction
+---------+
|+-+-----+|
||4|+-+-+||
|| ||+|@|||
|| |+-+-+||
|+-+-----+|
+---------+

   isAdverb '//' NB. train of adverbs = adverb
1
   isAdverb '@+' NB. bonded conjunction = adverb
1

See Dictionary $II.F for the definition of adverb trains and bonded 
conjunctions (described after forks and hooks).

-Dan

Sent from my iPhone


> On Feb 28, 2014, at 10:14 AM, Pascal Jasmin <[email protected]> wrote:
> 
> insert =. '/'
> 
> isadverb insert
> 
> or
> 
> isadverb '/'
> 
> considering that 5!:0 can be used to produce the adverb from string,
> 
>    + (<'/') 5!: 0 ] 1 2 3
> 6
> 
> that would seem to be a promissing path
> 
> The only idea I have is to generate a trappable error that could distinguish 
> between adverb/modifier and non-adverb, but I need ideas for one.
> 
> Part of the problem I have is that I cannot seem to get either:
> 
> ar =: 1 : '5!:1 <''u'''
> ar2 =: 3 : '5!:1 <''y'''
> 
> to be able to return '4  Bonded conjunction or train of adverbs' from this 
> page:
> 
> http://www.jsoftware.com/help/dictionary/dx005.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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to