Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Poke and Pick and binary! Part 2

From: joel:neely:fedex at: 4-May-2001 11:38

Hi, Alan, ...try this. alan parman wrote:
> Thanx! Anton, Joel Neely, and "Larry Palmiter". I now understand a little > more. > > But... > > The reason I want to do this is to swap elements of _any_ series! > The previous code was part of the following function, the purpose of which > is to swap elements in any type of series! >
swapper: func [s [series!] i [integer!] j [integer!] /local si sj] [ si: copy/part at s i 1 sj: copy/part at s j 1 change at s i sj change at s j si ] which behaves as follows...
>> foo: "this is a Test"
== "this is a Test"
>> swapper foo 1 11 foo
== "This is a test"
>> foo: to-binary "this is a Test"
== #{7468697320697320612054657374}
>> swapper foo 1 11 foo
== #{5468697320697320612074657374}
>> to-string foo
== "This is a test" Improvements, anyone? -jn-