Henry said...
>
> CHAR =: &(a.&i.)
>
> Henry Rich
>
Thanks Henry, that works fine for the examples I stated
'a'> CHAR 'b'
0
'a' < CHAR 'b'
1
but I was hoping for an adverb that would handle most anything, for example
Raul's brilliant
pattern match in a recent thread:
Raul said...
pattern=: (1 #~ [EMAIL PROTECTED]) [EMAIL PROTECTED]&(0 , 0 ,~ ]) ] e. {:@[
dat=:0 7 8 8 8 9 2 2 5 5 5 3 8 8 8 0 0 5 5 9 6 8 8 8 8 4 0 6 4
2 5 pattern dat
17
but...
dat=:'xxxxxxxxxxxxxxxxxbbxxxxxxxbbbxxxx'
2 'b' pattern CHAR dat
|syntax error
| 2'b'pattern CHAR dat
I can get round it by the convoluted...
x1=: a.i.'b'
x2=: a.i.'xxxxxxxxxxxxxxxxxbbxxxxxxxbbbxxxx'
(2,x1) pattern x2
17
...but would rather have a "neater" inline version!
In other words, I want the transforms from character to numeric to occur BEFORE
the verb operates but without the verbosity. And I want it to work with ANY
verb!
Perhaps I don't need an adverb (which I'm advised only takes ONE argument), but
rather a different
construction which I haven't studied yet?
_________________________________________________________________
100’s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm