elems idx =
  here idx ++
  concatMap elems (map snd (toList (fun idx))) ++
  elems (var idx)
elems idx =
  here idx ++
  concatMap elems (map snd (toList (fun idx))) ++
  elems (var idx)
elems idx =
  here idx ++
  concatMap elems (map snd (toList (fun idx))) ++
  elems (var idx)