str2lst(str) == [ord(str.i)-65 for i in 1..#str]

lst2str(lst) == concat [char(lst.i+65)::String for i in 1..#lst]

str2num(str) ==
  local strlst
  strlst:=[ord(str.i) for i in 1..#str]
  return wholeRadix(strlst)$RadixExpansion(256)::INT

num2str(n) ==
  local tmp
  tmp:=wholeRagits(n::RadixExpansion(256))
  return concat [char(tmp.i)::String for i in 1..#tmp]

superIncreasing?(lst) ==
  reduce(/\,[lst.i>reduce(+,[lst.j for j in 1..i-1]) for i in 2..#lst])

siSolve(lst,n) ==
  local res,m,i
  if not superIncreasing?(lst) then error "The list is not super-increasing"
  m := n
  res := [0 for i in 1..#lst]
  for i in #lst..1 by -1 repeat
    if lst.i <= m then
      res.i := 1
      m := m - lst.i
      if m = 0 then return res
  error "Unsolvable"

subsetsum(L:List(INT),N:INT):List(INT) ==
  local x,Y
  if N=0 then return([])
  if N<0 or #L=0 then return([-1])
  for x in L repeat
    Y:=subsetsum(remove(x,L),N)
    if Y~=[-1] then return(Y)
    Y:=subsetsum(remove(x,L),N-x)
    if Y~=[-1] then return(cons(x,Y))
    return([-1])
