Why takes this code 22ns with cstring and 52ns with string?

2017-01-23 Thread Stefan_Salewski
mport hashes, times, math, random type tring = cstring Entry[K, V] = object key: K val: V delta: uint8 k0: int8 Map[K, V] = object data: seq[Entry[K, V]] numentries: int hi: int fillrate:

Re: unable to build PDF documentation

2017-01-23 Thread hcorion
Nvm. Just install the _texlive-fontsextra_ package and all your problems will go away.

Re: unable to build PDF documentation

2017-01-23 Thread hcorion
I encountered this issue while attempting to build the Arch Linux AUR nim-git package. I think the issue had to do with not being in the right directory.

Re: unable to build PDF documentation

2017-01-23 Thread hcorion
I'm pretty sure the issue is that _nimweb_ is installed in nim/tools/ but web/website.ini is in /nim/web/website.ini and _nimweb_ is searching for _website.ini_ in /nim/tools/web/website.ini. There is probably a better way to explain that, you'll probably have to read it twice.

Re: unable to build PDF documentation

2017-01-23 Thread Araq
Run `pdflatex doc/manual.tex` manually and see what it says.

unable to build PDF documentation

2017-01-23 Thread strikr
post git clone, i am trying to build the PDF documentation. [strikr@victory nim]$ ./koch pdf Adding to $PATH: /home/strikr/source-nim/nim/bin bin/nim cc -r tools/nimweb.nim --pdf web/website.ini --putenv:nimversion=0.16.0 Hint: used config file

Amicable numbers in Nim and a few questions

2017-01-23 Thread petevine
I've translated the Euler problem #21 solution (C and Rust versions lifted off the net) to Nim and benchmarked the binary. Time to solution for C/Nim/Rust on my Cortex A5 cpu: 1.5s/1.5s/2.5s Two questions about compiling the generated C immediately spring to mind. Does the nim compiler use

Re: Nim Podcast

2017-01-23 Thread moigagoo
@Krux02 feel free to email me if Gitter is not OK: moigagoo [at] live.com.

Re: No way to run my code, idk how to force a float as an Int

2017-01-23 Thread andrea
There's gitter [https://gitter.im/nim-lang/Nim](https://gitter.im/nim-lang/Nim)

Re: Audio/Video File Read/Write Support In NIM

2017-01-23 Thread Krux02
ok, since I wrote this, I think the example with the codec developer is just a bad example. Just because there is a codec in the standard library, doesn't main you can't develop a better one in that language. But I don't change my opinion. I think the Nim language is powerfull enough, that it

Re: No way to run my code, idk how to force a float as an Int

2017-01-23 Thread pabloclsn
You know if there is a slack or a discord channel or an for nim ?

type mismatch assigning function pointer? gcsafeness confusion?

2017-01-23 Thread luked2
Hi! What am I doing wrong here: type FooProc = proc(x: int) Callbacks = tuple [ cb: FooProc ] proc foo(x: int) : void = echo "foo: " & $x let f:FooProc = foo let c0: Callbacks = (cb: f)# works fine let c1: Callbacks

Re: No way to run my code, idk how to force a float as an Int

2017-01-23 Thread pabloclsn
ok nice for the help it's working now I have an other problem with type mismatch with sequence haha

No way to run my code, idk how to force a float as an Int

2017-01-23 Thread pabloclsn
hi guys I have this few line, nombreDePyramides = 4 var maxLignes: int = ((nombreDePyramides+2)*(nombreDePyramides+3)/2-4) here the second line is giving me a float but I need a int because of the rest of the code and I can't find the syntax ...

Re: No way to run my code, idk how to force a float as an Int

2017-01-23 Thread flyx
This happens because `/` on ints returns a float. You want to use `div` instead, which is integer division. var maxLignes = ((nombreDePyramides + 2) * (nombreDePyramides + 3)) div 2 - 4 Or, alternatively, convert it – this is clearly the inferior solution, but given here for

Re: 2 question about DLL with Mingw

