Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Command which allows given items from given list to be recycled based
- // on basic index reordering, usage: /recyclelist $list [indexes] "step"
- // example with a step of 2 and 3 respectively with a list of "1 3 5 7 9"
- // and indexes the list itself, will result: "5 7 9 1 3" / "7 9 1 3 5"
- recyclelist = [
- local l n tmp
- l = (- (listlen $arg2) (= $arg2 -1)) ; n = (- $l $arg3) ; tmp = $arg1
- // do (format "n = (concat (sublist %1 %2 %3) (sublist %1 0 %2))" ( //
- // ? (= $arg2 -1) (loopconcat i $l [result $i]) $arg2 // could work somehow?
- // ) $n $arg3) //
- n = (concat (sublist $arg2 $n $arg3) (sublist $arg2 0 $n))
- loop i $l [
- tmp = (listsplice $tmp [[@@(at $arg1 (at $arg2 $i))]] (at $n $i) 1)
- ]
- result $tmp
- ]
Advertisement
Add Comment
Please, Sign In to add comment