nim-lang Questions
3
Solved
When using the import statement, how/where does Nim perform its search for modules?
I know that file paths can be used, but if I don't want to use a file path, where would I put the module I defin...
1
I've been experimenting with Nim for about a day now and I was wondering how you could make a type inherit from a builtin (seq specifically) so that procedures that operate on seq can also handle t...
Charlean asked 4/5, 2015 at 16:54
2
Solved
I would like to specify a sequence directly from a slice (rather than iterating through the slice and adding each element individually to the sequence). I've tried a few different ways but the obvi...
Weismannism asked 16/4, 2015 at 19:5
2
Solved
I have a C++ type like:
template <typename T>
class Vector {
struct Iterator {
};
};
And in C++ I can use Iterator as Vector<int>::Iterator.
How do I wrap this to use it from Nim?...
1
Solved
Compiling a Nim program with nim c -r example.nim creates the output file example. I would like to create an output file in another folder with the name bin/example.o which is much easier to gitign...
Homogenize asked 8/4, 2015 at 21:26
1
Solved
I'm having issues passing math functions (procs) in Nim (version 0.10.2).
import math
var s1 = @[1.1, 1.2, 1.3, 1.4]
var s2 = map(s1, math.sqrt)
I get the error
Error: 'sqrt' cannot be passed ...
Gaitan asked 7/4, 2015 at 16:18
2
Solved
I'm planning a project with multiple modules, and I was looking for a nice solution to run all existing unit tests in the project at once. I came up with the following idea: I can run nim --define:...
Bluefield asked 1/4, 2015 at 18:41
1
Solved
Just started programming in the Nim language (which I really like so far). As a learning exercise I am writing a small matrix library. I have a bunch more code, but I'll just show the part that's r...
Maddock asked 5/4, 2015 at 19:53
1
Solved
I'm puzzled by the following observation. On the one hand, this works:
for i in 5..10:
echo i
But as soon as I store the slice in a variable, I can no longer iterate over it, i.e., this fails:
...
1
Solved
From what I understand, strings in Nim are basically a mutable sequence of bytes and that they are copied on assignment.
Given that, I assumed that sizeof would tell me (like len) the number of by...
1
I am trying to make a simple use of typeclasses in Nim. Please, keep in mind that I only have been using Nim since this morning, so I may have been doing something stupid.
Anyway, I would like to ...
1
Solved
Is it possible to use function pointers in Nimrod?
What I've tried is:
type fptr = (proc(int):int)
proc f(x:int): int =
result = x+1
var myf : fptr = f
echo myf(0)
but when I try to compil...
Ponzo asked 5/5, 2014 at 18:53
2
Solved
NOTE: I am not asking about difference between pointer and reference, and for this question it is completely irrelevant.
One thing I couldn't find explicitly stated -- what model does Nim use?
Li...
1
Solved
I found this project on GitHub; it was the only search term returned for "nimrod matrix". I took the bare bones of it and changed it a little bit so that it compiled without errors, and then I adde...
1
Solved
Going through the second part of Nimrod's tutorial I've reached the part were macros are explained. The documentation says they run at compile time, so I thought I could do some parsing of strings ...
Lamarckian asked 13/11, 2013 at 13:40
2
Solved
today I did ask in D mailing list whether it's possible to define and use custom data types in a way similar to e.g. example from Ada's wiki page:
type Day_type is range 1 .. 31;
type Month_type i...
1
Solved
I am toying with nim (at the time of writing still called nimrod), by writing a Brainfuck interpreter in the language. Without loops implemented, I have:
import os, unsigned
const RamSize = 200
...
Expertize asked 30/5, 2013 at 17:50
© 2022 - 2024 — McMap. All rights reserved.