2017-01-23 Thread cheatfate
NimMain don't need to be called, because all GC initialization procedures can reside in DllMain() function, so there no reason to export NimMain.

Re: Audio/Video File Read/Write Support In NIM

2017-01-23 Thread mashingan
As @krux02 mentioned, core language should be compact and flexible without diminishing its usability. Nim syntax already flexible enough so you shouldn't have any problem implementing the dsl for multimedia applications. While developing language to fill the niche is nice, it would be more nice

Re: Exploring namespaces support in Nim

2017-01-23 Thread lltp
@Jehan, yglukhov: I wonder then how clashes would be handled then with a template-based approach: import Foo, Bar: ... baz(x) with baz defined in both Foo and Bar...

Re: Exploring namespaces support in Nim

2017-01-23 Thread lltp
@Krux02: I may be the only one to think this, but "openFile" seems just as good (from a syntax perspective) as "File.open" while the second form is far more flexible, offers more guarantees and is more easily discoverable and fixable should a problem occur... As far as I am concerned, I don't

Re: Exploring namespaces support in Nim

2017-01-23 Thread yglukhov
D supports local imports and has to deal with overloading. Nim supports the following: from foo import nil block: # Start of scope template someSymbolFromFoo(a: int): int = foo.someSymbolFromFoo(a) type SomeTypeFromFoo = foo.SomeTypeFromFoo # Use

Re: Audio/Video File Read/Write Support In NIM

2017-01-23 Thread videobuddha
People in Audiovisual Computing need 2 things from a programming language: 1. As fast as possible code execution speed 2. Easy to use, built-in image/audio/video file read/write commands There is NO programming language right now that does both. The programming language is either SLOW but

Re: Nim VFS (virtual file system)

