Nim/lib/pure
c-blake 7ac1fc81fd Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ?
CDF is a standard ident in all things related to random numbers/sampling,
and full words "cumulativeDistributionFunction" would be silly long, in
this case, IMO.  We use lowercase `cdf` to make it not look like a type,
remove all looping from `sample` letting callers do it.  Besides just
side-stepping any `sampleSize` name choice, callers may want to filter
out samples anyway which this makes slightly simpler.

Also add two variants of `cumsum`, value return and in-place update
distinguished by the var-ness of the first argument.  Add tests for
`int` and `float` for both `cumsum` and the new `sample`.  (The sample
tests exercise the value return mode of `cumsum`.)

Functionality pre-this-PR `sample(a, w)` is now the almost as simple
`for i in 0..<n: sample(a, w.cumsum)`, but this new code factoring is
almost surely better.  The statistical tests pass, as before.

* Address Araq comment in https://github.com/nim-lang/Nim/pull/10084
We can always add in some `var` version later if desired to save
memory, but this change now at least firms up the `sample` interface.

* Rename `cumsum` -> `cumsummed` to honor NEP1 style.  Re-instate `cumsum` as
the in-place transformation.  Test both in `tests/stdlib/tmath.nim` and use
`cumsummed` in the example code for sample since that's a simpler example.

* Fix requests from https://github.com/nim-lang/Nim/pull/10084 :
  example in lib/pure/math.nim and comment whitespace in lib/pure/random.nim
