Re: Advent of Code 2018 megathread

2018-12-01 Thread miran
> I am brand new to Nim, and was inspired by the Advent of Nim post Glad to have you with us :) > In my testing, `initIntSet()` turned out to be a lot faster than initializing > with `initSet[int]()` You're not using high enough number ;) Try it with something like `2^17`. There should be a

Re: CountTable.inc() causes Error: unhandled exception: index out of bounds [IndexError]

2018-12-01 Thread miran
> The documentation for CountTable is autogenerated and lacking (no > "description" explaining how to use CountTable). This was improved during Hacktoberfest, but it has not yet hit the stable version. For the devel docs of tables module (including a short example how to use `CountTable`), see

Re: Advent of Code 2018 megathread

2018-12-01 Thread miran
> Something in the end I was not able to understand how to do is how to print > the type of a variable. There is a pending PR waiting to be merged which will allow this by default. Until that is here, you need to `import typetraits`. > my input file contained integer that did not fit in 16

CountTable.inc() causes Error: unhandled exception: index out of bounds [IndexError]

2018-12-01 Thread jimbo1qaz
I'm learning Nim (previously used Python and C++/etc.) and trying to attempt [https://adventofcode.com/2018/day/2](https://adventofcode.com/2018/day/2). I'm using a CountTable to count how many times each character appears: for line in f.lines: if line.len == 0: break

Re: How to lookup the IPV6 addr of a domain name?

2018-12-01 Thread Libman
I'm a n00b, and I've spent some time trying to research this without finding a good answer. I'm posting my notes in case they are helpful for someone... In C one would use [getaddrinfo](https://archive.fo/eFztO#selection-589.810-589.883). This is much easier in Python, which has a high-level

Re: HttpClient networking problem

2018-12-01 Thread jlhouchin
Thanks for the reply. I don't know if that code makes any difference or not. But it is correct and I made the change. And whether or not that change did anything when I ran the code again I did get an error right up front. And then I noticed an error in the code I posted. I have the "while"

Re: Advent of Code 2018 megathread

2018-12-01 Thread preempalver
Joining in. I dabble in nim. Haven't touched it for a couple of months so I am rusty. Need to keep practicing so I joined this [https://github.com/floydnunez/Advent_of_code_2018](https://github.com/floydnunez/Advent_of_code_2018) Oh man, my second solution is bruteforce as all fuck. I just

Re: Advent of Code 2018 megathread

2018-12-01 Thread pietroppeter
> We had a long discussion on #nim IRC channel about this today, and there are > two possible solutions yes, thank you! I saw the discussion earlier this morning and I was able to fix that (I did initialize the HashSet with the defaults...). I pushed the changes and also activated the issues.

Re: IpAddress to/from disk problem

2018-12-01 Thread SolitudeSF
> I would always have to look up the forum syntax how to do that. the markdown code block is used literally on every forum, IM or any place where you can leave a comment.

Re: IpAddress to/from disk problem

2018-12-01 Thread moerm
1. I _did_ describe my solution 2. I don't react as desired to paternalizing and trying to paint me as a bad guy without a social conscience. Quite the contrary. 3. I try to avoid putting code here because I would always have to look up the forum syntax how to do that.

Re: Advent of Code 2018 megathread

2018-12-01 Thread herman
Hi everyone! I am brand new to Nim, and was inspired by the Advent of Nim post I saw on Hackernews the other day to give it a shot. Like others here, I will be posting my solutions to Github:

Re: Advent of Code 2018 megathread

2018-12-01 Thread soler
My repo: [https://github.com/ericsolomon/aoc2018](https://github.com/ericsolomon/aoc2018) Still fairly new to nim and there will be solutions in other languages in this repo, but there is where all of the aoc code will be housed.

Re: IpAddress to/from disk problem

2018-12-01 Thread miran
> Anyway, I have found a working solution now after a lot of research _...and as a good citizen, I will post it here so when somebody after me struggles with the same issue, can see how I managed to solve it._

Re: Advent of Code 2018 megathread

2018-12-01 Thread miran
> Inspired by @miran's repo _blushing_ :) > Nim (python-naive) implementation unexpectedly much slower! Why? I know the answer, but you disabled issues in your repo so I cannot comment there. We had a long discussion on #nim IRC channel about this today, and there are two possible solutions

Re: Advent of Code 2018 megathread

2018-12-01 Thread thor77
Joined the leaderboard and here is my repo: [https://github.com/Thor77/AdventOfCode2018](https://github.com/Thor77/AdventOfCode2018)

Re: Advent of Code 2018 megathread

2018-12-01 Thread auxym
Hey everyone, new Nim hobbyist programmer here! It's my first time doing AOC this year, I though it would be a new opportunity to learn what seems to be one of the most promising new languages out there. So, I'll try to do most days in Nim, but can't promise I won't fall back to python if I

Re: FE web libraries

2018-12-01 Thread mikra
yep.. old stuff but still newsworthy: [https://ponyfoo.com/articles/stop-breaking-the-web](https://ponyfoo.com/articles/stop-breaking-the-web) and [https://youtu.be/GMWAHzXQnNM](https://youtu.be/GMWAHzXQnNM)

Re: IpAddress to/from disk problem

2018-12-01 Thread moerm
Yes that's one way but not what I want. I mean, come on, it's not something exotic to binary read/write from/to disk. Anyway, I have found a working solution now after a lot of research. Thank you all for sharing your thoughts.

Re: How does Nim solve the "expression problem"

2018-12-01 Thread mratsim
You have both sum types and inheritance so you have both side of the coin, then you have metaprogramming to tie them together anyway you want it. For example you can use macros to create your case statement like we do in Nimbus VM here: > * >

Re: Advent of Code 2018 megathread

2018-12-01 Thread pietroppeter
Hi all, ran into Nim in Hacker News a couple months ago, and this year's Advent of Code seems an excellent way to finally learn by doing. Inspired by @miran's repo I will be posting my solutions here:

Re: HttpClient networking problem

2018-12-01 Thread cyberlis
change your 10th line var client = newHttpClient() lastConnection = getTime().utc Run change to var client = newHttpClient(timeout=500) lastConnection = getTime().utc Run

Re: Has anyone written something like 'Expect' in Nim?

2018-12-01 Thread enthus1ast
this should be possible with osproc.Process and its output stream

Re: IpAddress to/from disk problem

2018-12-01 Thread enthus1ast
i would just safe the string representation of the ip addr. And would call "parseIpAddress" when i want to read it in again.

How does Nim solve the "expression problem"

2018-12-01 Thread geohuz
I'm wondering how does Nim provide language facilities to solve the expression problem: [https://en.wikipedia.org/wiki/Expression_problem#cite_note-Scala-10](https://en.wikipedia.org/wiki/Expression_problem#cite_note-Scala-10) Here are also discussions in hack news: