Best way to store/search/etc and an int-int data structure

2019-12-01 Thread drkameleon
I have a list of int-int, which I'm storing as a _seq_ of _(int,int)_ tuples (the first int being a hash value, so it's not like 0-1-2-3...) I have to test this structure for membership (whether an index - the first _int_ \- exists), look up a value (get the second _int_ for a specific first

Different code produced when using a template?

2019-12-01 Thread drkameleon
OK, so, I'm a bit confused. I have this template: template initTopContextWith(pairs:seq[(int,Value)]) = shallowCopy(Stack[^1],pairs) Run which I'm calling/using from another _proc_. When I use the template, the produced code is: //

Re: Advent of Nim 2019 megathread

2019-12-01 Thread TheSpydog
I'm in and learnin' Nim! [https://github.com/TheSpydog/AdventOfCode](https://github.com/TheSpydog/AdventOfCode)

Re: Bug or feature?

2019-12-01 Thread Matthew
Ah, interesting. Thanks for explaining, makes sense.

Re: Bug or feature?

2019-12-01 Thread slangmgh
Global variable always deepCopy, local variable `let` assign using shallowCopy for value type, it is by design, not bug, not feature.

Re: Advent of Nim 2019 megathread

2019-12-01 Thread exelotl
doin' it [https://github.com/exelotl/aoc2019](https://github.com/exelotl/aoc2019)

Re: Advent of Nim 2019 megathread

2019-12-01 Thread ducdetronquito
Good catch ;)

Re: Advent of Nim 2019 megathread

2019-12-01 Thread dom96
Decided to give this a proper try this year. Let's see how this goes. My repo is here: [https://github.com/dom96/aoc2019](https://github.com/dom96/aoc2019) Already found a bug in Nim heh: [https://github.com/nim-lang/Nim/issues/12788](https://github.com/nim-lang/Nim/issues/12788)

Re: Docker image for cross compiling

2019-12-01 Thread shashlick
Looks like I misread it then - awesome work!

Re: Advent of Nim 2019 megathread

2019-12-01 Thread lqdev
I'm kind of late to the party, but here goes. [https://github.com/liquid600pgm/aoc-2019](https://github.com/liquid600pgm/aoc-2019)

Bug or feature?

2019-12-01 Thread Matthew
I came across a situation where using a `let` statement on a value object created a reference. I then correlated it with [this closed bug report](https://forum.nim-lang.org/a43!GG4hjurx). So, is this expected behavior?: Works as normal: var data: Table[string, string]

Re: Advent of Nim 2019 megathread

2019-12-01 Thread gillesmag
Learning Nim as I do the Advent Of Code 2019. [https://github.com/gillesmag/advent-of-code-2019](https://github.com/gillesmag/advent-of-code-2019)

Question about multithreaded use of filestream.readLine() function

2019-12-01 Thread forcefaction
Hi, i currently use this code to divide work between worker threads: var linePtr: seq[pointer] for line in memSlices(memfiles.open($args["--inputFile"], mode = fmRead)): linePtr.add(line.data) let batchSize = (linePtr.len /

Re: Advent of Nim 2019 megathread

2019-12-01 Thread SolitudeSF
badabing [https://github.com/SolitudeSF/adventOfCode](https://github.com/SolitudeSF/adventOfCode)

Re: Docker image for cross compiling

2019-12-01 Thread chrisheller
Isn't that just building Nim itself on different platforms? I didn't see anything in the official Docker images that are posted, [https://hub.docker.com/r/nimlang/nim](https://hub.docker.com/r/nimlang/nim), about being able to cross-compile your own Nim code.

Re: How to create a trojan and reverse shell with NIM

2019-12-01 Thread navicstein
It's just for educational purposes as am trying to learn more about nim, the courses I took only applied it in python 2 but I thought I would find out help here in translating it In nim

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread cblake
An un-keyed `pop(Table): tuple[K,V]` more similar to `HashSet.pop` is mentioned in the PR commentary linked above. (I would personally just use the already-defined iterator than b3liever's inline expansion, but eh. Either way.) Totally suitable for another PR. I just wanted to keep the above

Re: Docker image for cross compiling

2019-12-01 Thread shashlick
This is already being done in the nightlies builds, except for OSX binaries. We are using Holy Build Box for older Linux builds and Dockcross for Arm builds. [https://github.com/nim-lang/nightlies](https://github.com/nim-lang/nightlies)/

Re: Docker image for cross compiling

2019-12-01 Thread chrisheller
This is now bumped to Nim version 1.0.4

Re: How to create a trojan and reverse shell with NIM

2019-12-01 Thread sky_khan
I would help him. He just needs to send me his IP and root password and I'll show him how.

Re: Advent of Nim 2019 megathread

2019-12-01 Thread filip
I'm sticking to Nim this year too. [https://github.com/filipux/adventofcode2019](https://github.com/filipux/adventofcode2019)

Re: Advent of Nim 2019 megathread

2019-12-01 Thread lscrd
As last year, I will use Nim and only Nim. [https://github.com/lscrd/AdventOfCode2019](https://github.com/lscrd/AdventOfCode2019)

Re: Advent of Nim 2019 megathread

2019-12-01 Thread zevv
I almost got convinced to defect to Ocaml, but sticking to Nim for this year: [https://github.com/zevv/aoc2019](https://github.com/zevv/aoc2019). Enjoy people!

Re: How to create a trojan and reverse shell with NIM

2019-12-01 Thread kobi
How can we help you commit bad deeds?! I suggest you forget this, and concentrate on doing something good instead.

Re: Advent of Nim 2019 megathread

2019-12-01 Thread ducdetronquito
Here we go :) [https://github.com/ducdetronquito/AdventOfCode2019](https://github.com/ducdetronquito/AdventOfCode2019)

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread Araq
Lol good point, I shouldn't post here when I had too little sleep.

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread mratsim
Why mpop, the caller takes ownership of the result and must assign it or discard it.

Re: Advent of Nim 2019 megathread

2019-12-01 Thread pietroppeter
happy to participate again! [https://github.com/pietroppeter/adventofnim](https://github.com/pietroppeter/adventofnim)