a=: '93930001029303040593060708'
   reverse=:,@:( _2 &(|.\))@:|.
   reverse1=: ,@:|.@:(_2&(]\))

   (reverse a) -: (reverse1 a)
1

Thanks,
Vijay.

On Fri, Jun 19, 2015 at 8:39 AM, Linda Alvord <lindaalv...@verizon.net> wrote:
> Mine was easy. Just add |. To it:
>
>    A=:'93930001029303040593060708'
>    ,(|.((-:$A),2)$A),"1 ' '
> 08 07 06 93 05 04 03 93 02 01 00 93 93
>
> Linda
>
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Jon Hough
> Sent: Friday, June 19, 2015 6:27 AM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Inserting spaces in a string
>
> Lots of interesting answers, thanks.
> As a subquestion, I am also want to reverse the bytes (but not changing the
> order of letters in each byte). e.g. beef would become efbe My solution is
> (which I used some of the answers to my last question to formulate)
> a=: '93930001029303040593060708'
>
> , _2 (|."_)\|. a
>
>
> Implicit:
>
>
>
>
> reverse=:,@:( _2 &(|.\))@:|.
>
>
> Any interesting solutions to this? I would be interested in a way that only
> uses |. once at most.
>
>> Date: Fri, 19 Jun 2015 08:33:35 +0200
>> From: agroeneveld...@gmail.com
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramming] Inserting spaces in a string
>>
>> Here's one with variable RHA
>>
>> '93930001029303040593060708' (;: inv@ (<\~-)) 2
>>
>>
>> Vijay Lulla schreef op 19-06-15 om 03:32:
>> > s=. '93930001029303040593060708'
>> > }. , _2(' '&,)\ s
>> >
>> > On Thu, Jun 18, 2015 at 8:47 PM, Jon Hough <jgho...@outlook.com> wrote:
>> >> I have a hex string
>> >>   93930001029303040593060708
>> >>   and I want to insert spaces between each byte, i.e. I want
>> >>
>> >>   93 93 00 01 02 93 03 04 05 93 06 07 08
>> >>
>> >>
>> >> My current method works fine, but seems a little clunky, plus it
>> >> adds a trailing space onto the end of the string, which isn't the
>> >> end of the world and can be cleaned up, but I want to know a
>> >> terser, more elegant method.  My current method
>> >>
>> >>
>> >>
>> >>
>> >> ,@:(' '&(,~"1))@:(,&2@:(-:@:#) $ ])
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> -------------------------------------------------------------------
>> >> --- For information about J forums see
>> >> http://www.jsoftware.com/forums.htm
>> > --------------------------------------------------------------------
>> > -- For information about J forums see
>> > http://www.jsoftware.com/forums.htm
>>
>> --
>> Met vriendelijke groet,
>> @@i = Arie Groeneveld
>>
>> ----------------------------------------------------------------------
>> 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

Reply via email to