1
0
dust/examples/fannkuch-redux.ds

22 lines
308 B
Plaintext
Raw Normal View History

2023-10-28 14:28:43 +00:00
numbers = (from_json input)
flip_count = 0
checksum = 0
while numbers.0 != 1 {
(reverse numbers 0 numbers.0)
if flip_count % 2 == 0 {
checksum += flip_count
} else {
checksum -= flip_count
}
checksum += flip_count * 1
flip_count += 1
}
(output numbers)
(output flip_count)
(output checksum)