[Jprogramming] is there a way to tell if a string evaluates to an adverb
Dan Bron
j at bron.us
Fri Feb 28 15:43:15 UTC 2014
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 <godspiral2000 at yahoo.ca> 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
More information about the Programming
mailing list