Also, what's up with this:

   lower =: ]`(a.{~32&+@:(a.&i.)) @. (>&64 *. <&91)@:(a.&i.) "0
   lower 'A'
|index error: lower
|       lower'A'
   0:`1: @. (>&64 *. <&91)@:(a.&i.) 'A'
1
   ]`(a.{~32&+@:(a.&i.)) @. 1: 'A'
a
   ]`(a.{~32&+@:(a.&i.)) @. (>&64 *. <&91)@:(a.&i.) 'A'
|index error
|       ]`(a.{~32&+@:(a.&i.))@.(>&64*.<&91)@:(a.&i.)'A'

The verb on the right of agenda produces 1 for 'A' on its own, and the second 
gerund produces 'a' from 'A' on its own, but when combined I get an index error.

On 28 Oct 2011, at 16:21, David Vaughan wrote:

> I was trying to write a verb to 'clean' inputs by removing any non-alphabetic 
> characters and converting to lowercase. What I came up with seems to work, 
> however I'm getting issues with spelling errors again, due to (I assume) 
> invisible unicode characters.
> 
> This is copied and pasted from my .ijs file:
> 
> tolower =: 3 :'​if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y end.'"0
> string_clean =: tolower #~ ([: (>&96 *. <&123) a.&i.@:tolower)
> string_clean 'TeSt.!'
> 
> It works if I load it and then run string_clean, but not if I try to use 0!:1:
> 
> 0!:1<'J/scripts/charstuff.ijs'
>   tolower =: 3 :'​if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y 
> end.'"0
> |spelling error
> |   ​
> |   ^
> |   tolower=:    3 :'​if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y 
> end.'"0
> |[-0] J/scripts/charstuff.ijs
> 
> I had a fix for this sort of spelling error that seems to work whenever I use 
> load thanks to Raul Miller:
> 
>   script_z_
> [: 3 : '0!:0 -.&(128}.a.) 1!:1 y [ 4!:55<''y''' jpath_z_&.:>
> 
> That is in profile.ijs.
> 
> Can anyone help me?
> 
> Thanks.

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

Reply via email to