src/HOL/List.thy
changeset 55147 bce3dbc11f95
parent 55129 26bd1cba3ab5
child 55148 7e1b7cb54114
equal deleted inserted replaced
55146:525309c2e4ee 55147:bce3dbc11f95
  6316 
  6316 
  6317 open Basic_Code_Thingol;
  6317 open Basic_Code_Thingol;
  6318 
  6318 
  6319 fun implode_list nil' cons' t =
  6319 fun implode_list nil' cons' t =
  6320   let
  6320   let
  6321     fun dest_cons (IConst { name = c, ... } `$ t1 `$ t2) =
  6321     fun dest_cons (IConst { sym = Code_Symbol.Constant c, ... } `$ t1 `$ t2) =
  6322           if c = cons'
  6322           if c = cons'
  6323           then SOME (t1, t2)
  6323           then SOME (t1, t2)
  6324           else NONE
  6324           else NONE
  6325       | dest_cons _ = NONE;
  6325       | dest_cons _ = NONE;
  6326     val (ts, t') = Code_Thingol.unfoldr dest_cons t;
  6326     val (ts, t') = Code_Thingol.unfoldr dest_cons t;
  6327   in case t'
  6327   in case t'
  6328    of IConst { name = c, ... } => if c = nil' then SOME ts else NONE
  6328    of IConst { sym = Code_Symbol.Constant c, ... } => if c = nil' then SOME ts else NONE
  6329     | _ => NONE
  6329     | _ => NONE
  6330   end;
  6330   end;
  6331 
  6331 
  6332 fun default_list (target_fxy, target_cons) pr fxy t1 t2 =
  6332 fun default_list (target_fxy, target_cons) pr fxy t1 t2 =
  6333   Code_Printer.brackify_infix (target_fxy, Code_Printer.R) fxy (
  6333   Code_Printer.brackify_infix (target_fxy, Code_Printer.R) fxy (