helper: convert_sexp_to_array
add conditional support