utils.anubis 952 Bytes
/*
 * Created by PyramIDE.
 * User: フランスのトトロ aka (David RENÉ) 
 * Date: 13/02/2016
 * Time: 10:39
 * © David RENÉ
 */

read tools/basis.anubis
read hayamiki_lib/types/hayamiki.anubis

public define Int 
  longest_table_name_size
  (
    List(HK_App)  apps,
    Int           current_size
  )=
  if apps is
  {
    []              then  current_size,
    [app . t_apps]  then
      since app is hk_app(_, _, _, tables),
      with max_size = max(map((HK_Table  table) |-> length(table.name), tables), current_size),
      longest_table_name_size(t_apps, max_size)
  }.
  
define Int
  _max
  (
    List(HK_Model_Column) columns,
    Int                   current_max
  )=
  if columns is
  {
    []      then  current_max,
    [h . t] then  
      since h is hk_column(name, _, _, _),
        _max(t, max(current_max, length(name)))
  }
  .
  
public define Int
  max
  (
    List(HK_Model_Column) columns
  )=
  _max(columns, 0).