2018-12-31 14:52:51 +01:00
..
collections help Nim optimize intsets.initIntSet 2018-12-30 11:45:16 +01:00
concurrency manual: Fix links to Parallel & Spawn (#9342) 2018-10-13 08:55:34 +02:00
includes os.nim: big refactoring, use the new pathnorm that was extracted by compiler/pathutils.nim; added os.relativePath 2018-12-13 12:05:50 +01:00
ioselects fixes #7667; underlying issue is that dot calls in generics have no concept of 'friend' symbols, will be addressed later 2018-10-29 13:46:55 +01:00
unidecode fixes #8768 properly 2018-08-30 16:54:03 +02:00
algorithm.nim 8684 add shortcut sort procs (#9174) 2018-10-11 22:51:23 +02:00
async.nim Unify async macro and futures for js and native targets 2018-01-05 16:40:51 +02:00
asyncdispatch.nim Merge async common into asyncdispatch. 2018-12-07 22:47:10 +00:00
asyncdispatch.nim.cfg
asyncfile.nim Added FileMode to comment on asyncfile openAsync (#8008) 2018-06-11 00:53:42 -04:00
asyncftpclient.nim asyncftpclient: add missing file.close to retrFile 2018-07-02 18:07:24 +02:00
asyncfutures.nim complete future only once in or (fixes #8982) (#9632) 2018-11-09 22:45:17 +00:00
asynchttpserver.nim Fixes long-standing asynchttpserver regression. (#10102) 2018-12-27 22:26:48 +01:00
asyncmacro.nim asyncmacro: add nnkSym support for getName() (#9204) 2018-10-09 15:53:13 +02:00
asyncnet.nim Merge pull request #9915 from zevv/asyncnet-unix 2018-12-12 23:06:08 +00:00
asyncstreams.nim Fixes #8994. FutureStream read procedure data loss no longer occurs. (#9183) 2018-10-09 19:39:12 +02:00
base64.nim make more tests green 2018-04-30 02:52:58 +02:00
bitops.nim bitops: add 'hamming weight' to the doc index 2017-12-03 15:20:50 +01:00
browsers.nim Don't run "kde-open" and "gnome-open" under Unix (#6426) 2017-11-19 03:29:26 +01:00
cgi.nim Add readData proc that accepts a string. 2018-11-07 11:26:51 +01:00
colors.nim stdlib: documenation updates, the exception names have been changed 2018-10-25 07:42:45 +02:00
complex.nim fix #9639 (#9640) 2018-11-07 10:58:48 +01:00
cookies.nim make more tests green 2018-04-30 02:52:58 +02:00
coro.nim coro: minor documentation fix [backport] [ci skip] 2018-11-11 10:16:32 +01:00
coro.nimcfg fix test failure in coro.nim 2015-10-01 12:05:45 -07:00
cstrutils.nim move eqIdent to vm.nim (#7585) 2018-04-15 23:38:43 +02:00
db_common.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
distros.nim Stop false positives in distros.detectOs (#10062) 2018-12-21 22:52:57 +01:00
dynlib.nim Nintendo switch support (#8069) 2018-06-27 12:35:09 +02:00
encodings.nim removes deprecated T/P types 2018-11-16 13:27:56 +01:00
endians.nim Make the swap procs safe for unaligned input ptrs (#9210) 2018-10-18 14:30:31 +02:00
events.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
fenv.nim Haiku support for Nim (#8542) 2018-08-14 09:35:07 +02:00
future.nim renamed future.nim to sugar.nim 2018-04-06 11:59:49 +02:00
hashes.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
htmlgen.nim HTMLGen Update, Add runnableExamples, Add HTML Tags center, details, dialog, marquee, picture, slot, summary (#9252) 2018-10-09 13:13:13 +02:00
htmlparser.nim Add parsing empty attribs to htmlparser (#9559) 2018-10-30 06:58:39 +01:00
httpclient.nim Merge pull request #9548 from tonygparsehub/put-delete 2018-11-23 22:45:28 +00:00
httpcore.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
httpserver.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
json.nim [json] document fact that key ordering is preserved (#10020) 2018-12-20 01:13:25 +01:00
lenientops.nim rename SomeReal to SomeFloat (#7617) 2018-04-15 19:59:11 +02:00
lexbase.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
logging.nim Adding more documentation to logging.nim 2018-12-17 19:29:08 +01:00
marshal.nim stdlib: documenation updates, the exception names have been changed 2018-10-25 07:42:45 +02:00
matchers.nim make more tests green 2018-04-30 02:52:58 +02:00
math.nim Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084) 2018-12-31 14:52:51 +01:00
md5.nim prepared stdlb for new integer arithmetic rules 2017-09-16 10:57:21 +02:00
memfiles.nim Allow an escape hatch for platform specific flags/default override (#9968) 2018-12-14 11:44:11 +01:00
mersenne.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
mimetypes.nim Add application/wasm to mimetypes.nim (#8389) 2018-07-21 21:42:07 +02:00
nativesockets.nim Merge pull request #9915 from zevv/asyncnet-unix 2018-12-12 23:06:08 +00:00
net.nim Merge pull request #9915 from zevv/asyncnet-unix 2018-12-12 23:06:08 +00:00
nimprof.nim Minor bug fix (#9430) 2018-10-19 11:45:59 +02:00
nimprof.nim.cfg
nimtracker.nim make memory tracker work without onThreadCreation 2017-03-14 15:45:35 +01:00
oids.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
options.nim Make options.UnpackError inherit from system.Defect 2018-12-08 10:04:53 +01:00
os.nim fixes #10066 2018-12-21 14:28:52 +01:00
osproc.nim Update osproc.nim (#10043) 2018-12-19 11:25:50 +01:00
oswalkdir.nim Add copyright header 2016-07-21 08:53:10 +01:00
parsecfg.nim Testament: refactoring; makes the test joiner green 2018-12-11 21:23:23 +01:00
parsecsv.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
parsejson.nim move parsejson logic into its own standard lib module 2018-05-18 01:49:49 +02:00
parseopt.nim fixes #9120 2018-12-16 20:34:07 +01:00
parseopt2.nim WIP: disallow 'nil' for strings and seqs 2018-08-13 11:41:33 +02:00
parsesql.nim removes deprecated T/P types 2018-11-16 13:27:56 +01:00
parseutils.nim Update parseutils.nim 2018-12-05 11:27:22 -08:00
parsexml.nim Add parsing empty attribs to htmlparser (#9559) 2018-10-30 06:58:39 +01:00
pathnorm.nim [os] fix #10017 regression, fix #10025 regression (#10018) 2018-12-18 12:43:25 +01:00
pegs.nim removes deprecated T/P types 2018-11-16 13:27:56 +01:00
punycode.nim Add copyright header 2016-07-21 08:52:39 +01:00
random.nim Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084) 2018-12-31 14:52:51 +01:00
rationals.nim Support div, mod, floorDiv and floorMod for Rationals (#7918) 2018-06-01 11:19:25 -04:00
ropes.nim Fixes ropes regressions due to the not-nil strings (#8687) 2018-08-20 16:55:22 +02:00
scgi.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
securehash.nim move new sha1 module into the new 'std' namespace 2018-02-06 17:40:31 +01:00
segfaults.nim fixes #5599 (#5610) 2017-03-26 09:30:59 +02:00
selectors.nim Allow async stdin 2018-07-25 09:07:50 +03:00
smtp.nim fixes #9728 2018-11-16 11:30:34 +01:00
smtp.nim.cfg
stats.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
streams.nim stdlib: documenation updates, the exception names have been changed 2018-10-25 07:42:45 +02:00
strformat.nim New implementations of times.parse & times.format (#8094) 2018-07-09 20:04:25 +02:00
strmisc.nim Add runnable examples for strmisc procs and a better doc for expandTabs 2018-10-29 04:59:05 +01:00
strscans.nim Fix strscans.scanp (#9518) 2018-10-28 13:35:30 +01:00
strtabs.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
strutils.nim strutils: minor code cleanup 2018-12-19 18:06:13 +01:00
subexes.nim refs #9880 show index and bound in lots of index out of bounds errors 2018-12-09 16:50:45 -08:00
sugar.nim fixes #9540 2018-10-29 10:06:36 +01:00
terminal.nim removes deprecated T/P types 2018-11-16 13:27:56 +01:00
times.nim refs #10121 (#10124) 2018-12-30 02:06:15 +01:00
typetraits.nim fix typetraits.$ regression https://github.com/c-blake/cligen/issues/84 (#10131) 2018-12-30 09:40:21 +01:00
unicode.nim fixes #9800 (#9804) [backport] 2018-11-26 18:59:24 +01:00
unittest.nim Give error when case has an else branch even though all cases are already covered (#9930) 2018-12-13 09:08:10 +01:00
uri.nim Don't prevent ',' from getting escaped in theindex.html 2018-09-28 15:39:22 -04:00
volatile.nim Add volatile load/store (#5263) 2017-01-25 20:02:19 +01:00
xmlparser.nim remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
xmltree.nim [cleanup] remove xmldom and xmldomparser (#9234) 2018-10-09 20:58:56 +02:00