Skip to content
cakeplus edited this page Apr 30, 2013 · 4 revisions

Non-backwards-compatible changes:

  • Batteries_uni is dead. Always open Batteries (unless accessing BatFoo directly to minimize executable size).
  • All syntax extensions removed (pa_comprehension, estring, pa_lazylist). These can be put in an external project for continued usage. Max Mouratov has packaged pa_comprehension.
  • BatPrint and related printing functionality that depended on estring is removed. Use print functions in each module to build printers and %a to include in printf.
  • The inconsistently available sprint functions are removed in favor of BatIO.to_string, which turns any printing function to have string output.
  • List.make_compare and Array.make_compare are renamed to compare. Buffer.output_buffer now makes a string IO.output backed by a buffer object; use Buffer.print to print buffers.
  • Comparison operators for numeric types moved to Compare submodule so that opening Int64 doesn't override (=). Arithmetic operators for numeric types copied into Infix submodule so that it can be locally opened to provide easy access.
  • List.unique_eq replaced by unique_hash that uses a hash table to make finding identical members faster.
  • Map.filter repaced by Map.filterv, filteri is now filter, for compatibility with base stdlib.
  • The default ('a, 'b) Map.t and 'a Set.t no longer have a customizable comparison function; to get the old Extlib.PMap behavior, use Map.PMap.* (Set.PSet.*).
  • Default instantiations of Map and Set are no longer available. (i.e. StringSet, IStringMap, etc.) These may be added to String, Int, etc. in 2.1.
  • Map.exists now uses a two-argument predicate that takes both key and value, as previous Map.exists_f.
  • Random.full_range renamed to Random.full_range_int
  • String.split,rsplit,nsplit now use a labeled argument for their splitting string to avoid reversing the splitting string and the string to be split.
  • File.finally properly moved to BatPervasives.
  • Global.get and opt renamed to get_exn and get respectively.
  • To reduce inter-module dependencies, removed printing functions IO.output_buffer, read_uall, read_uchar, read_rope, read_uline, ulines_of, uchars_of, IO.printf moved to BatPrintf module, write_*s functions for printing an enum of some value removed, as Enum.iter (Foo.print oc) works well.
  • LazyList.iteri argument function must return unit, not 'b
  • Module BatOptParse removed; use Arg instead.
  • Module PSet and PMap moved inside Set and Map
  • RefList.add_sort, sort parameter ?cmp now mandatory.
  • Module Std removed, all functions (that still exist) are in Pervasives
  • Module Monad moved into BatInterfaces.
  • Module Pair removed, now provided by Tuple2.
  • Module PathGen moved into Incubator, in preparation for interface changes, should return stably before 3.0.
  • Result rewritten with lots more useful helper functions,
  • Use of suffix n in Tuple made consistent with other usage: foo takes one function for each component, foon works on homogenous tuples and takes one function total.
  • Tuple.prj* renamed to get*
  • Module UCharParser removed
  • Vect.sub argument order made consistent with String.sub and Array.sub
  • IMap now takes an equality predicate on construction instead of on each add.
  • IMap.union renamed to merge to correspond with Map.merge, union now much simpler interface to simply join maps, only needing to resolve value of conflicting keys.
  • UChar and UTF8 provided without dependency on Camomile.
  • Rope renamed Text
  • uppercase and lowercase removed from Pervasives
  • Function compostion operators changed: @@ for apply, % for compose, |> for revapply (unchanged), %> for rev-compose
  • Removed first, second, *** and &&&; use Tuple functions instead
  • Mutex, RMutex modules moved to BatteriesThread module, open this in addition to Batteries if you're using them.

New functions:

  • Pervasive use of compare and equal for constructing comparison and equality tests combinatorially, like print.
  • Array gains new functions sum,fsum,left,right,head,tail,fold_righti
  • Hashtbl.print gets new optional argument ~kvsep to set the text used to separate keys and values.
  • List gains new functions rev_map2, transpose to transpose a rectangular list of lists.
  • Random.multi_choice allows the choosing of n random values from an enumeration.
  • Set.sym_diff function to compute the symmetric difference between two sets.
  • Set.disjoint can quickly identify if two sets have no common elements without computing their intersection.
  • String.nreplace added to search/replace globally
  • Enum.fsum, with Kahan summing to reduce error when adding a list of floats
  • Enum.get_exn to get the head of the enum and raise an exception if it is empty.
  • Enum.find_map to get the first non-None result of a function on the input enum.
  • File.open_temporary* have additional paremeter ?temp_dir to set the directory of the file
  • Option.apply and filter added, also (|?) as a flipped synonym for Option.default
  • Ref.toggle added to invert a bool ref
  • Ref.oset,oget_exn added to make 'a option ref easier to use.
  • Hashcons functions fold and count exposed
  • New module BatHeap added.
  • New module FingerTree added.
  • MultiMap added to specicialize MultiPMap for just Pervasives.compare.
  • Seq gets an Infix module that provides the functions that Enum has.
  • Float.round, round_to_int and round_to_string
  • Float constants: e, log2e, log10e, ln2, ln10, pi2, pi4, invpi, invpi2, sqrtpi2, sqrt2, invsqrt2
  • Float.approx_equal to compare floats with epsilon precision
  • Int.min, max for performance, mid for correct computation of midpoint of two numbers wrt. overflow, and popcount/popcount_sparse for counting set bits in an int.
  • New incubator modules (unstable interface): BatLog, a new logging module, BatSubstring, a substring class that needs to be changed to OCaml style, and BatBounded, for normalizing values within a bounded range.
  • Pervasives.print_any to dump any value to a channel
  • `input_lines/chars/list/all' to read in a channel into a string enum/char enum/string list/string
  • output_file/input_file to read or write files as strings; very simple interface
  • neg, neg2 to negate predicate functions of one or two parameters
  • forever to run a function until it raises an exception
  • ignore_exceptions as ignore, but eats exceptions too
  • verify_arg a helper function to raise Invalid_arg if a condition is not met.
  • Result functions ignore_ok, ok and wrap made available in Pervasives.