Interpreter and library.
Revision | aa43eb668492e03a5d2c6cc5010479f6e0cba220 (tree) |
---|---|
Time | 2020-12-19 09:10:45 |
Author | Simon Forman <sforman@hush...> |
Commiter | Simon Forman |
Minor cleanup.
@@ -206,17 +206,15 @@ def dnd(stack, from_index, to_index): | ||
206 | 206 | h, stack = stack |
207 | 207 | head.append(h) |
208 | 208 | diff += 1 |
209 | - stack = item, stack | |
210 | - while head: | |
211 | - stack = head.pop(), stack | |
212 | 209 | else: |
213 | 210 | # from > to |
214 | 211 | # so the destination is in the head list |
215 | - while head: | |
212 | + while diff: | |
216 | 213 | stack = head.pop(), stack |
217 | - from_index -= 1 | |
218 | - if from_index == to_index: | |
219 | - stack = item, stack | |
214 | + diff -= 1 | |
215 | + stack = item, stack | |
216 | + while head: | |
217 | + stack = head.pop(), stack | |
220 | 218 | return stack |
221 | 219 | |
222 | 220 |