Ddoc $(COMMENT Pending changelog for 2.072. This will get copied to dlang.org and cleared when master gets merged into stable prior to 2.072. ) $(BUGSTITLE Library Changes, $(LI $(RELATIVE_LINK2 process, Process creation in `std.process` was sped up on Posix.)) $(LI $(RELATIVE_LINK2 std-algorithm-iteration-cumulativeFold, `algorithm.iteration.cumulativeFold` was added.)) $(LI $(RELATIVE_LINK2 padLeft-padRight, `std.range.padLeft` and `std.range.padRight` were added.)) $(LI $(RELATIVE_LINK2 regex-multiple-patterns, `std.regex.regex` now supports matching multiple patterns in one go.)) $(LI $(RELATIVE_LINK2 regex-with-matches, `std.regex.splitter` now supports keeping the pattern matches in the resulting range.)) $(LI $(RELATIVE_LINK2 optimization, `findLocalMin` was added to `std.numeric`.)) $(LI $(RELATIVE_LINK2 slice_ptr, `ptr` property and public constructor were added to `std.experimental.ndslice.slice.Slice`.)) $(LI $(RELATIVE_LINK2 slice_alloc, `slice`, `shape`, `ndarray`, and other utilities were added to `std.experimental.ndslice.slice`.)) $(LI $(RELATIVE_LINK2 slice_iota, `iotaSlice` lazy tensor was added to `std.experimental.ndslice.selection`.)) $(LI $(RELATIVE_LINK2 slice_mio, partial support for Math Index Order was added to `std.experimental.ndslice.slice.Slice`.)) $(LI $(RELATIVE_LINK2 mutation, `std.algorithm.mutation.swapAt` was exposed)) $(LI $(RELATIVE_LINK2 iota-length-size_t, `std.range.iota's `.length` property is fixed to `size_t` instead of the type being iterated)) $(LI $(REF isNumber, std,uni) and $(REF isPunctuation, std,uni) now use a separate, optimized path for ASCII inputs.) $(LI $(REF isAlphaNum, std,uni), which is analogous to $(REF isAlphaNum, std,ascii) was added.) $(LI $(REF regex, std,regex) now supports inline comments with (?#...) syntax.) $(LI std.regex had numerous optimization applied, compile-time $(REF ctRegex, std,regex) should now be generally faster then the run-time version.) $(LI $(REF moveAt, std,range,primitives) accepts only `size_t` for its index arguments.) $(LI $(REF isStrictlyMonotonic, std,algorithm,sorting) which doesn't allow equal values was added.) $(LI $(REF readLink, std,file) and $(REF symlink, std,file) have been rangified.) $(LI All overloads of `std.conv.toImpl` has been made private. Please use $(REF to, std,conv) instead.) $(LI $(RELATIVE_LINK2 min-max-element, `std.algorithm.searching.{min,max}Element` for ranges have been added.)) $(LI $(REF Ternary, std,typecons) was added to represent three valued logic.) ) $(BUGSTITLE Library Changes, $(LI $(LNAME2 process, Process creation in `std.process` was sped up on Posix.) $(P Previously, Posix systems would attempt to close every file descriptor from 3 to the maximum file descriptor number if `inheritFDs` was not specified with `spawnProcess`, `pipeProcess`, etc. $(STDMODREF process, std.process) now uses `poll()` to determine which descriptors need closing. ) ) $(LI $(LNAME2 std-algorithm-iteration-cumulativeFold, `algorithm.iteration.cumulativeFold` was added.)) $(P $(REF cumulativeFold, std,algorithm,iteration) returns the successive reduced values of an input range.) ------ assert([1, 2, 3, 4, 5].cumulativeFold!((a, b) => a + b).array == [1, 3, 6, 10, 15]); assert([1, 2, 3].cumulativeFold!((a, b) => a + b)(100).array == [101, 103, 106]); ------ ) $(LI $(LNAME2 padLeft-padRight, `std.range.padLeft` and `std.range.padRight` were added.) $(P $(REF padLeft, std,range) and $(REF padRight, std,range) are functions for padding ranges to a specified length using the given element. ) ------- import std.range; import std.algorithm.comparison; assert([1, 2, 3, 4, 5].padLeft(0, 7).equal([0, 0, 1, 2, 3, 4, 5])); assert("Hello World!".padRight('!', 15).equal("Hello World!!!!")); ------- ) $(LI $(LNAME2 regex-multiple-patterns, `std.regex.regex` now supports matching multiple patterns in one go.) ------- import std.regex; // multi-pattern regex auto multi = regex([`\d+,\d+`,`(a-z]+):(\d+)`]); auto m = "abc:43 12,34".matchAll(multi); assert(m.front.whichPattern == 2); assert(m.front[1] == "abc"); assert(m.front[2] == "43"); m.popFront(); assert(m.front.whichPattern == 1); assert(m.front[1] == "12"); ------- ) $(LI $(LNAME2 regex-with-matches, $(REF splitter, std,regex) now supports keeping the pattern matches in the resulting range.) ------- import std.regex; import std.algorithm.comparison : equal; auto pattern = regex(`([\.,])`); assert("2003.04.05" .splitter!(No.keepSeparators)(pattern) .equal(["2003", "04", "05"])); assert("2003.04.05" .splitter!(Yes.keepSeparators)(pattern) .equal(["2003", ".", "04", ".", "05"])); ------- ) $(LI $(LNAME2 optimization, `findLocalMin` was added to `std.numeric`.) $(P $(REF findLocalMin, std,numeric) finds a real minimum of a real function `f(x)` via bracketing.) ------- import std.numeric, std.math; auto ret = findLocalMin((double x) => (x-4)^^2, -1e7, 1e7); assert(ret.x.approxEqual(4.0)); assert(ret.y.approxEqual(0.0)); ------- ) $(LI $(LNAME2 slice_ptr, `ptr` property and public constructor were added to `std.experimental.ndslice.slice.Slice`.) $(P `ptr` property allows to access `Slice`'s underlaying pointer or range. Please refer to $(REF Slice, std,experimental,ndslice,slice)'s internal binary epresentation before using the property. `ptr` property is used in $(LINK2 https://github.com/libmir/mir, Mir) for $(LINK2 http://docs.mir.dlang.io/latest/mir_sparse_package.html, sparse tensors). `ndslice` developer mirror in Mir will be removed as soon as LDC (LLVM D compiler) supports D version 2.072.. ) $(P Public constructor for `Slice` was added to support $(STDMODREF ndslice, std.experimental.ndslice) integration with other languages and libraries such as Julia language and NumPy library. ) ) $(LI $(LNAME2 slice_alloc, `slice`, `shape`, `ndarray`, and other utilities were added to `std.experimental.ndslice.slice`.) $(P $(REF shape, std,experimental,ndslice,slice) $(REF slice, std,experimental,ndslice,slice), $(REF makeSlice, std,experimental,ndslice,slice), $(REF ndarray, std,experimental,ndslice,slice), and $(REF makeNdarray, std,experimental,ndslice,slice) allocation utilities were added to $(STDMODREF ndslice.slice, std.experimental.ndslice) ) $(P Example: Transposing common 2D array using `ndslice`) ----- import std.experimental.ndslice; auto ar = [[0, 1, 2], [3, 4, 5]]; auto sh = ar.shape; // [2, 3] type of size_t[2] auto sl = slice!int(sh); // allocates slice with corresponding shape sl[] = ar; // fills sl with values from ar ar = sl.transposed.ndarray; // allocates common 2D array assert(ar == [[0, 3], [1, 4], [2, 5]]); ----- ) $(LI $(LNAME2 slice_iota, `iotaSlice` lazy tensor was added to `std.experimental.ndslice.selection`.) %(P $(REF iotaSlice, std,experimental,ndslice,selection) is the fastest possible `Slice`.) --- import std.experimental.ndslice; auto sl = iotaSlice([2, 3], 10); assert(sl.transposed == [[10, 13], [11, 14], [12, 15]]); --- ) $(LI $(LNAME2 slice_mio, partial support for Math Index Order was added to `std.experimental.ndslice.slice.Slice`.) --- import std.experimental.ndslice; auto sl = iotaSlice(3, 4); assert(sl[2, 3] == 11); // D & C index order assert(sl(3, 2) == 11); // Math & Fortran index order --- ) $(LI $(LNAME2 mutation, `std.algorithm.mutation.swapAt` was exposed) $(P $(REF swapAt, std,algorithm,mutation) allows to swap elements of a RandomAccessRange by their indices. ) ) $(LI $(LNAME2 iota-length-size_t, `std.range.iota's `.length` property is fixed to `size_t` instead of the type being iterated) $(P $(REF iota, std,range)'s `.length` property is now always returned as `size_t`. This means if you are on a 32-bit CPU and you are using iota to iterate 64-bit types, the length will be truncated to `size_t`. In non-release mode, you will get an exception if the length exceeds `size_t.max` in your call to `iota`. ) ) $(LI $(LNAME2 min-max-element, `std.algorithm.searching.{min,max}Element` have been added.) $(P $(REF minElement, algorithm,searching) and $(REF maxElement, algorithm,searching) are functions to search for the minimum and maximum element in a range. They support a custom `map` accessor. ) ------- import std.algorithm.searching; import std.range; import std.typecons; assert([3, 1, 4].minElement == 1); assert([4, 7, 5].enumerate.maxElement!`a.value` == tuple(1, 7)); ------- ) ) Macros: TITLE=Change Log BUGSTITLE =
$(H4 $1) $(OL $2 )
RELATIVE_LINK2=$+ LNAME2=$+ STDMODREF = $2 XREF = $2 CXREF = $2 OXREF = $2 NXREF = $2 NCXREF = $2 NOXREF = $2 BOOKTABLE = $+
$1