nim-lang Questions

3

Solved

Looking for a way to read in a file from a tar.gz archive using the Nim programming language (version 0.11.2). Say I have an archive /my/path/to/archive.tar.gz and a file in that archive my/pa...
Tanberg asked 12/10, 2015 at 13:38

2

Solved

I am trying to learn Nim and its features, such Iterators; and i found that the following example works fine. for i in countup(1,10): # Or its equivalent 'for i in 1..10:' echo($i) However, Th...
Faydra asked 29/2, 2016 at 10:36

1

Solved

I want to load a large file line by line in Nim. I tried the following code snippet: for line in lines "largefile.txt": echo line However, this loads the entire file largefile.txt into memory w...
Jaundiced asked 30/12, 2016 at 14:0

2

Solved

Nim Compiler Version 0.13.0 (2016-01-19) [Windows: i386] How would I store a reference to a procedure in a tuple: Job = tuple[every:int, timescale:string, timestr:string, jobfunc:proc] proc run(...
Marcomarconi asked 30/8, 2016 at 16:9

2

Solved

I wrote a Nim program, echo("Hello.") And then I tried to cross compile for a Linux machine, nim c --cpu:i386 --os:linux -c hello.nim This produced the following output: config/nim.cfg(45, 2...
Anticlastic asked 29/4, 2015 at 6:4

1

Solved

I have a strategies expressed as generics in nim: proc fooStrategy[T](t: T, ...) proc barStrategy[T](t: T, ...) I would like to create a lookup table for the strategies by name... so I tried: t...
Ambrosine asked 29/4, 2016 at 5:52

2

Solved

I read this down and up: http://nim-lang.org/docs/times.html But still cannot figure the simple thing: how to get time in ms twice, once before my code, and again after my code runs, and then prin...
Capillary asked 12/4, 2016 at 15:22

1

Solved

So I know that if I define a const Nim will evaluate whatever I assign to it at compile time, so I could do something like this: proc compileTimeCode: bool = # Put code here return true const _...
Mig asked 10/1, 2016 at 22:23

1

Solved

I have a sequence and I want to remove an element from it at a certain index. How do I do this?
Libeler asked 2/1, 2016 at 16:48

2

Solved

I have read almost every example I could find via google, and couldn't accomplish the simplest task creating a dll (windows) from nim Could anyone explain it step by step? I am using the nim IDE...
Actinism asked 26/10, 2015 at 14:27

2

Solved

interoping nim dll from c# i could call and execute the code below if i will add another function (proc) that Calls GetPacks() and try to echo on each element's buffer i could see the output in the...
Afteryears asked 4/11, 2015 at 6:59

1

Solved

What's the best way to write and read a binary files in Nim? I want to write alternating floats and ints to a binary file and then be able to read the file. To write this binary file in Python I wo...
Ballade asked 13/10, 2015 at 15:58

1

In my process of learning Nim, I'm currently studying Nim's approaches to concurrent programming. I have seen a few comments about the limitations of a thread-local garbage collection (for instance...
Ivelisseivens asked 29/4, 2015 at 18:48

1

Solved

I want to create a dll from nim code. But i failed to register some other exports than "NimMainInner". Even if i try this simple example its not working: proc Hellow(): cint {.exportc.} = echo("h...
Bullyrag asked 29/9, 2015 at 8:30

1

Solved

I'm trying in Linux to statically link some code created in Nim into a Go application. I've followed the Nim Backend Integration docs and some articles for linking C in Go but haven't gotten it wor...
Cabanatuan asked 10/9, 2015 at 21:40

1

Solved

To me, one of the most interesting features of Nim is the not nil annotation, because it basically allows to completely rule out all sorts of NPE / access violations bugs statically, by the help of...
Stannwood asked 13/8, 2015 at 14:6

1

Solved

There are parsers available in the macros package, like parseExpr and parseStmt but they're {.compileTime.} procs. Is there any way to parse a string of Nim code at runtime, yielding an AST that c...
Arlinearlington asked 9/9, 2015 at 19:15

1

Solved

When going through the code in Nim project itself, I find that some proc decorated by "magic" pragma misses proc definition (example). There's no doc to explain the pragma, I guess the proc's defin...
Rakeoff asked 31/8, 2015 at 6:39

1

Solved

I have the following simple example of an inter-thread communication problem: I want to run arbitrary "anytime" algorithms in a background thread. An anytime algorithm performs some computation of ...
Luminiferous asked 29/4, 2015 at 18:46

1

Solved

I've been lately using templates and macros, but i have to say i have barely found information about these important types. This is my superficial understanding: typed/expr is something that must...
Dactylic asked 12/7, 2015 at 11:32

1

Solved

What is the Nim equivalence of List.Clear in languages like java or c# for sequences? I see listed in system the proc setLen, but im not sure it does what i want. From the description: f the curre...
Scraggly asked 30/6, 2015 at 10:48

2

Solved

I am brand new to Nim and am bumping into some issues. The following code results in SIGSEGV: Illegal storage access. (Attempt to read from nil?). I can't seem to figure out how to populate a seque...
Cohbath asked 18/5, 2015 at 9:0

2

Solved

Let's assume we have some existingIterator which iterates over elements of an arbitrary type T. What I now want to achieve is to derive a new iterator from existingIterator with a modified behavior...
Stilly asked 12/4, 2015 at 10:21

1

Solved

Suppose we have two modules: one defines an Object and one defines an ObjectFactory. The Object needs to have access to the ObjectFactory use some of its functions, and the ObjectFactory needs acce...
Ecumenical asked 14/5, 2015 at 10:31

2

Solved

The following code does not compile but illustrates what I would like to do: totalTests should hold the number of time that assertEquals() is called (assertEquals() should probably be a macro for t...
Glorianna asked 12/5, 2015 at 20:19

© 2022 - 2024 — McMap. All rights reserved.