Questions tagged [nim-lang]
Nim (formerly known as "Nimrod") is a statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their various forms.
nim-lang
686
questions
1
vote
1
answer
51
views
How do I read all keys pressed in nim since the last call to a function, without needing to press enter
I need to read keys from stdin without blocking, and without only recieving them when a newline is pressed. The way i would like it be formatted is a sequence, where each item is a keypress or ascii ...
1
vote
0
answers
54
views
strings as functions during parsing
TL;DR
Given: sequence of Token and Grammar
Where:
Token := tuple[name:string, value:string, parent:Token]
Grammar := Table[system.string, proc(x:Token):string]
Return: string of token values ...
0
votes
0
answers
113
views
Use openssl and RSA encryption in nim
I want to use openssl for RSA encryption in nim however pointer types in nim are causing me problems. Currently I have this code:
import openssl
var publicRsa: PRSA
var privateRsa: PRSA
let ...
0
votes
0
answers
29
views
How to serve acme-challenge file dynamically with Jester REST API?
Is it possible to dynamically serve the acme challenge file generated and required by certbot with rest api by jester with nim lang?
I have this code
get "/.well-known/acme-challenge/@challenge&...
0
votes
1
answer
163
views
Flake fails on update, nimPackages is missing, where has it gone?
A while back, I had a flake.nix which worked:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
...
0
votes
2
answers
155
views
What are the types of arrays with variable size and accommodating different types in Nim?
Nim is my second language after Python. Python has a universal array type, the "list" type. It has a changeable size and can accommodate any type. I am currently sorting out and studying Nim ...
1
vote
1
answer
191
views
What are the main ways to do a reverse iteration in Nim?
I'm learning Python. I recently learned about Nim and began to study it too. I liked the python+pascal syntax and the speed of C. Unfortunately, there is much less educational information and ...
1
vote
1
answer
182
views
How to fix this error : simple run error with the library faster_than_requests
here is my simple code with the faster_than_requests library :
import faster_than_requests as requests
t = requests.get("http://httpbin.org/get")
print(t)
As you can see the code is not ...
3
votes
1
answer
125
views
Why isn't the order of a sequence kept in nim when deleting an element?
I am trying out nim and struggling with a strange behaviour while working with sequences.
If i run this code:
var
hobbies = @["Coding", "Creating", "Sports"]
echo ...
1
vote
2
answers
262
views
lldb in vscode: how to show string values on hover?
I'm debugging a C app in VS Code on Mac OS (arm64).
I can set breakpoints and see stacktraces. However, for variables, memory addresses are shown instead of values. The variable I want to inspect is ...
0
votes
1
answer
108
views
Is it possible to globally modify the AST in Nim?
In Haxe, it's possible to iterate through and modify a project's entire AST prior to typing using @:build macros. I was wondering if it was possible to do something similar with Nim?
Nim has a rich ...
0
votes
1
answer
66
views
Nim: Analog of .dirty. pragma for macros
I am trying to write a macro which, among other things, gives a forward definition to a procedure which will be defined outside of the macro. However, I am getting a error. (This is similar to the ...
1
vote
1
answer
56
views
How to call iterator for Chipmunk 7 bindings (Nim)
I'm using the chipmunk7 library bindings, and trying to call the iterator eachShape. The bindings source is here
SpaceShapeIteratorFunc* = proc (shape: Shape; data: pointer) {.cdecl.}
## Space/body ...
0
votes
1
answer
140
views
Declare procedures prototypes in nim
I am trying understand how I can declare, in a nim source, different procedures that call each other, as it sounds like the compiler expects all calls to come after the declaration, but the procedures ...
1
vote
1
answer
53
views
Using nnkDotExpr to create an ident in Nim
I am trying to use nnkDotExpr in a macro and am getting an error. Specifically I am trying to write a macro which will write a procedure that returns a specific field. I have tried three approaches ...