Are there any existing implementation of NaN tagging in Nim?
(I'm about to do it myself - or at least experiment with to see if there are
any performance benefits - but having sth for reference wouldn't be bad at all
:))
I've just noticed sth very weird.
I have 2 different tasks in my _nimble_ file. One builds the project with
\--opt:size and one with \--opt:speed. The thing is the resulting binary with
the first option is over 900KB, while with \--opt:speed it get down to
600-sth(!). How is that possible?
Thanks a lot. Very thorough explanation!
Good to hear! I couldn't find the source for the new version of the live demo
though. In the markdown document it's still the old code as far as I can tell.
Yes, please just ask!
I wrote a very simple web application just to learn how to do the job.
Basically, the web page present a few lines of the Iliad, and has a visitor
book. In the previous version, the visitor book worked with ASCII characters
only. However, I noticed that many people wanted to test the page with
Hi, Vindaar. I will use the solution you pointed out in the tutorial. By the
way, if you visit the demo page, you will see that I already replaced the
inicial version of the program with another one, which is based on the scanf. I
also used the decode.Url procedure in order to test the utf-8
@Stefan_Salewski, Thanks.
@juancarlospaco Let me try.
Thanks for the reply
Thank you for your answer. I think that's because Nim does not free memory to
OS. It's still ok for me that it's not memory leak
Hi all,
I have submitted issue [#12625](https://github.com/nim-lang/Nim/issues/12625)
on GitHub on generating func-s (closures) with mapIt, where the code crashes
nimvm or behaviors wrongly in runtime.
Further checking indicates that the root cause is that, {.inject.} variables
(it in this
Oh I see.
Thank you.
Not sure if this helps, but here an example:
The Complex type (at the Standard Math/complex pure library) used to be a
tuple, and was upgraded to a generic object. There are two possible
representations of a complex number: rectangular and polar. The library and
most functions are based on the
According to your error message, it seems tokens[ITEM_NAME] is
Option[system.string] type and you are trying to add it to seq[string] type
result variable.
You might need to read this document and learn how to get a value from an
Option type.
The following code used to compile in nim 0.19:
result = newSeq[string]()
...
var tokens =
li.match(re"\s*(\S+)\s*(?:>\s*(\S.*\S))?\s*").get.captures.toSeq()
# Add to the list of list values
result.add(tokens[ITEM_NAME])
I guess the link to the Python 2 version of the library was only by accident.
If some new functionality in Nim should be modeled after Python, refer to the
documentation for Python 3.
For most older libraries, there shouldn't be a big difference, but for newer
libraries there may be, and even
Put types on a dedicated file, `include` it.
Recently, I have been working on euwren, a high level wrapper for
[Wren](http://wren.io/).
The idea behind euwren is to be _the king of Wren wrappers_ , one that uses a
user-friendly DSL and that makes wrapping Nim procs a piece of cake. All you
have to do is list the things you need in the
Hi all, I have a recursive module dependency. How to solve this ? Say, i have
two modules like this.
#module_A.nim
type
a_Type* = ref object
aVar* : b_Type
Run
And in another file,
#module_B.nim
type
b_Type* = ref
When you have types that depend on each other, you must place them under one
`type` section—there's no way of avoiding that.
See also
[https://forum.nim-lang.org/t/4745](https://forum.nim-lang.org/t/4745)
Congrats for 1.0 milestone. I'm glad to see that the Complex type is not a
tuple any longer but an object and allows generics like the Rational type. That
makes more sense now. Great job.
I created GitHub Actions too. And I published it.
[https://github.com/jiro4989/setup-nim-action](https://github.com/jiro4989/setup-nim-action)
[https://github.com/marketplace/actions/setup-nim-environment](https://github.com/marketplace/actions/setup-nim-environment)
But my actions is very
See the first 3 examples in
[https://nim-lang.github.io/Nim/manual#procedures](https://nim-lang.github.io/Nim/manual#procedures).
`;` is used to explicitly break the type propagation. In most use cases though
(when not using `using`), there's not much distinction between `;` and `,`.
Be that as it may, the fact remains that nim-mode is written in elisp. ;)
I don't even think these changes are hard at all, but I don't know my way
around how to find the code responsible for those indentations without studying
all of nim-mode first.
Ok. Just to close the loop on this thread I believe this accommodates all
expressed views:
[https://github.com/nim-lang/Nim/pull/12678](https://github.com/nim-lang/Nim/pull/12678)
(except maybe one week pre-release implies backward compatibility forever view
or the if one-table has a proc, all
when you're listing multiple parameters under one type like this
proc test(a, b: int)
Run
if you're gonna use semicolon, the a parameter wont be an int. in current nim
thats just useful when you're using the using statement
As far as I know, Vindaar, it is possible to program Emacs in any language
through the Emacs Dynamic Mode. I believe that even in Nim. It is also possible
to write extensions in neovim for any language, although the feature works
better in the case of dynamic languages, such as Common Lisp,
What Nim calls the Table Constructor as dom96 has correctly pointed out, the
lisp world has long called "association lists", often abbreviated "alist".
Since it is a macro you are writing, you could check that the kind of the
NimNode is `nnkTableConstr` and if not emit a useful compile-time
They have a wheel per platform and pip/conda select the correct one on install.
The python os.walk is exceptionally convenient and supports such a use case -
the iterator returns 3 components: "path", "dirs" and "files"; the user has to
enumerate "files" (or dirs) themselves, and join themm to the "path" for the
list of files, but can also ignore dirs or modify it - the
It's only there for no-copy interop with C libraries. If you want to access it
you need to cast with `cast[ptr UncheckedArray[char]](s[0].unsafeAddr)`
None.
> What's the underlying difference between this signature: proc max(a: int; b:
> int): int = and this proc max(a: int, b: int): int =?
As per "Nim in Action", strings are lists of char`s terminated by `'0' (page
29). In the code below, how can I access that null byte?
let s = "Abcd"
echo s[s.len()] == '\0'
# Error: unhandled exception: index 4 not in 0 .. 3 [IndexError]
Run
So originally I wanted to write a up a nice example to do the replacements via
the scanf macro:
[https://nim-lang.github.io/Nim/strscans.html](https://nim-lang.github.io/Nim/strscans.html)
by defining tuples of strings to match against and their replacements, but I
hit a dead end, because an
35 matches
Mail list logo