2017-01-23 Thread ysalmi
You may want to look at PhysicsFS: [https://icculus.org/physfs](https://icculus.org/physfs)/ It's a C library. And it looks like someone generated a nim wrapper for it: [https://github.com/fowlmouth/physfs/blob/master/physfs.nim](https://github.com/fowlmouth/physfs/blob/master/physfs.nim)

Re: Exploring namespaces support in Nim

2017-01-23 Thread yglukhov
Local imports is something I would also vote for. I bet they should be easy to implement. @Araq, what do you think?

Re: Exploring namespaces support in Nim

2017-01-23 Thread Jehan
**yglukhov:** _I bet they should be easy to implement._ Well, first there's also the problem of semantics. OCaml, SML, and Python as three languages that support them don't have to worry about overloading. Definitions shadow each other, so that the innermost import always wins. With

Re: Exploring namespaces support in Nim

2017-01-23 Thread Krux02
> Well, then it is useless. I am from a domain (science) where similar concepts > are generally called a similar way and where clashes occur a lot because > something as simple as * has a gazillion meanings depending on the context > (and all of them applied to arrays of any dimensions, so no

Re: Exploring namespaces support in Nim

2017-01-23 Thread lltp
@Jehan: I see, I did not understand correctly but it is clear now. Its akin to scoped imports then and it seems far better for scientific computing (especially for operators).

Re: Exploring namespaces support in Nim

2017-01-23 Thread Jehan
**lltp:** _@Jehan, could you elaborate a little bit on how ML-type module management would help for scientific computing because I am still not sure that I have grasped everything._ The problem that local imports solve is to provide a midpoint between the extremes of putting identifiers in the

Re: 2 question about DLL with Mingw

2017-01-23 Thread jangko
1. proc double(x: cint): cint {.cdecl, dynlib: "foo.dll", importc:"_double".} 2. use compiler switch --nomain

Re: Exploring namespaces support in Nim

2017-01-23 Thread yglukhov
> modules in Nim provide no intrinsic guarantees about that splitting There are not many languages that provide such guarantees. C guarantees nothing. C++ guarantees a member to be defined in the class definition or its superclasses, which in turn are not guaranteed to reside in any

2 question about DLL with Mingw

2017-01-23 Thread oyster
I have met this page: [http://stackoverflow.com/questions/37950722/load-function-in-nim-dll](http://stackoverflow.com/questions/37950722/load-function-in-nim-dll) I have 2 question for my MingW on windows: 1. what can we do with Mingw? "#pragma comment(linker, "/export:double=_double")"

Re: Exploring namespaces support in Nim

2017-01-23 Thread lltp
Hi! (please bear with the length, I promise this is my last long post) * * * @Araq, I quite agree with @Jehan's view that eventually, a reasonable developer would try to provide structural guarantees in his code and in that sense, your suggestion (which make sense in general) would seem weird

Re: Question about NimEdit

2017-01-23 Thread Araq
I have a branch of NimEdit that uses nimx for the font rendering but never got it to work. OpenGL context setup issues. But if there is so much interest in my pet project, I will clean up the code and release it soon, hopefully.

Re: links on http://nim-lang.org/docs/documentation.html are wrong

2017-01-23 Thread Araq
[http://nim-lang.org/docs/documentation.html](http://nim-lang.org/docs/documentation.html) is obviously some broken stuff but the website doesn't link to it, as far as I know.

Re: Question about NimEdit

2017-01-23 Thread yglukhov
@Krux02, thats a bit sad to hear. Text-related stuff in nimx is designed to be fast, so if you're experiencing slowdowns, you might want to report that as a bug

Re: Audio/Video File Read/Write Support In NIM

2017-01-23 Thread yglukhov
If anyone's interested, I've started integrating webm support into the [rod](https://github.com/yglukhov/rod) engine. The core libs are [webm](https://github.com/yglukhov/webm) which is mkv/libvpx wrapper and [rod_video](https://github.com/yglukhov/rod_video) which is a component for rod. All

links on http://nim-lang.org/docs/documentation.html are wrong

2017-01-23 Thread oyster
for example, Language Manual is said to be [http://nim-lang.org**/docs/docs/**manual.html

Re: Winim - Nim's Windows API and COM Library

2017-01-23 Thread Araq
Translation: "awesome! Are you Taiwan?" Next time please speak English.

Re: Winim - Nim's Windows API and COM Library

2017-01-23 Thread echo
厉害厉害! 你是台湾的?

Re: C#/Java like interfaces for Nim

2017-01-23 Thread Krux02
Maybe you want to take a look at my Go like interfaces. [http://forum.nim-lang.org/t/2422#14994](http://forum.nim-lang.org/t/2422#14994) The difference between Go like interfaces and Java like interfaces, is that object that implement that interface does not need to be a ref object or inherit

Re: Question about NimEdit

2017-01-23 Thread Krux02
@hcorion Nimx is not ready for real applications. It is a proof af concept and a nice project to work on. But currently I get slowdows, just when I want to highlight some text. In my opinion that rules out nimx to be used for anything at this point in time.

Re: My stupid usage of cstrings

2017-01-23 Thread LeuGim
or proc genArray(i, j: int) : seq[cstring] = result = newSeqOfCap[cstring](j - i + 1) for k in i .. j: let s = $k GC_ref(s) result.add(s.cstring)

Re: My stupid usage of cstrings

2017-01-23 Thread LeuGim
Yes, if the strings used are stored somewhere as `string` at the time they are checked, the output is normal, e.g.: var s: seq[string] proc genArray(i, j: int) : seq[cstring] = result = newSeqOfCap[cstring](j - i + 1) s = newSeqOfCap[string](j - i + 1) for k in

Re: My stupid usage of cstrings

2017-01-23 Thread Stefan_Salewski
Thank you!

My stupid usage of cstrings

2017-01-23 Thread Stefan_Salewski
proc genArray(i, j: int) : seq[cstring] = result = newSeqOfCap[cstring](j - i + 1) for k in i .. j: result.add(($k).cstring) var a = genArray(1, 900) for i in a: echo i The output contains mostly valid numbers, but some garbage. Of course