That's great, thanks!
Hi, I am trying to use concepts and have a question about this.
I have the following code and this compiled successfully.
type C = concept x
x.val is int
type X = object
val: int
proc initX(val: int): X = X(val: val)
let x: C = initX(1)
ech
You can use `\p` in a string instead of `\n`:
[https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals](https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals)
I can't find anything like this in stdlib.
Maybe you're remembering something like `ospaths.DirSep` or Python's
[os.linesep](https://docs.python.org/3/library/os.html#os.linesep)?
System
[readline](https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L3135)
works with either line ending.
https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export
Ok, thats bit unusual. Good to know, thank you.
Adventures in calling Nim DLLs from Delphi again... If I use the following code
I can get the string on the Delphi side using PAnsiChar as expected:
proc GetString*(): cstring {.cdecl, exportc, dynlib.} =
var cs: cstring
cs = "String1"
return cs
Run
G
I remember the standard library having a module with functions which could tell
the default line ending of the current OS. I tried to search for it but
couldn't find anything.
@sayol, mratsim is right. The init method's name doesn't matter for the
properties. The constructor is generated based on the properties, so if you
change it to
class MyClass* of RootObj:
var
x*: int
...
Run
You also need to change the constructor ca
Ah, sorry. Of course i did change body of init and print to use instance
variable x so this part is fine.
Though changing constructor call to m = MyClass(x: 111) doesnt make much of a
sense to me. Name of constructor parameter is still value, not x.
Thanks, it works!
But, as this only hides the warning and doesn’t suppress the check , I hope
that, despite what is said in the message, this warning will never become a
compile time error.
{.push warning[ProveInit]: off.} and {.pop.}.
Hi,
When trying to solve some project Euler problem, I declared something like that:
import tables
const N = 16
type Digit = range['0'..'9']
var counters: array[N, TableCount[Digit]]
var exclusion: array[N, set[Digit]]
. . .
Run
and got the usual wa
You're missing {.dynlib.}
Mostly math really.
Depending on your parallel use case:
* if you need data parallelism, you can use OpenMP, I wrote some helpers I
find useful for [parallel tensor computations
here](https://github.com/numforge/laser/blob/9fbb8d2a573d950573c7249e3a5d6cdd784a639e/laser/openmp.nim).
* for task parallelism, there
Damn, I like parallel computation.
If you manage to convince the "disjoint checker" you can use it, but
unfortunately the underlying `threadpool` library is also pretty unreliable.
But the worst offender here is the `blockUntilAny` API which `parallel` does
not use.
It seems that parallel using spawn is experimental. Is it safe to use?
I liked day 5, day 7 and day 8.
Hi,
I'm trying to build a setup in which I could write .dll libraries that I could
call from excel. Now, I've managed to make it work with C. There I have two
files:
1) excelfunctions.c:
#include
double _stdcall square (double *x)
{
return *x * *x;
}
Thanks for reminder, it is time to book tickets and hotel. I plan to be there
I solved it: I used hasDataBuffered() and readLine() instead of just recvLine()
from the net package.
23 matches
Mail list logo