123456789101112131415161718192021open!BaseincludeAdjustable_intf.Definitions(* The following functions that generate unique values don't need to worry about integer
overflow because we generate integers with [Generator.small_positive_or_zero_int]. *)letrecunique_intnlist=ifList.memlistn~equal:(=)thenunique_int(n+1)listelsen;;letnon_overlapping_intslist=List.foldlist~init:[]~f:(funlistn->unique_intnlist::list)|>List.rev;;letunique(typea:value_or_null)(moduleA:Swithtypet=a)alist=A.seta(unique_int(A.geta)(List.map~f:A.getlist));;letnon_overlapping(typea:value_or_null)(moduleA:Swithtypet=a)list=List.map2_exn~f:A.setlist(non_overlapping_ints(List.map~f:A.getlist));;