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.
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
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!
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.