-
Notifications
You must be signed in to change notification settings - Fork 106
Interfacechanges12
cakeplus edited this page Apr 30, 2013
·
4 revisions
-
Batteries_uni
is dead. Alwaysopen Batteries
(unless accessingBatFoo
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 ofBatIO.to_string
, which turns any printing function to have string output. -
List.make_compare
andArray.make_compare
are renamed tocompare
.Buffer.output_buffer
now makes astring IO.output
backed by a buffer object; useBuffer.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 intoInfix
submodule so that it can be locally opened to provide easy access. -
List.unique_eq
replaced byunique_hash
that uses a hash table to make finding identical members faster. -
Map.filter
repaced byMap.filterv
,filteri
is nowfilter
, 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 oldExtlib.PMap
behavior, useMap.PMap.*
(Set.PSet.*
). - Default instantiations of Map and Set are no longer available. (i.e.
StringSet
,IStringMap
, etc.) These may be added toString
,Int
, etc. in 2.1. -
Map.exists
now uses a two-argument predicate that takes both key and value, as previousMap.exists_f
. -
Random.full_range
renamed toRandom.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 toBatPervasives
. -
Global.get
andopt
renamed toget_exn
andget
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 toBatPrintf
module,write_*s
functions for printing an enum of some value removed, asEnum.iter (Foo.print oc)
works well. -
LazyList.iteri
argument function must return unit, not'b
- Module
BatOptParse
removed; useArg
instead. - Module
PSet
andPMap
moved insideSet
andMap
-
RefList.add_sort, sort
parameter?cmp
now mandatory. - Module
Std
removed, all functions (that still exist) are inPervasives
- Module
Monad
moved intoBatInterfaces
. - Module
Pair
removed, now provided byTuple2
. - 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 toget*
- Module
UCharParser
removed -
Vect.sub
argument order made consistent withString.sub
andArray.sub
-
IMap
now takes an equality predicate on construction instead of on each add. -
IMap.union
renamed tomerge
to correspond withMap.merge
,union
now much simpler interface to simply join maps, only needing to resolve value of conflicting keys. -
UChar
andUTF8
provided without dependency on Camomile. -
Rope
renamedText
-
uppercase
andlowercase
removed fromPervasives
- 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 toBatteriesThread
module, open this in addition toBatteries
if you're using them.
- Pervasive use of
compare
andequal
for constructing comparison and equality tests combinatorially, likeprint
. -
Array
gains new functionssum,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 functionsrev_map2
,transpose
to transpose a rectangular list of lists. -
Random.multi_choice
allows the choosing ofn
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
andfilter
added, also(|?)
as a flipped synonym forOption.default
-
Ref.toggle
added to invert a bool ref -
Ref.oset,oget_exn
added to make'a option ref
easier to use. -
Hashcons
functionsfold
andcount
exposed - New module
BatHeap
added. - New module
FingerTree
added. -
MultiMap
added to specicializeMultiPMap
for justPervasives.compare
. -
Seq
gets anInfix
module that provides the functions thatEnum
has. -
Float.round
,round_to_int
andround_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, andpopcount/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, andBatBounded
, for normalizing values within a bounded range. -
Pervasives.print_any
todump
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 raiseInvalid_arg
if a condition is not met. -
Result
functionsignore_ok
,ok
andwrap
made available inPervasives
.