F set_right_adjacent_bits_list(Int n, [Int] b) -> [Int] R (0 .< b.len).map(i -> Int(any(@b[max(0, i - @n) .. i]))) F _list2bin([Int] b) -> String R b.map(x -> String(x)).join(‘’) F _to_list(String bits) -> [Int] R bits.map(char -> Int(char)) print("SAME n & Width.\n") V n = 2 V bits_s = ‘1000 0100 0010 0000’ V first = 1B L(b_str) bits_s.split(‘ ’) V b = _to_list(b_str) V e = b_str.len I first first = 0B print(‘n = ’n‘; Width e = ’e":\n") V result = set_right_adjacent_bits_list(n, b) print(‘ Input b: ’_list2bin(b)) print(‘ Result: ’_list2bin(result)"\n") print("SAME Input & Width.\n") bits_s = ‘01’(10.<0).step(-1).map(x -> ‘0’ * x).join(‘1’) L(n) 4 first = 1B L(b_str) bits_s.split(‘ ’) V b = _to_list(b_str) V e = b_str.len I first first = 0B print(‘n = ’n‘; Width e = ’e":\n") V result = set_right_adjacent_bits_list(n, b) print(‘ Input b: ’_list2bin(b)) print(‘ Result: ’_list2bin(result)"\n")