except .. OOPS! ..

my second version is no faster than my first version.
all that searching for ' ' i guess.

i'm stalled tho.

[":("0)] converts the numbers to strings

but then there's the need to concat the strings - bearing in mind the 
strings may be different lengths.

On 2011-07-19 00:05, mijj wrote:
> oh.. i see ..
> you had 'x' dotted along the string version of the number rather than
> just at the end.
>
> my L/R number pair version
> [(convert to string) : (concat string): (append 'x') : (convert back to
> integer)]
> .. lots of converting back and forth for a sequence of numbers.
>
> so yeh .. faster to :
> [(convert all the sequence on the right to a single string including spaces)
> (remove the spaces)
> (append with 'x')
> (convert back to number)
> ]
>
> i.e.
> concatNumbers =. (,&'x')@(-.&' ')&.":
> concatNumbers 5 $ 1234567890
> NB. 12345678901234567890123456789012345678901234567890
>
>   >: concatNumbers 5 $ 1234567890
> NB. 12345678901234567890123456789012345678901234567891
>
>
> first i tried to :
> [(convert all the numbers in the sequence on the right to individual
> strings)
> (concat the strings)
> (append with 'x')
> (convert back to number)
> ]
> .. but it got too fiddly.  Easier just to remove the ' ' i thought.
>
>
>
> On 2011-07-18 23:21, Brian Schott wrote:
>> Yes, nicely done.
>>
>>> concatIntegers  =. ,&'x'@,&.":
>>> concatIntegers/ (5 $ 1234567890)
>>
>> In continuing to pflog away, I noticed that a slight change of your
>> verb works much faster, but doesn't finish well.
>>
>>      6!:2 ' concatIntegers/ (500 $ 1234567890)'   NB. remember this time
>> 1.2667
>>      6!:2 ' concatIntegers M./ (500 $ 1234567890)'  NB. no improvement
>> 1.23531
>>      6!:2 ' concatIntegers /M. (500 $ 1234567890)' NB. no improvement
>> 1.29468
>>      concatIntegers0  =. ,&'x'@,&":
>>      6!:2 ' concatIntegers0/ (500 $ 1234567890)' NB. big improvement
>> 0.040116
>>      6!:2 ' concatIntegers0/ (5 $ 1234567890)'
>> 0.000163078
>>      ". concatIntegers0/ (5 $ 1234567890) NB. but cannot return to numbers?
>> |ill-formed number
>> |       ".concatIntegers0/(5$1234567890)
>>      $concatIntegers0/ (5 $ 1234567890) NB. this is why, but can it be fixed?
>> 54
>>
>> On Mon, Jul 18, 2011 at 5:50 PM, mijj<[email protected]>   wrote:
>>> (Department of Flogging a Dead Horse)
>>>
>> ----------------------------------------------------------------------
>> 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

Reply via email to