Shift Spread

I have an interesting problem, basically I have a spread of text information, let’s just for example take a list of names:

bob, john, rick, elmo, randy

Each holds a place in a spread, I want to shift elmo to the top so it looks like:

elmo, bob, john, rick, randy

It seems so simple in my brain, but I’m having real trouble patching it. In a nutshell the final product will allow me to change the order of each name until it’s correctly sorted.

Any help would be greatly appreciated.


sounds like a kind of swapping. a very basic one in the attached patch…
for dynamic swapping you will need to define a sorting criteria (like alphabetical) and implement a kind of sorting algorithm or use the sort / shift nodes


swap.v4p (7.4 kB)

It’s tricky one, I think you’ve put me on the right track, I’m currently working on a patch that extracts the name I want to move, by shifting the data until the name is at the top then CAR it out, then shift the remaining data until the new location desired is found then Cons it into the spread again at the right spot, then shift back to original order. It’s proving to be a real brain teaser, especially now that I have to go to work for 8 hours a stew over it!

mh superfly maybe this one helps you…

swap2.v4p (6.6 kB)

Managed to crack it, while at work as well which is doubly satisfying. Pretty much did what was in my last post, but had to do some brute patching to get it to work right. Getting the data to stay put and not shift after the desired name was reinserted. The patch is a bit of a birds nest! Unfortunately I left my usb key at work in the machine so can’t play with it now! :( The final patch is pretty nifty, worthy of the modules page for sure, will upload it tomorrow night.

Here is the patch

Shift String (Spreads).v4p (29.8 kB)

And the help file

Shift String (Spreads) help.v4p (12.0 kB)

Just managed to repatch a different way, heaps cleaner, and in about 2 minutues!

Shift string simple.v4p (8.8 kB)

Just managed to repatch a different way, heaps cleaner, and in about 2 minutues!

Patch and Learn!! Always best to this yourself :)

First I thought, simple Getslice/Intsert slice… but then they don’t shif…

Well… nice work!!