Commit Graph

227 Commits

Author SHA1 Message Date
Andreas Rumpf
358f582939 Merge pull request #4463 from flyx/tables-equals-no-KeyError
`==` in tables should not raise KeyError
2016-07-19 00:16:58 +02:00
Andreas Rumpf
0834cd63d9 prepare Nim codebase for upcoming parser changes 2016-07-15 12:56:03 +02:00
Axel Pahl
6de1333a26 use table literal syntax 2016-07-12 10:45:54 +02:00
Axel Pahl
8d4614b5ab explain difference between Table and TableRef in tables.nim 2016-07-12 09:43:31 +02:00
Matthew Baulch
90a5edfa6d Fix #4422: Reset queue element on pop. Prevent NimVM confusion. Help GC. 2016-07-11 15:10:54 +10:00
Felix Krause
9f8cdf2560 Use getOrDefault for tables.== 2016-07-08 10:41:37 +02:00
Felix Krause
4455e5d4b6 == in tables should not raise KeyError
* With previous code, the compiler deduced that equalsImpl may raise
   a KeyError. While this could only actually happen in a nasty
   multi-threaded environment, I fixed the code so that it will never happen.
2016-07-07 18:13:12 +02:00
Matthew Baulch
a6c66139fa Update sets examples so they work again. 2016-07-06 20:30:57 +10:00
Andreas Rumpf
f54e2bae6b Merge pull request #4344 from ReneSac/queues
Enchanced random access support for queues among other changes
2016-06-19 13:56:58 +02:00
ReneSac
67c7a925c1 Remove high() and low() procs from queues module
Just in case as they are said not overloadable. No deprecation because this is during a PR: those procs didn't exist before.
Also update comment due to failed optimization attempt using copyMem() for POD datatypes.
2016-06-16 18:08:15 -03:00
ReneSac
8dcb3fe5b7 Fixes for things pointed by Araq on the PR 2016-06-16 17:33:45 -03:00
ReneSac
dac4826483 Improved the documentation and miscelaneous
Better bounds checking. Tried to make it and documentation comply with the conflicting style guides.
Added example of usage at the top of the module as well as warnings on usage.
Also fix the back() and internal englishOrdinal() proc from previous commit.
Added {.discardable.} pragma for .pop(), when calling only for it's side effects.
Sprinkled some unlikely() for optimization.
Some new tests reflecting those changes.
2016-06-15 18:19:51 -03:00
Andreas Rumpf
5f83e869fa attempt to fix a critical memory leak in Nim's collections 2016-06-15 17:15:27 +02:00
Kier Davis
acbb03ee5e Implement clear() for CountTableRef. Fixes #4325. 2016-06-13 17:23:56 +01:00
ReneSac
d6849b87c5 Enchanced random access support for queues
Now queues support indexing, front() and back() operations and pairs iteration.
Also modernized some of the code to use newer Nim features.
Added the "add()" alias to "enqueue()", per nim's conventions (also fits better with pop())
2016-06-12 16:34:24 -03:00
Dominik Picheta
2b162c04b1 Implements tables.clear. 2016-06-02 18:25:10 +01:00
Andreas Rumpf
95bb19a579 moved random procs from math to its own module (breaking change) 2016-05-30 16:24:52 +02:00
cheatfate
49c50e4e21 Introduce template withValue() for tables.nim too. 2016-05-27 01:00:05 +03:00
cheatfate
a2393d0593 Introduce template withValue() 2016-05-26 15:32:14 +03:00
Lompiktab
72ba30d0a9 Fix 2 compile errors in LockFreeHash.nim
* type mismatch in range (line 55)
* invalid indentation (line 249)
2016-05-14 09:41:35 +04:00
Stephane Fontaine
fbd6291f2f Fix missing ]
other nim can't parse the file.
Introduced in 192ba3bbc0 (diff-1a01187da2fad29f03da8ce36ffe1f91)
2016-05-13 22:14:22 +04:00
Yuriy Glukhov
1a8f784834 Added heapqueue collection. Fixed timers in asyncdispatch. 2016-04-28 00:04:32 +03:00
Yuriy Glukhov
b48d98b846 Added del for OrderedTable and OrderedTableRef 2016-04-13 13:41:32 +03:00
Andreas Rumpf
a61d5e466b added missing file for --gc:stack 2016-03-31 16:49:56 +02:00
Andreas Rumpf
878679fa3f added missing file 2016-03-28 02:26:38 +02:00
Yuriy Glukhov
308b7c0138 Fixed Table::del in JS 2016-03-21 13:35:54 +02:00
Hans Raaf
cddabcfc63 Fixes foldl() and foldr() + foldl() with start parameter.
This fixes the (potential) multi-evaluation of the sequence parameter in
foldl() and foldr().

