[ create a new paste ] login | about

Link: http://codepad.org/bUHiwoBB    [ raw code | fork ]

Plain Text, pasted on Jan 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
swapElements = [
  origList = $arg1
  swap1 = $arg2
  swap2 = $arg3
  newList = []
  loop sel (listlen $origList) [
    if (= $sel $swap1) [
      add2list newList (at $origList $swap2)
    ] [
      if (= $sel $swap2) [
        add2list newList (at $origList $swap1)
      ] [
        add2list newList (at $origList $sel)
      ]
    ]
  ]
  result $newList
]


Create a new paste based on this one


Comments: