added functions to encode boolean list pattern in integer and visa versa