On Thu, Sep 6, 2012 at 7:07 PM, Ian Clark <[email protected]> wrote:
> (I suspect ;:inv will eventually let me down too, but I haven't fooled it
> yet!)
I have not been able to make it misbehave (though I've been too lazy
to look up the c source for it, which would probably be the efficient
thing to do).
;:inv ;: '1(+ .2)-3=:4'
1 ( + . 2 ) - 3 =: 4
a. i. ;:inv LF,each ;: '1(+ .2)-3'
10 49 32 10 40 32 10 43 32 10 46 32 10 50 32 10 41 32 10 45 32 10 51
--
Raul
>
> b2o and its sister b2f do matter, however, as I propose to put serious
> weight on them, as g.p. utilities.
>
> b2o=: }.@((<SP) ;@,. ])
> b2f=: }.@((<LF) ;@,. ])
>
> so I'd be grateful to be notified of anyone making them misbehave.
>
> Possible gray areas to investigate: use of i{a. where i>127, utf-8,
> boxed scalars, strings with CRLF, 0{a. and other subasciis, uses of a:
> , etc, etc.
>
> On Thu, Sep 6, 2012 at 11:43 PM, Raul Miller <[email protected]> wrote:
>> Note that bpv would also have problems with boxed strings containing
>> spaces, and even worse problems with boxed strings containing
>> newlines. (It's not clear, though, if strings containing newlines
>> matter to you.)
>>
>> --
>> Raul
>>
>> On Thu, Sep 6, 2012 at 6:39 PM, Ian Clark <[email protected]> wrote:
>>> Right you are.
>>>
>>> What I really want (but haven't said) is the fastest versions of b2o
>>> (boxed-to-open-string) and b2f (boxed-to-LF-separated-string), where
>>> b2f is b2o with ' ' (-:SP) replaced with LF.
>>>
>>> I think I've got them now, thanks to everyone.
>>>
>>> BTW solutions involving deb aren't general enough, esp for b2f, where
>>> the boxed strings may validly contain multiple spaces.
>>>
>>> On Thu, Sep 6, 2012 at 11:32 PM, Raul Miller <[email protected]> wrote:
>>>> I prefer
>>>> ;:inv z
>>>>
>>>> But note that
>>>>
>>>> deb,' ',.>z
>>>>
>>>> would work. (J6 users need require'strings' before this can work.)
>>>>
>>>> FYI,
>>>>
>>>> --
>>>> Raul
>>>>
>>>> On Thu, Sep 6, 2012 at 6:21 PM, Ian Clark <[email protected]> wrote:
>>>>> Yes, but we need a string.
>>>>> You can ravel the 2D array to get a string, viz:
>>>>> ,> z
>>>>> but it gives you a varying number (0 or more) of separating spaces.
>>>>>
>>>>> On Thu, Sep 6, 2012 at 10:50 PM, km <[email protected]> wrote:
>>>>>> > 'alpha';'bravo';'charlie'
>>>>>> alpha
>>>>>> bravo
>>>>>> charlie
>>>>>>
>>>>>> I'm resending because the echo from Jsoftware to my iPad was incorrect.
>>>>>> Hope this one shows my solution was to open the list of boxes.
>>>>>>
>>>>>> Sent from my iPad
>>>>>>
>>>>>>
>>>>>> On Sep 6, 2012, at 4:32 PM, km <[email protected]> wrote:
>>>>>>
>>>>>>>> 'alpha';'bravo';'charlie'
>>>>>>> alpha
>>>>>>> bravo
>>>>>>> charlie
>>>>>>>
>>>>>>> (shape 3 7)
>>>>>>>
>>>>>>> Sent from my iPad
>>>>>>>
>>>>>>>
>>>>>>> On Sep 6, 2012, at 11:38 AM, Ian Clark <[email protected]> wrote:
>>>>>>>
>>>>>>>> Kindergarten class...
>>>>>>>>
>>>>>>>> I have a list of boxed literals...
>>>>>>>> z=: 'alpha' ; 'bravo' ; 'charlie'
>>>>>>>>
>>>>>>>> I want to flatten it to a literal, but with spaces between. (Variant:
>>>>>>>> --with LF's).
>>>>>>>>
>>>>>>>> Raze (;) does indeed flatten the list...
>>>>>>>> ;z
>>>>>>>> alphabravocharlie
>>>>>>>>
>>>>>>>> There's got to be a really neat extended Raze which includes
>>>>>>>> separators. But the fastest I've been able to come up with is:
>>>>>>>>
>>>>>>>> b2o=: }.@((<' ') ;@,. ])
>>>>>>>> b2o z
>>>>>>>> alpha bravo charlie
>>>>>>>>
>>>>>>>> Any advances?
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>> 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
>>>>> ----------------------------------------------------------------------
>>>>> 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
>> ----------------------------------------------------------------------
>> 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