diff --git a/Session.vim b/Session.vim new file mode 100644 index 0000000000000..2c6dcbdfe7753 --- /dev/null +++ b/Session.vim @@ -0,0 +1,143 @@ +let SessionLoad = 1 +let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0 +let v:this_session=expand(":p") +silent only +cd ~/nim-lang/Nim +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +1758 lib/pure/os.nim +badd +957 term://.//7705:/usr/bin/fish +badd +2572 lib/system.nim +badd +73 doc/contributing.rst +badd +1 ~/nim-lang/Nim +badd +1 ~/ +badd +789 term://.//11208:/usr/bin/fish +badd +28 term://.//20180:/usr/bin/fish +badd +8 .git/rebase-merge/git-rebase-todo +badd +66 testament/testament.nim +badd +67 testament/specs.nim +badd +1 ~/dotfiles/neovim/.config/nvim +badd +1 doc +badd +1 packages.json +badd +0 probapackages/packages.json +badd +1 testament/important_packages.nim +badd +1 proba.nim +argglobal +silent! argdel * +$argadd \*.ml +edit probapackages/packages.json +set splitbelow splitright +wincmd _ | wincmd | +vsplit +wincmd _ | wincmd | +vsplit +2wincmd h +wincmd w +wincmd w +wincmd _ | wincmd | +split +1wincmd k +wincmd w +wincmd t +set winminheight=0 +set winheight=1 +set winminwidth=0 +set winwidth=1 +exe 'vert 1resize ' . ((&columns * 127 + 191) / 382) +exe 'vert 2resize ' . ((&columns * 127 + 191) / 382) +exe '3resize ' . ((&lines * 36 + 37) / 75) +exe 'vert 3resize ' . ((&columns * 126 + 191) / 382) +exe '4resize ' . ((&lines * 36 + 37) / 75) +exe 'vert 4resize ' . ((&columns * 126 + 191) / 382) +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal nofen +silent! normal! zE +let s:l = 15790 - ((31 * winheight(0) + 36) / 73) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +15790 +normal! 013| +lcd ~/nim-lang/Nim +wincmd w +argglobal +if bufexists('~/nim-lang/Nim/testament/important_packages.nim') | buffer ~/nim-lang/Nim/testament/important_packages.nim | else | edit ~/nim-lang/Nim/testament/important_packages.nim | endif +setlocal fdm=indent +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi= +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal nofen +let s:l = 1 - ((0 * winheight(0) + 36) / 73) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +1 +normal! 0 +wincmd w +argglobal +if bufexists('~/nim-lang/Nim/proba.nim') | buffer ~/nim-lang/Nim/proba.nim | else | edit ~/nim-lang/Nim/proba.nim | endif +setlocal fdm=indent +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi= +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal nofen +let s:l = 1 - ((0 * winheight(0) + 18) / 36) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +1 +normal! 0 +wincmd w +argglobal +if bufexists('term://.//7705:/usr/bin/fish') | buffer term://.//7705:/usr/bin/fish | else | edit term://.//7705:/usr/bin/fish | endif +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal nofen +let s:l = 957 - ((15 * winheight(0) + 18) / 36) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +957 +normal! 044| +wincmd w +2wincmd w +exe 'vert 1resize ' . ((&columns * 127 + 191) / 382) +exe 'vert 2resize ' . ((&columns * 127 + 191) / 382) +exe '3resize ' . ((&lines * 36 + 37) / 75) +exe 'vert 3resize ' . ((&columns * 126 + 191) / 382) +exe '4resize ' . ((&lines * 36 + 37) / 75) +exe 'vert 4resize ' . ((&columns * 126 + 191) / 382) +tabnext 1 +if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 winminheight=1 winminwidth=1 shortmess=filnxtToOFc +let s:sx = expand(":p:r")."x.vim" +if file_readable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &so = s:so_save | let &siso = s:siso_save +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim index 322cb5486d67c..4b896b12b72f6 100644 --- a/lib/pure/collections/sets.nim +++ b/lib/pure/collections/sets.nim @@ -1019,9 +1019,9 @@ when isMainModule and not defined(release): # --> {1, 3, 5} block toSeqAndString: - var a = toHashSet([2, 4, 5]) + var a = toHashSet([2, 7, 5]) var b = initHashSet[int]() - for x in [2, 4, 5]: b.incl(x) + for x in [2, 7, 5]: b.incl(x) assert($a == $b) #echo a #echo toHashSet(["no", "esc'aping", "is \" provided"]) diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index c4f929c3f9a8e..f5b9cda851253 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -113,31 +113,31 @@ proc hash*[T: proc](x: T): Hash {.inline.} = result = hash(pointer(x)) const - prime = 31 + prime = uint(11) proc hash*(x: int): Hash {.inline.} = ## Efficient hashing of integers. - result = x * prime + result = cast[Hash](cast[uint](x) * prime) proc hash*(x: int64): Hash {.inline.} = ## Efficient hashing of `int64` integers. - result = cast[int](x) * prime + result = cast[Hash](cast[uint](x) * prime) proc hash*(x: uint): Hash {.inline.} = ## Efficient hashing of unsigned integers. - result = cast[int](x) * prime + result = cast[Hash](x * prime) proc hash*(x: uint64): Hash {.inline.} = ## Efficient hashing of `uint64` integers. - result = cast[int](x) * prime + result = cast[Hash](cast[uint](x) * prime) proc hash*(x: char): Hash {.inline.} = ## Efficient hashing of characters. - result = ord(x) * prime + result = cast[Hash](cast[uint](ord(x)) * prime) proc hash*[T: Ordinal](x: T): Hash {.inline.} = ## Efficient hashing of other ordinal types (e.g. enums). - result = ord(x) * prime + result = cast[Hash](cast[uint](ord(x)) * prime) proc hash*(x: float): Hash {.inline.} = ## Efficient hashing of floats. diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim index 0a5a013679aaf..9eccf345a69c9 100644 --- a/tests/collections/ttables.nim +++ b/tests/collections/ttables.nim @@ -233,7 +233,7 @@ block tablesref: for y in 0..1: assert t[(x,y)] == $x & $y assert($t == - "{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}") + "{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}") block tableTest2: var t = newTable[string, float]() @@ -340,7 +340,7 @@ block tablesref: block anonZipTest: let keys = @['a','b','c'] let values = @[1, 2, 3] - doAssert "{'a': 1, 'b': 2, 'c': 3}" == $ toTable zip(keys, values) + doAssert "{'c': 3, 'a': 1, 'b': 2}" == $ toTable zip(keys, values) block clearTableTest: var t = newTable[string, float]() diff --git a/tests/collections/ttablesthreads.nim b/tests/collections/ttablesthreads.nim index 7fe4c79b13474..5553b31ef85aa 100644 --- a/tests/collections/ttablesthreads.nim +++ b/tests/collections/ttablesthreads.nim @@ -48,7 +48,7 @@ block tableTest1: for y in 0..1: assert t[(x,y)] == $x & $y assert($t == - "{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}") + "{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}") block tableTest2: var t = initTable[string, float]()