Re: How does one convert from string to integer using an arbitrary radix?

2018-10-21 Thread vsajip
Great, thanks.

Re: How does one convert from string to integer using an arbitrary radix?

2018-10-21 Thread lscrd
The message is misleading. "result" is the one at line 325 in system.nim, i.e. the HSlice which is returned by the proc. When instanciating the slice (".."), the fields "a" and "b" of "result" (a slice) should be initialized with 0. But "b" is of type "range[8..10] and cannot be initialized wit

Re: Nim in Action: question about comparison vs. C/C++

2018-10-21 Thread dom96
> Or does the text here mean to distinguish beween what is merely in the > language and what the STL adds? Yep :)

Re: How does one convert from string to integer using an arbitrary radix?

2018-10-21 Thread vsajip
Thanks for the pointer. I adapted the example like this: const DIGITS = "0123456789" proc parseInt(s : string, radix: range[8..10]) : uint64 = var str = s result = 0 for i in 0 .. str.high: let c = str[i] assert c in DIGITS[0 ..< radi

Nim in Action: question about comparison vs. C/C++

2018-10-21 Thread cantanima
On p. 11 of "Nim in Action" one finds the following: > C and C++ both require you to manually manage memory, carefully ensuring that > what you allocate is deallocated since it's no longer needed. It is true that if all you do is use plain C pointers then yes, you must manage memory carefully.

Re: How does one convert from string to integer using an arbitrary radix?

2018-10-21 Thread Hlaaftana
Not in the standard library. Example implementation here [https://rosettacode.org/wiki/Non-decimal_radices/Convert#Nim](https://rosettacode.org/wiki/Non-decimal_radices/Convert#Nim)

Re: Insert 'NULL' value in Postgres with Nim 0.19.1 without 'nil'

2018-10-21 Thread mashingan
Something like this: import options, strutils from sequtils import map proc queryStr(query: string, args: varargs[Option[string]]): (string, seq[string]) = ## Transform '?' in query string according to optioned arguments given if '?' notin query:

Re: How compile sfml successfully on nim

2018-10-21 Thread dom96
You need to install a package that provides the libcsfml DLLs. How to install this depends on your linux distro. For Ubuntu: `apt install libcsfml-dev` (This is a guess)

How compile sfml successfully on nim

2018-10-21 Thread tbutton
Hi! I'm junior in nim. I'm want to create games on nim. But how can i do it? I'm found this: [https://github.com/oprypin/nim-csfml](https://github.com/oprypin/nim-csfml) I tried to compile it, but after compiling i'm cant open the sfml window. tbutton@tbutton-P85-D3:~/Рабочий стол/nim-csfml-mas