summary refs log tree commit diff stats
path: root/lib/pure
Commit message (Collapse)AuthorAgeFilesLines
* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) ↵Timothee Cour2019-01-081-0/+3
| | | | | | | | | | | | | which leaked implementation detail (#10070) * add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2) fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim * Note: isNamedTuple is useful in other places, eg #10010 (comment) * move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim * remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
* os.execShellCmd: fixes #10231 (#10232)alaviss2019-01-081-1/+3
| | | | | | | Darwin has long deprecated the wait union, but their macros still assume it unless you define _POSIX_C_SOURCE. This trips up C++ compilers. This commit duplicates the behavior of WEXITSTATUS when _POSIX_C_SOURCE is defined.
* os.execShellCmd: use WEXITSTATUS to retrieve exit code (#10222)alaviss2019-01-071-1/+1
| | | | | | | According to POSIX, system() shall returns the termination status in the format specified by waitpid(), which means WEXITSTATUS should be used to retrieve the exit code portably. This fixes execShellCmd on Haiku.
* remove deprecated modules (#10215)Miran2019-01-073-609/+0
| | | | | | | | | | | | | | | | | | * removed from `compiler`: * lists (deprecated 2 years ago) * removed from `lib` (all deprecated 3 years ago): * ssl * matchers * httpserver * removed from `lib/deprecated`: * unsigned * actors (and three accompanying tests) * parseurl * moved to `lib/deprecated`: * securehash (the reason for not directly removing - it was deprecated (only) one year ago)
* Added examples to strtabs module (#10160)Ico Doornekamp2019-01-071-0/+31
|
* Remove totally unneeded import of hashes. (#10221)c-blake2019-01-073-3/+3
|
* Fix getAddrInfo, add IPPROTO_ICMPV6 Closes #10198Federico Ceratto2019-01-061-2/+5
|
* Fix the tuple returned by `os.splitFile()` in documentation (#10197)Hugo Locurcio2019-01-051-1/+1
|
* expandFilename on windows is now consistent with other platforms (#10154)Neelesh Chandola2019-01-041-42/+48
|
* [backport] improve unicode docs, fixes #2353 (#10174)Miran2019-01-041-85/+122
| | | | | | | | * as instructed in #2353, provides a short description why there are no specialized procs for seq[Rune] * adds several examples to better explain what some functions do * small fixes (double backticks, add missing dots, etc.) * use `rune` instead of "unicode characer"
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)c-blake2018-12-312-21/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* help Nim optimize intsets.initIntSetAndreas Rumpf2018-12-301-8/+7
|
* fix typetraits.`$` regression https://github.com/c-blake/cligen/issues/84 ↵Timothee Cour2018-12-301-0/+2
| | | | | | | (#10131) * fix typetraits.`$` regression https://github.com/c-blake/cligen/issues/84 * add test
* refs #10121 (#10124)Timothee Cour2018-12-301-1/+2
|
* revives: Move typetraits.`$` to system. Fixes #5827 (#10071)Timothee Cour2018-12-301-24/+20
| | | | | | * Move typetraits.`$` to system. Fixes #5827. * revive PR; adjust code to make sure everything works and add tests * fix tests/concepts/tstackconcept.nim * address comments
* Fixes long-standing asynchttpserver regression. (#10102)Dominik Picheta2018-12-271-21/+27
|
* Revert sub-second randomize(). Fixes randomize for JS backend. (#10000)Dominik Picheta2018-12-271-2/+6
| | | Fixes #9999.
* Add ability to sample elements from openArray according to a weight array ↵c-blake2018-12-231-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (#10072) * Add the ability to sample elements from an openArray according to a parallel array of weights/unnormalized probabilities (any sort of histogram, basically). Also add a non-thread safe version for convenience. * Address Araq comments on https://github.com/nim-lang/Nim/pull/10072 * import at top of file and space after '#'. * Put in a check for non-zero total weight. * Clarify constraint on `w`. * Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating old name and name new (openArray[T], openArray[U]) variants `sample`. * Rename caller-provided state version of rand(openArray[T]) and also clean up doc comments. * Add test for new non-uniform array sampler. 3 sd bound makes it 99% likely that it will still pass in the future if the random number generator changes. We cannot both have a tight bound to check distribution *and* loose check to ensure resilience to RNG changes. (We cannot *guarantee* resilience, anyway. There's always a small chance any test hits a legitimate random fluctuation.)
* Don't use parseutils.parseInt in the times module (#10028)Oscar Nihlgård2018-12-221-39/+67
|
* IntSet documentation notes (#10051)Alexis Hope2018-12-211-19/+28
|
* Stop false positives in distros.detectOs (#10062)Taylor Hoff2018-12-211-3/+3
| | | | | | * Stop false positives in distros.nim * Fix bad string comparison on line 176 of distros.nim
* fixes #10066Araq2018-12-211-19/+27
|
* os.walkDir: correctly evaluate paths when relative = true (#10057) [backport]alaviss2018-12-211-4/+5
|
* Add call to hostnamectl in detectOsImpl (#10048)Taylor Hoff2018-12-201-3/+4
|
* [json] document fact that key ordering is preserved (#10020)Timothee Cour2018-12-201-0/+7
|
* fix test failureTimothee Cour2018-12-191-2/+4
|
* fix #8255 numerous issues with splitFileTimothee Cour2018-12-191-4/+13
|
* strutils: minor code cleanupAraq2018-12-191-1/+0
|
* Update osproc.nim (#10043)Timothee Cour2018-12-191-1/+1
|
* undo last commit (meant to send a PR instead)Timothee Cour2018-12-181-1/+1
|
* Update osproc.nimTimothee Cour2018-12-181-1/+1
|
* [os] fix #10017 regression, fix #10025 regression (#10018)Timothee Cour2018-12-181-1/+2
| | | | | * [os] fix #10017 regression * [os] fix #10025 regression
* add `getCurrentCompilerExe` to vmops (eg allows to get nim compiler at CT); ↵Timothee Cour2018-12-181-1/+8
| | | | add tests for vmops (#9925)
* Adding more documentation to logging.nimIstvan2018-12-171-1/+6
| | | Just minor addition to the documentation with the use of operators
* fixes #9120Araq2018-12-161-1/+1
|
* Allow an escape hatch for platform specific flags/default override (#9968)c-blake2018-12-141-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow an escape hatch for platform specific flags (of which there are many, for example MAP_POPULATE itself is a Linux-only thing, not other Unix). Continue with same defaults as before in this commit, but that really should be changed to *not* include MAP_POPULATE. While pre-faulting all the pages can be useful sometimes *if* you know you're going to access all the data, it is highly unlikely to be what users expect the default to be. For some things all that up front work is 1000s of times slower than being lazy/on-demand/only ever faulting parts of the file. Even the MAP_POPULATE fan who originally in 2014 committed to this file defaulted it to off (but turned it always-on as a "temporary" work around for some long since gone/mutated compiler issue). Anyway, at least something like this `mapFlags` gives users the ability to override the poor default choice or activate any other idiosyncratic platform-specific features. * Use simple, efficient default flags, but also accept whatever the open/mapMem caller specifies. Save flags in MemFile so they can be used in `resize`. This field should not need exporting like the others -- callers can always save whatever values they pass -- but we include a cautionary comment in case anyone ever asks for a `*` there, as well as for documentation. Also make documentation for ``mapFlags`` in open more likely to inspire care.
* added parseopt.remainingArgs; refs #9951Araq2018-12-141-0/+5
|
* os.nim: use the new pathnorm.normalizePath implementationAraq2018-12-142-31/+39
|
* fixes joinPath regressionsAraq2018-12-132-2/+10
|
* os.nim: big refactoring, use the new pathnorm that was extracted by ↵Araq2018-12-133-151/+319
| | | | compiler/pathutils.nim; added os.relativePath
* Give error when case has an else branch even though all cases are already ↵Neelesh Chandola2018-12-131-1/+0
| | | | | | | | | covered (#9930) * Give error when case has an else branch even though all cases are already covered. * Don't check for invalid else for type tyFloat..tyFloat128, tyString, tyError * Remove unnecessary else in unittest.nim * Fix sockets.nim
* Merge pull request #9915 from zevv/asyncnet-unixDominik Picheta2018-12-123-7/+66
|\ | | | | Added basic AF_UNIX support to asyncnet.
| * Added basic AF_UNIX support to asyncnet.Ico Doornekamp2018-12-093-7/+66
| | | | | | | | | | | | | | | | Unfortunately this required some code duplication because the doConnect() from asynccommon.nim only works with addrInfo which does not make sense for AF_UNIX. makeUnixAddr() was moved to nativesocket.nim and exported
* | Merge pull request #9552 from recloser/strmisc-docAndreas Rumpf2018-12-121-1/+28
|\ \ | | | | | | Add runnableExamples for strmisc procs and a better doc for expandTabs
| * | Add runnable examples for strmisc procs and a better doc for expandTabsrecloser2018-10-291-1/+28
| | |
* | | Merge branch 'devel' into sorted_deduplicateAndreas Rumpf2018-12-128-241/+283
|\ \ \
| * | | clean up the implementation of the new memfiles.resizeAraq2018-12-121-27/+27
| | | |
| * | | export every field of MemFile for more low level trickery; refs #9922Araq2018-12-121-4/+5
| | | |
| * | | Merge pull request #9922 from c-blake/develAndreas Rumpf2018-12-121-0/+29
| |\ \ \ | | | | | | | | | | Let handles be seen outside of `memfiles` module so that "updating"
| | * | | For now just implement `resize` per https://github.com/nim-lang/Nim/pull/9922Charles Blake2018-12-111-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | discussion (with special mremap usage on Linux, but ordinary munmap, mmap on other POSIX). Someone needs to do the when windows branch.