CHAR =: 1 : 'u&(a.&i.)'

   'z'> CHAR 'a'
1
   '5'< CHAR '6'
1


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Richard Donovan
> Verzonden: maandag 5 november 2007 22:08
> Aan: Programming forum
> Onderwerp: [Jprogramming] My first adverb - doesn't work!
> 
> 
> I want an adverb that will convert 1-byte-characters to their numeric
> equivalent then operate the verb on them. For instance I want to be able
> to easily test 'c'> 'a'  or   '5' < '6' which gives domain errors
> (although 'c' = 'c' does not!)
> 
> So I wrote this adverb:
> 
> NB. adverb that converts characters
> NB. into their numeric equivalents
> NB. then operates the given verb on them
> NB. e.g. 'z'> CHAR 'a'
> NB.     should return 1
> 
> CHAR =: 1  :0
> t1=: a.i.x
> t2=: a.i.y
> t1 u t2
> )
> 
> but...
> 
>    'z'> CHAR 'a'
> |domain error
> |   'z'   >CHAR'a'
>    t1
> 33
>    t2
> 97
>    t1{a.
> !
>    t2{a.
> a
> 
> I am missing something obvious (again!)
> _________________________________________________________________
> Feel like a local wherever you go.
> http://www.backofmyhand.com-----------------------------------------------
> -----------------------
> 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