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

[REBOL] Poke and Pick and binary! Part 2

From: reboler::programmer::net at: 4-May-2001 11:45

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! First, if I add the "to-char" refinement then other types of series no longer work (try adding the "to-char" change and then swap elements of [1 2 3 4 5 6 7 8 9 0] !). Second, is there a rebol native or mezzanine that does this already? Third, if the answer to "2" is "false", any suggestions on changing the s-swap function so that it will swap elements of any type of series (the primary focus of this is to be able to swap block!s string!s and compressed string!s - which are binary!) ;Here is the function as it stands********** s-swap: func [{swaps the elements of two series at the given index positions} a [series!] "1st series" index-a [integer!] "index position to swap in 1st series" b [series!] "2nd series" index-b [integer!] "index position to swap in 2nd series" /local holder ] [ holder: pick a index-a poke a index-a pick b index-b poke b index-b holder ] ;****************