> includes a convenience iterator, rows,
Looking at your example code, I think that `rows` should be `cols`? Because in
your example, `r[0]` points to the first field or column and `r[1]` points to
the second?
I have some notes on that "proc type" syntactic sugar `->` here:
[https://scripter.co/notes/nim/#proc-type-sugar](https://scripter.co/notes/nim/#proc-type-sugar)
This issue is now fixed on devel, but there's another regression with `nim doc`
\+ `runnableExamples`:
[https://github.com/nim-lang/Nim/issues/14485](https://github.com/nim-lang/Nim/issues/14485)
.
After
[https://github.com/enthus1ast/nimAsyncHttpTools/pull/2](https://github.com/enthus1ast/nimAsyncHttpTools/pull/2),
`simplehttpserver` compiles and runs well on my machine (RHEL 6.8).
@bung You do not have an Issues section on your fork. I wanted to ask you if
the dependency on libzip can be made optional? (See [my message
above](https://forum.nim-lang.org/t/6386#39399) ). The original `nimhttpd`
builds and runs fine on my machine (RHEL 6.8), but trying to run your fork
fail
Awesome! That is the winner!
@Araq It would be now cool to bake that into nim :)
OK, it builds find after uninstalling `zip` and doing `nimble install
zip@#head`.
So the correct fix is:
1. Cut a new release of the `zip` nimble package
2. Cut a new release of your `finder` package with updated zip version in its
dependency
3. Finally update your `static_server` package
ok. .now it compiles, but doesn't run:
> could not load: libzip(|2).so(|.4|.2|.1|.0)
I'll have to figure this out later. I am using an admin managed OS, a very old
OS: RHEL 6.8 (Linux).
I tried your repo as well. I cloned it and did `nimble build`, but it failed
with this: [http://ix.io/2nAa/text](http://ix.io/2nAa/text)
It looks like the `psutil` dependency needs to be updated for a backward
incompatible change that happened in nim 1.0.0. Now we have `isDigit` taking
only `ch
The aim of my post was if there's a way that Just Works for kicking off an
adhoc server, like `python3 -m http.server` does, **and** then have that baked
into nim as well.
Hello, I cloned your repo and did `nimble build`. It failed with this error:
[http://ix.io/2nA6/text](http://ix.io/2nA6/text)
I am using the latest nim devel.
Using python, one can trivially fire off an HTTP server to serve the files from
the current directory using:
python3 -m http.server
Run
Is there an equivalent one-liner for Nim?
Wow!.. why is it in **cligen** though? It looks like it can be a separate
`find`-competition package :)
I have reported this in issue
[https://github.com/nim-lang/Nim/issues/14473](https://github.com/nim-lang/Nim/issues/14473)
. Thanks for providing that minimal example.
I have seen a similar issue on nim devel too. I am trying to create a
reproducible example for that.
I also see runnableExamples trying to get executed from sequtils.. My Nim
module does import sequtils, but there are no runnableExamples in it.
Also, I think this issue happens when I have \--pa
This happens on nim devel (the version should be 1.3.5). I see that you are
using nim stable 1.2.0.
It's on my list to learn GitHub Actions. I just had a comment about the
NimScript task archive. You can put that into a global config.nims of yours
which you pull in before building all of your projects.
I have started using [this minimal
config.nims](https://github.com/kaushalmodi/ve
Turns out that this issue was because of some mixup in the LD_LIBRARY_PATH.
Once was was fixed, the nim program built with even g++ 9.1.0 links fine with
the external_lib_64.so built with g++ 6.3.0.
Hello,
Today I came across this run time error when running a nim compiled program
that dynamically linked with an external c++ library .so (let's call it
`external_lib_64.so`)
could not load: external_lib_64.so
compile with -d:nimDebugDlOpen for more information
glob anyways imports the regex module (
[https://github.com/nitely/nim-regex](https://github.com/nitely/nim-regex) ).
So you might as well just use that instead of importing nre.
nre will introduce a dependency on PCRE on your app, while the nim-regex module
won't.
Thanks, except for those bold/italics, other rendering (especially the Markdown
link syntax) is nicely supported in the newer nimforum version:
[https://forum.my-toolbox.xyz/t/6](https://forum.my-toolbox.xyz/t/6)
Testing quote block:
> some quote
echo "hello"
Run
_[Italics](https://forum.nim-lang.org/postActivity.xml#italics)
**Bold**
_ **Bold and italics** _
[Nim website]([https://nim-lang.org](https://nim-lang.org))
## heading level 2
## heading level 3
This is now fixed in nim devel. Now I auto-generate the docs for Std::Vector
Nim wrapper (
[https://github.com/kaushalmodi/std_vector](https://github.com/kaushalmodi/std_vector)
) to
[https://kaushalmodi.github.io/std_vector](https://kaushalmodi.github.io/std_vector)/
.
@timotheecour has this feature addition in a pending PR in
[https://github.com/nim-lang/Nim/pull/14278](https://github.com/nim-lang/Nim/pull/14278)
. It should be merged soon it seems :)
@krtekz Awesome! Also make sure you share your optimized final code here for
anyone who ends up on this thread in future :)
@shashlick Did you have something in works that generated JSON Nim docs?
I have a bit involved NimScript:
[https://github.com/kaushalmodi/nim_config/blob/master/config.nims](https://github.com/kaushalmodi/nim_config/blob/master/config.nims)
See if going through it and referring to docs helps you.
> I think it's for reducing unneeded allocations? Is it correct?
That would be my guess. But I am not on expert on that. Hopefully someone else
can give a thorough answer for that.
> dup stands for "duplicate"?
Yes.
I have taken the `dup` example from the 1.2 release notes and have refactored
it a bit to help better explain this feature:
[https://play.nim-lang.org/#ix=2gxD](https://play.nim-lang.org/#ix=2gxD)
Basically the `dup` macro helps **resuse** a proc that had (1) mutable arg and
(2) no return type
Read that post, peek at the calendar and have a laugh ;-)
ggplotnim is an amazing library and @Vindaar's support has been excellent! I
have been using it in a convoluted (pun intended) way -- using to plot FFT's of
analysis done in MATLAB via its exported-to-C libs importc'd into Nim.
It can be used to generate any templated file you like. I have used it to
generate SystemVerilog and HTML files.
What are you trying to achieve and where do you need help with the Source Code
Filters?
Also related to your C library wrapping project, have a look at
[https://github.com/nimterop/nimterop](https://github.com/nimterop/nimterop).
Using that, I have successfully wrapped quite a few C libraries, and this is
coming from someone who has never coded in C (of course, some learning curve
Related to your plotting application, also have a look at ggplotnim:
[https://github.com/Vindaar/ggplotnim](https://github.com/Vindaar/ggplotnim) .
It helps me make things like:
> how about you first get familiar with the correct Nim syntax for them? link
Wait, you are linking against the deprecated lc syntax.
I believe the closest non-deprecated solution is
[https://github.com/alehander92/comprehension](https://github.com/alehander92/comprehension)
?
Wow! I didn't know of [https://float.exposed/](https://float.exposed/). Cool
website!
Your answer was nice but I think you it was equally helpful without:
> It's a bit hard to believe that this is a serious question because of..
and
> But maybe you missed that and have no CS experience.
I think most people would have stumbled across this in one programming language
or another.
I have attempted to fix this issue in this PR:
[https://github.com/nim-lang/Nim/pull/13482/files](https://github.com/nim-lang/Nim/pull/13482/files)
XML/xmltree experts: Please review that PR and help me make it better!
It's probably because you are using `newXmlTree` for both **channel** and
**rss** tags. May be you should use `newElement` for **channel** too?
_PS: I am just guessing; I haven 't used this library._
In case you weren't aware you can indent . chaining in Nim like this too if you
like: [https://play.nim-lang.org/#ix=2bRv](https://play.nim-lang.org/#ix=2bRv)
> slightly less flexibility Re help messages.
Now you're just being modest. `cligen` is awesome!! I can't think of starting a
new CLI project without cligen now. What "slight less flexibility"? It has much
more flexibility than I can think of (this is a compliment) :)
Oops! In hurry, I pointed to a 1.0.6 nightly build.
Windows builds are also done. Try this few days older nightly build which has
windows too:
[https://github.com/nim-lang/nightlies/releases/tag/2020-01-23-version-1-0-89b39ee](https://github.com/nim-lang/nightlies/releases/tag/2020-01-23-version-1-0-89b39ee)
Yeah that's a local hack (that works).. the back is in the associated closed PR.
The real fix is pending because I don't know yet how to add the `--backend`
switch just to the `doc` subcommand.
I needed this feature few weeks back and opened this issue:
[https://github.com/nim-lang/Nim/issues/13129](https://github.com/nim-lang/Nim/issues/13129).
It's on my list to try to implement the suggested `-backend` switch for `nim
doc` that uses the specified backend for compiling and running th
Yes, that code relies on the directory containing the nim binary (usually bin/)
and the Nim lib/ directory to have the same parent directory.
But the PR that timothee has submitted should resolve that issue.
I do it this way:
[https://scripter.co/notes/nim/#nim-stdlib-path](https://scripter.co/notes/nim/#nim-stdlib-path)
**end** is used (and required for `if`) in the [Nim Source Code
Filters](https://nim-lang.github.io/Nim/filters).
I made some progress! @mratsim, the `[]` proc imports from your snippet proved
very useful. I can finally loop through the `Vector` values.
The only puzzle is.. how do I use the `VectorIterator` imported from the vector
lib?
My updated wrapper:
[https://play.nim-lang.org/#ix=271H](https://play
@deech
Thanks. That will serve as a useful reference. I looked through it, but it
doesn't give an example on how to use the `vector::iterator` type.
Just by fluke, I replaced the `begin` and `end` proc types to be `ptr T`
instead of the iterator, and it returns the begin and end pointers.. thou
Also, this construct:
type
Vector* {.importcpp: "std::vector", header: "vector".} [T] = object
Run
gives this warning:
> Warning: pragma before generic parameter list is deprecated [Deprecated]
What is the right way to import that type so that I do not get that
This works on the latest Nim release (should work on 1.0.2 too):
[https://play.nim-lang.org/#ix=26Zl](https://play.nim-lang.org/#ix=26Zl)
Hello,
Has anyone written a Nim wrapper for the C++ std::vector library (even
incomplete)?
I started putting it together using bits and pieces I found from googling, but
as I don't know C++, I reached a roadblock very soon when I tried to map the
std::vector::iterator and associated procs like
My first time participating in Advent of Code!
[https://github.com/kaushalmodi/aoc2019](https://github.com/kaushalmodi/aoc2019)
:)
> there is not need in auto inferring, since type of x well-known before, and
> it can not be changed implicitly by Nim rules.
It's the job of the compiler to ensure that the type of the value on right hand
side matches with the type on left hand side.
I cannot rely on the user always doing the
> why does it work with char?
Nim is a compiled language. So at the time of compilation, it checks if the
value assigned to a variable fits the type of the variable in the declaration.
Nim auto-infers the type looking at the **right hand side** of an assignment.
So ..
type
CharSet = set[int16]
Specifying the type only for the first literal also works..
[https://play.nim-lang.org/#ix=23CE](https://play.nim-lang.org/#ix=23CE).
Hello,
Today I was surprised to see this commit where the Nimacros authors stopped
working on that project and deleted all the past work from the repo:
[https://github.com/FemtoEmacs/nimacros/commit/bcadfcd40fcd4070f566accf8daaada781e9386c](https://github.com/FemtoEmacs/nimacros/commit/bcadfcd40
Can you show with an example where the "original directory" is, where the
.nimble is, and what path you are trying to get?
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 `,`.
I'd just use a tuple or object for that.
I have few NimScript tasks which you can see in my repo's README:
[https://github.com/kaushalmodi/nim_config/blob/master/README.org#list-available-tasks](https://github.com/kaushalmodi/nim_config/blob/master/README.org#list-available-tasks)
Those tasks are defined in the config.nims in that
+1 for pop.
Have a look at
[https://nim-lang.github.io/Nim/options](https://nim-lang.github.io/Nim/options)
.
> git rebase is much better than git merge for branches because it keeps the
> history clean.
Yes, please do not do merges if the commit history can be linear (using
rebases, cherry picks, etc).
I have ended up with the same set of questions today. Hopefully someone can
answer.
Not exactly what you were looking for, but here's a related fun little snippet:
[https://play.nim-lang.org/#ix=20Hp](https://play.nim-lang.org/#ix=20Hp)
If you use countUp in the loop, it will optimize your code a bit as it accepts
the step size.
May be something like this?
[https://play.nim-lang.org/#ix=20nQ](https://play.nim-lang.org/#ix=20nQ)
Nim internally has an int128 to fully handle uint64. Now to fully support
uint128, it will need an internal int256! :P
Being a Lisp fan too (Nim fan of course), I have a section for ["Lambdas in
Nim"](https://scripter.co/notes/nim/#lambda) in my Nim notes.
tps://nim-lang.github.io/Nim/macros#lispRepr%2CNimNode)), Nim
templates can be redefined as you can do lisp expressions, you can easily
introspect the types of variables and procs, as you can do in lisp. I even
started this fun project [elnim](https://github.com/kaushalmodi/elnim).
> Are the
You got the colon and parens in reverse order.
But I came to say here this. Once you know the consistent style of proc
signatures, it's really easy to search for things.
The procs are defined as:
proc foo(arg1: Type1; ..): ReturnType =
Run
So to search for procs retu
yeah, but I would be surprised if a GNU/Linux distribution did not have gcc,
git, curl and find (that script is for a GNU/Linux system).
On Linux, I just run this for deploying Nim at work:
[http://ix.io/1X9Y/bash](http://ix.io/1X9Y/bash)
It results in a meager 19MB install size.
> seems weird to me that they are closed even though it still doesn't work.
I think you should open new issues with recipes to reproduce the problem.
I'm on RHEL 6.8. I put a `config.nims` in `$XDG_CONFIG_HOME/nim/` and that
works fine.
This post is probably referring to
[https://dev.to/t/nim](https://dev.to/t/nim).
Assuming that that input is from the command line, you can use the inbuilt
commandLineParams() instead of manually parsing it (example in my notes:
[https://scripter.co/notes/nim/#command-line-parameters)](https://scripter.co/notes/nim/#command-line-parameters\)).
Though, I use the **cligen** pa
> So I'm wondering why does the following code get compiled
Because it comes from jester:
[https://github.com/dom96/jester/blob/dc74a797ebca15e4f1b46a7f2e1f4e733b1c5ee2/jester.nim#L588](https://github.com/dom96/jester/blob/dc74a797ebca15e4f1b46a7f2e1f4e733b1c5ee2/jester.nim#L588)
I haven't used flymake, and I have used flycheck only for shell scripts (it
checks Bash scripts using shellcheck, and it's pretty awesome).
I believe it has to do with nimsuggest. I tried using flycheck about a year ago
and nimsuggest froze more often than not.. so I ended up disabling nimsuggest,
and thus flycheck for nim-mode.
> Can I turn off all the hints?
In your test directory, you can create a `config.nims` and put this in there
for all the hints that you want to hide:
hint("Processing", false) # Do not print the "Hint: .. [Processing]"
messages when compiling
Run
> I don't think it really argues/advises against @mratsim's warning/hint
> solution.
Correct.
The hint is fine. I was just saying that setting the default to `-d:release`
would just switch to the other problem bucket.
I have come across a scenario where the gcc -O2/-O3 "over-optiimized" the code
and that resulted in a buggy behavior.
So I needed to put a note to **not** pass the `-d:release` switch for that
project. The discussion was on Nim IRC few months ago.
This needs some nice exposure. Please consider blogging about it somewhere :)
Dumb question.. wouldn't it then make sense to define your "default type proc"?
proc returnZero[T]() : T =
return T(0)
proc returnZeroDefault() : float =
return returnZero[float]()
echo returnZeroDefault()
echo returnZero[int]()
Run
[ht
> Nah, it's a pretty known fact.
This is a case that Spiderman's uncle talked about: "With great power comes
great responsibility".
With the possibility to tweak Emacs anyhow one likes, that also increases the
chances of one badly tweaking Emacs.
One should not blindly paste configs from other
> And Emacs itself tends to be somewhat unresponsive, as evidenced by the very
> first posts in this thread.
That's a grossly incorrect generalization.
I agree that Emacs has a weak spot when handling long lines. I have been using
Emacs for 14+ years, and I never came across that limitation, ma
Oops, I was playing with the longlines.nim and did not run nimpretty on that
last modified version. But rest assured, that asdf was manually typed by me :D
You are right; may be nim-mode is exacerbating the slowness issue.
I haven't come across this issue as I limit the number of chars per line to
around 80.
Try using `nimpretty` that ships with Nim.
With a `longlines.nim` ( [http://ix.io/1QnF](http://ix.io/1QnF) ), running
`nimpretty longlines.n
> Emacs slows down when you have long lines
I agree, but that would be a rare case where you have a single line
unprettified JSON or something like that.
How long are your lines in Nim? I default to 80 chars per line. For Emacs, "too
long" lines would be in the range of upper hundreds of chars
> I am using version 25.1
The latest stable release as of today is 26.2, which I would recommend
upgrading to. I am on the latest master build of emacs (27.x).
Emacs here, using mostly the default key bindings.
About the slowness, you probably just need to disable the `nimsuggest-mode`. I
haven't noticed any slowness when editing Nim code (or anything) in Emacs.
I don't have the full solution, but I believe a `static` type `typedesc` arg
will get passed without conversion to NimNode? I think there's an example in
tut3.
This is very related:
[https://forum.nim-lang.org/t/5027#31537](https://forum.nim-lang.org/t/5027#31537).
Does that help?
You are welcome! I am surprised I was able to answer a macro-related question
:D (Well, my Nim macro knowledge is limited to just about that :P).
@GULPF Do you mean something like this?
[https://play.nim-lang.org/#ix=1MUr](https://play.nim-lang.org/#ix=1MUr) (click
Run, and if the tab next to is says "Showing: output", click on that so that it
switches to "Showing: debug").
Using your example:
[https://play.nim-lang.org/#ix=1OOM](https://play.nim-lang.org/#ix=1OOM)
1 - 100 of 188 matches
Mail list logo