def range_decompress(cl):
def cond_func(ele):<EOL><INDENT>length = ele.__len__()<EOL>cond = (length == <NUM_LIT:1>)<EOL>if(cond):<EOL><INDENT>return(ord(ele))<EOL><DEDENT>else:<EOL><INDENT>x = ord(ele[<NUM_LIT:0>])<EOL>y = ord(ele[<NUM_LIT:1>])<EOL>return((x,y))<EOL><DEDENT><DEDENT>if(type(cl[<NUM_LIT:0>])==type(<NUM_LIT:0>)):<EOL><INDENT>T = True<EOL><DEDENT>elif(cl[<NUM_LIT:0>].__len__() == <NUM_LIT:1>):<EOL><INDENT>T = (type(cl[<NUM_LIT:0>]) == type(<NUM_LIT:0>))<EOL><DEDENT>else:<EOL><INDENT>T = (type(cl[<NUM_LIT:0>][<NUM_LIT:0>]) == type(<NUM_LIT:0>))<EOL><DEDENT>if(T):<EOL><INDENT>l = cl <EOL><DEDENT>else:<EOL><INDENT>l = array_map(cl,cond_func)<EOL><DEDENT>rslt = []<EOL>for i in range(<NUM_LIT:0>,l.__len__()):<EOL><INDENT>ele = l[i]<EOL>if(type(ele) == type(<NUM_LIT:0>)):<EOL><INDENT>arr = [ele]<EOL><DEDENT>elif(ele.__len__() == <NUM_LIT:1>):<EOL><INDENT>arr = [ele]<EOL><DEDENT>else:<EOL><INDENT>sv = ele[<NUM_LIT:0>]<EOL>ev = ele[<NUM_LIT:1>]<EOL>arr = init_range(sv,ev+<NUM_LIT:1>,<NUM_LIT:1>)<EOL><DEDENT>if(T):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>arr = array_map(arr,chr)<EOL><DEDENT>rslt.extend(arr)<EOL><DEDENT>return(rslt)<EOL>
#only support sorted-ints or sorted-ascii
cl = [1, (5, 8), (13, 14), 18, (30, 34)]
range_decompress(cl)
cl = [1, (5, 8), (13, 14), 18, (30, 34), 40]
range_decompress(cl)
cl = [('a', 'd'), ('j', 'n'), 'u', ('y', 'z')]
range_decompress(cl)