It also adds a foldl() version which gets a start parameter. This allows
for creating a result with a different type than the elements of the
sequence.
2016-03-06 17:52:18 +01:00
Andreas Rumpf
82114b7980 Merge branch 'devel' of github.com:nim-lang/Nim into devel 2016-03-04 22:19:19 +01:00
Andreas Rumpf
50d2a5868a added intsets.clear proc 2016-03-04 22:19:11 +01:00
Rostyslav Dzinko
bbf12aab4f Removed unused import of 'os' module from module 'sets' 2016-03-04 11:34:27 +02:00
Samantha Doran
d732279203 Don't expect all keys in hashsets to have $ defined 2016-03-01 11:23:47 -05:00
def
7177e0058b Consistently use Channel instead of TChannel 2016-02-25 04:04:45 +01:00
Andreas Rumpf
981974ab11 Merge pull request #3831 from ephja/nimrod-to-nim
nimrod -> nim
2016-02-06 15:24:09 +01:00
Erik Johansson Andersson
f8d98700ac nimrod -> nim 2016-02-05 19:11:43 +01:00
def
c50b5b62ef Fix a few deprecation warnings 2016-01-25 19:10:37 +01:00
Sloane Simmons
aa0d65ed70 Fix CountTableRef#getOrDefault
Fixes issue with CountTableRef and getOrDefault:
```{nimrod}
import tables

proc main() =
  const testKey = "TESTKEY"
  let t: CountTableRef[string] = newCountTable[string]()

  # Before, does not compile with error message:
  #test_counttable.nim(7, 43) template/generic instantiation from here
  #lib/pure/collections/tables.nim(117, 21) template/generic instantiation from here
  #lib/pure/collections/tableimpl.nim(32, 27) Error: undeclared field: 'hcode'

  echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)
  t.inc(testKey,3)
  echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)

when isMainModule:
  main()
```

Previously, `getOrDefault` for CountTableRef objects was calling the
`getOrDefaultImpl` template, which used the t.data.hcode object -
assuming a Table or similar object.  Because CountTableRef didn't have
an hcode in its data tuples, this wouldn't compile.  Changed to be the
same as `CountTable#getOrDefault`.
2016-01-09 21:46:47 -06:00
def
7540cdd169 Update comment about map being in system module 2015-11-23 16:23:35 +01:00
Araq
e9313dd362 added prefix matching to critbits.nim 2015-11-10 15:31:21 +01:00
Araq
aeb69dbe84 Merge branch 'devel' of https://github.com/nim-lang/Nim into devel 2015-10-13 15:54:33 +02:00
Araq
8be9e46403 udpated the compiler and tester to use getOrDefault 2015-10-13 14:10:33 +02:00
rbmz
4548c1aa9b added all/any/allIt/anyIt with tests and inline documentation
Signed-off-by: rbmz <rbmz@users.noreply.github.com>
2015-10-13 01:10:25 -03:00
Araq
2fda95a4d6 added getOrDefault; bootstrapping works again 2015-10-13 03:03:05 +02:00
Araq
d8b0edc323 Merge branch 'mget' of https://github.com/def-/Nim into def--mget
Conflicts:
	lib/pure/collections/critbits.nim
	lib/pure/collections/tables.nim
	lib/pure/xmltree.nim
	lib/system/sets.nim
	tests/collections/ttables.nim
	tests/collections/ttablesref.nim
2015-10-13 00:22:27 +02:00
Andreas Rumpf
7b9d929d50 Merge pull request #3423 from petermora/breakSequtils
Break sequtils
2015-10-12 20:42:17 +02:00
Araq
732bdd54a0 added critbits.inc proc 2015-10-06 15:50:59 +02:00
Peter Mora
6318f77821 restore {.immediate.} to toSeq 2015-10-06 08:15:00 +02:00
Peter Mora
75097e2981 sequtils related changes 2015-10-05 22:42:22 +02:00
Alexander Mitchell-Robinson
564c9f4013 Fixed my name. 2015-09-07 19:51:52 -05:00
Adam Strzelecki
43bddf62dd lib: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:03:56 +02:00
Araq
d230b75e0a removed sequtils.reversed again since it's already in algorithm.nim 2015-08-10 01:49:56 +02:00