I was going to try and find a way to use &. in that after I'd got it working,
as I realised it would probably be possible to use it. So what you're saying is
that:
tie0`tie1 @. f@:g y
actually performs the agenda part on g y? Or have I got that wrong?
On 28 Oct 2011, at 18:27, Marshall Lochbaum wrote:
> It's naturally grouped from left to right, so what you have is
> ]`(a.{~32&+@:(a.&i.)) @. (>&64 *. <&91) @: (a.&i.) 'A'
> which first converts 'A' to a number, then applies all of the rest on the
> number. Thus (a.&i.) (numeric) gives #a. , giving you your index error after
> adding 32 and selecting from a. .
> I would actually use this behavior to make my verb more efficient, since it
> only has to convert from a character once:
> ]`(32&+) @. (>&64 *. <&91) &. (a.&i.) 'A'
> a
>
> or, using ^: instead of agenda (since a simple "if" clause is all we want),
> (32&+)^:(>&64 *. <&91) &. (a.&i.) 'A'
> a
>
> Marshall
>
> On Fri, Oct 28, 2011 at 11:48 AM, David Vaughan <
> [email protected]> wrote:
>
>> 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
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm