-
Notifications
You must be signed in to change notification settings - Fork 109
Interfacechanges12
cakeplus edited this page Apr 30, 2013
·
4 revisions
-
Batteries_uniis dead. Alwaysopen Batteries(unless accessingBatFoodirectly 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
printfunctions in each module to build printers and%ato include in printf. - The inconsistently available
sprintfunctions are removed in favor ofBatIO.to_string, which turns any printing function to have string output. -
List.make_compareandArray.make_compareare renamed tocompare.Buffer.output_buffernow makes astring IO.outputbacked by a buffer object; useBuffer.printto print buffers. - Comparison operators for numeric types moved to
Comparesubmodule so that opening Int64 doesn't override(=). Arithmetic operators for numeric types copied intoInfixsubmodule so that it can be locally opened to provide easy access. -
List.unique_eqreplaced byunique_hashthat uses a hash table to make finding identical members faster. -
Map.filterrepaced byMap.filterv,filteriis nowfilter, for compatibility with base stdlib. - The default
('a, 'b) Map.tand'a Set.tno longer have a customizable comparison function; to get the oldExtlib.PMapbehavior, 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.existsnow uses a two-argument predicate that takes both key and value, as previousMap.exists_f. -
Random.full_rangerenamed toRandom.full_range_int -
String.split,rsplit,nsplitnow use a labeled argument for their splitting string to avoid reversing the splitting string and the string to be split. -
File.finallyproperly moved toBatPervasives. -
Global.getandoptrenamed toget_exnandgetrespectively. - To reduce inter-module dependencies, removed printing functions
IO.output_buffer,read_uall,read_uchar,read_rope,read_uline,ulines_of,uchars_of,IO.printfmoved toBatPrintfmodule,write_*sfunctions for printing an enum of some value removed, asEnum.iter (Foo.print oc)works well. -
LazyList.iteriargument function must return unit, not'b - Module
BatOptParseremoved; useArginstead. - Module
PSetandPMapmoved insideSetandMap -
RefList.add_sort, sortparameter?cmpnow mandatory. - Module
Stdremoved, all functions (that still exist) are inPervasives - Module
Monadmoved intoBatInterfaces. - Module
Pairremoved, now provided byTuple2. - Module
PathGenmoved into Incubator, in preparation for interface changes, should return stably before 3.0. -
Resultrewritten with lots more useful helper functions, - Use of suffix
nin Tuple made consistent with other usage:footakes one function for each component,foonworks on homogenous tuples and takes one function total. -
Tuple.prj*renamed toget* - Module
UCharParserremoved -
Vect.subargument order made consistent withString.subandArray.sub -
IMapnow takes an equality predicate on construction instead of on each add. -
IMap.unionrenamed tomergeto correspond withMap.merge,unionnow much simpler interface to simply join maps, only needing to resolve value of conflicting keys. -
UCharandUTF8provided without dependency on Camomile. -
RoperenamedText -
uppercaseandlowercaseremoved fromPervasives - Function compostion operators changed: @@ for apply, % for compose, |> for revapply (unchanged), %> for rev-compose
- Removed
first,second,***and&&&; use Tuple functions instead -
Mutex,RMutexmodules moved toBatteriesThreadmodule, open this in addition toBatteriesif you're using them.
- Pervasive use of
compareandequalfor constructing comparison and equality tests combinatorially, likeprint. -
Arraygains new functionssum,fsum,left,right,head,tail,fold_righti -
Hashtbl.printgets new optional argument~kvsepto set the text used to separate keys and values. -
Listgains new functionsrev_map2,transposeto transpose a rectangular list of lists. -
Random.multi_choiceallows the choosing ofnrandom values from an enumeration. -
Set.sym_difffunction to compute the symmetric difference between two sets. -
Set.disjointcan quickly identify if two sets have no common elements without computing their intersection. -
String.nreplaceadded to search/replace globally -
Enum.fsum, with Kahan summing to reduce error when adding a list of floats -
Enum.get_exnto get the head of the enum and raise an exception if it is empty. -
Enum.find_mapto get the first non-Noneresult of a function on the input enum. -
File.open_temporary*have additional paremeter ?temp_dir to set the directory of the file -
Option.applyandfilteradded, also(|?)as a flipped synonym forOption.default -
Ref.toggleadded to invert a bool ref -
Ref.oset,oget_exnadded to make'a option refeasier to use. -
Hashconsfunctionsfoldandcountexposed - New module
BatHeapadded. - New module
FingerTreeadded. -
MultiMapadded to specicializeMultiPMapfor justPervasives.compare. -
Seqgets anInfixmodule that provides the functions thatEnumhas. -
Float.round,round_to_intandround_to_string - Float constants: e, log2e, log10e, ln2, ln10, pi2, pi4, invpi, invpi2, sqrtpi2, sqrt2, invsqrt2
-
Float.approx_equalto compare floats with epsilon precision -
Int.min, maxfor performance,midfor correct computation of midpoint of two numbers wrt. overflow, andpopcount/popcount_sparsefor 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_anytodumpany 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_fileto read or write files as strings; very simple interface -
neg,neg2to negate predicate functions of one or two parameters -
foreverto run a function until it raises an exception -
ignore_exceptionsas ignore, but eats exceptions too -
verify_arga helper function to raiseInvalid_argif a condition is not met. -
Resultfunctionsignore_ok,okandwrapmade available inPervasives.