I have wondered about this myself.
If all you need is local or UTC then you can do something like this.
import std/times
var t = fromUnix(convert(Milliseconds, Seconds, 1628231654073))
echo t
echo t.utc()
Run
The docs for `times` are [here](https://nim-lang.org/docs/times.html) .
I would like to bring some attention to two projects that I have been working
on.
[PhylogeNi](https://github.com/kerrycobb/PhylogeNi) \- A library for working
with phylogenetic trees (evolutionary trees).
[BioSeq](https://github.com/kerrycobb/BioSeq) \- A library for working with
biological se
Ah great! That is actually what I was trying to do before stripping things down
to a minimal example but I failed to realize that I needed the `ord` in order
for `enm` to work as an index. Thanks a lot!
I have some enum types which I am using to access values from lookup tables. I
thought for instances where the values would be the same for each enum that I
might be able to do this:
type
aEnum = enum A1, A2, A3
bEnum = enum B1, B2, B3
eitherEnum = aEnum | bEnum
For those deterred by the price or opposed to personal ownership of physical
books, consider placing a request with your local library to purchase a copy.
In my experience they are quite happy to fulfill such requests. And they would
have no way to know if you had already purchased a copy ;)
Great! Thank you!
I thought mixin was how to go about this. It wasn't clear to me from the manual
how I should apply it.
Is there a way to define a proc inside a file that is called from an imported
module. My idea is that I will have a library for doing common operations on an
object that has a generic type associated with it. Then a user could define a
desired behavior for some custom type that is triggered duri
Thank you for your reply!
I'm still confused though.
I can do this and `strformat` seems to have no issue with `cstring`
import jsffi, strformat, jsconsole
var
obj = JsObject{field: "1".cstring}
s = obj.field.to(cstring)
var f = fmt"{s} is a string".cst
I've encountered an error when trying to use `strformat` with a number in the
Javascript backend. It's not a show stopper as there is another way. But it is
really bugging me that I don't understand why I am encountering a problem and I
would prefer to use the `strformat` approach.
If I have th
I should have remembered that I could just do something like this:
proc foo(bar: var bool) =
bar = false
var bar = true
while bar:
foo(bar)
Run
Thanks for the comments!
Is there a way to break out of a named block from a proc called within that
block. I want to make some code a bit more readable by doing something like:
proc foo() =
break outer
block outer:
while true:
foo()
Run
I cant't figure out how t
I am struggling with wrapping some parts of a JavaScript library in order to
use it with the JavaScript backend in Nim. Examples that I have found don't
seem to match my scenario. Is this bit of JavaScript code clear enough that
someone could get me started in the right direction?
I first set a
It doesn't seem to me that it is just a limitation of echo.
This fails with Error: attempting to call undeclared routine: 'ext=':
n0.children[0].ext = true
Run
Whereas this works:
ExtNode(n0.children[0]).ext = true
echo n1[]
Run
Outpu
I have a type which contains instances of itself. I would like to inherit from
this type but when I try to access the contained instances, it seems that the
subtype is changed to the parent type.. The code below yields (children: ...)
instead of (ext: false, children: ...) as I had hoped.
Is th
15 matches
Mail list logo