Mastering Nim, 2nd edition
nim-lang.org
nim-lang.org
Modeling problems is almost as powerful as a Lisp: It prefers stack allocation, immutable data, and referentially transparent procedures, but all of that can be short-circuited when necessary. The type system is simple and clear. The syntax is Pythonic and easy to make readable and self-documenting. Magic is not required. The Datamancer data frame library is incredibly robust. The standard library is quite extensive, and the included JSON data structure functions well as a dynamic, heterogenous structure when needed. Turning Nim objects and data into JSON is so trivially easy that it's a no-brainer for my use case, and probably web-focused use cases as well. Nimja templating is incredibly good and great for building pages or documents, so long as you're preprocessing as much as possible (as with most templating libraries). C interop is also trivially easy, requiring no more than a function signature in most cases.
I can absolutely say that Nim has been a secret weapon for tackling the specific data processing problem I've been solving. Highly recommended, especially if you can invoke it from the CLI using other languages to solve things such as UI. I'm building an Electron app around it currently, and the NodeJS backend invokes my Nim program.
- [0] `nim secret` : code is interpreted with Nim's vm. It is limited to compile-time evaluations (e.g. no C/C++ interop).
- [1] `nlvm r` : nlvm backend supports JIT compilation and repl-like interface was added in latest release.
- [2] inim : supports all nim code, but it's not really a true repl. It adds code to a file and recompiles it (you can see the source file with `ctrl+x`). I'd recommend to use it with clang compiler, because it's a bit faster than gcc in my experience. It's the best option right now. And I use it almost daily.
First two options have rudimentary input system. But you can get command history and left-right navigation by wrapping them with rlwrap (should be preinstalled on most *nixes): `rlwrap nim secret`, `rlwrap nlvm r`.
There are plans to support incremental compilation for the next Nim release (it is currently broken). That would improve inim and other repls experience significantly.
[0]: https://nim-lang.org/docs/manual.html#restrictions-on-compil...
Thank you for the kind words! :) Especially given that it's a one-man side-project always makes me a bit worried people will stumble over all sorts of issues.
The community is sharing and discussing their solutions on the forums[0] and in the dedicated matrix room[1].
The limited scope of individual problems makes them great to see the language in action, compare different approaches and asses how its syntactic weaponry and standard library can help solving the tasks at hand quickly and efficiently.
Only "mainstream" app I know that runs Nim is Nitter.net
wc -l --total=never **.nim|cols 1|cstats ms q.05 q.95
75.5 +- 5.7,22.5,175.25
So, around 1..2 pages for a 70-row terminal window, with a 5th & 95th Parzen interpolated quantiles of 22.5 and 175.25 lines.There is not really an ergonomic, performant http server that people converged to.
Anything production quality is mostly from Status.im and people like Treeform and Guzba who also have a production use case.
If you want to do systems programming with less hassles than C/++ (you understand them well), you appreciate the limits and pitfalls of AMM (and you don’t want/need Rust’s borrow checker), and you’re into metaprogramming, well then Nim is a great tool for your toolbox.
It can also serve newcomers to programming decently well and enables DSLs such as Enu ( http://getenu.com/ ). But it doesn’t take too long reading the Nim Manual and std lib docs to realize that a big focus is putting a power tool into the hands of developers who already understand the ins and outs of systems programming.
This is all, of course, my personal take on it, other Nim users may disagree.
zig and rust are the real c replacement
At least one developer is calling more optimized Nim from Rust.. https://forum.nim-lang.org/t/10532
[2] https://github.com/exercism/configlet
[3] https://github.com/exercism/configlet/commit/68f130a543757ab...
its not technically explicit, but its implied
Choices like this could alienate a large number of potential Nim programmers, and make me question the tone and nature of the community.
> it's more telling about you than anyone else
I'll reflect this back to you and your statement. Making such statements says quite a bit about how you see and treat people
I'd also note that I did write I didn't see it the first time, and only saw it after another commenter pointed it out. (https://news.ycombinator.com/item?id=38544483)
part 2 addresses the personalization of the accusation
But I also don't care, it doesn't bother me at all.
What I suspect is you haven't looked at a picture of the actual book cover and therefore haven't realised that it looks rather different in action.
and it is usually how those visual illusions are used, if you see this than you are that, but if you see the other thing you are normal
its a bad image, it is a visual illusion, are they aware of it or not this is the question
"this is not an explicit image of looking up a woman's body, but it is implied"
I take issue with the but part, which "implies" it was intentional. I'm not in a place to judge that, but I can definitely see the "implied" imagery
... if we can further mix the connotations of the words from the comment we are talking about, without increasing confusion...
how intentional I will let the crowd decide
Hilarity ensues.
They aren't synonyms; “implied explicit” is an oxymoron, “implied female nude” is not. (Thouugh really, “suggestive of” or “evocative of” is probably more accurate than “implied” here, too.)
ex·plic·it
/ikˈsplisət/
* stated clearly and in detail, leaving no room for confusion or doubt.
* (of a person) stating something in a clear and detailed way.
* describing or representing sexual activity in a graphic fashion.
[0] which is more of a problem with your choice of authority, because most dictionaries wouldn't limit the relevant definition this way.
In common usage, an "explicit image" implies the third definition. It's not explicit as opposed to blurry or abstract, it's explicit as opposed to non-sexual. Since the context was discussion of the contents of an image, the word "image" was implied.
Ode to my most beautiful Goddess Nim.
My beloved goddess, I wish to roam around your lush forests and valleys, and scale the peaks of programming ecstasy with you my most beautiful goddess.
I yearn to plough the depths of your fertility, planting my seeds into your fertile soil, and watch the seedlings sprout and grow into great giant oaks of Mandelbrot complexity and beauty.
I want to bathe in your flowing rivers of ectasy, raise my face to the sky and feel the spray of your golden showers on my face, drink your golden ambrosia and feel the wisdom of your inspiration flow through my veins into my fingers, weaving skeins of golden code that induce envy in the greatest weavers of code.
Oh beloved Goddess Nim, my programming muse.
Bruh!!
.....
I ought to stop here before I cause a global crisis of PEKBACs among diehard Nim programmers.
TBH, I didn't see it at first, but those beautiful mountain peaks and valleys have converted me into a diehard Nim programmer.
PS. Should I post this on the Nim Slacks, Reddits, Matrixes et al?
EDIT: For example, say you want Python's Walrus operator. You can just do this (although you can often just use a slightly more verbose parenthesized `let` expression):
proc `:=`*[T](x: var T, y: T): T = (x = y; x)
or maybe you want `myvar |= flag` like in C/Python. You can also do that: proc `|=`*[T, U](a: var T, b: U) = (a = a or b)
But both of those could also be templates or macros that get the whole AST, can pick the AST apart, and emit whatever Nim code you actually want.In fact, since Nim has nicely nested scopes & hygienic templates, you can define a bunch of operators in a library `template`, called say `unsafePtrArith` for pointer arithmetic, import that and then make them available in a little sub-scope to your code like:
unsafePtrArith: a += 5
or unsafePtrArith:
b += 4
c += 3In my experience, Nim macros (but not templates) can succumb to verbosity in their implementations because manipulation of the AST is generally imperative and can become quite involved in the details of syntax nodes.
Other than that, with the expressiveness of type definitions in Nim, my experience has been that routines often end up short and dry. Learning to wield helpers such as {.push.} and {.pop.} can be helpful in that regard, just depends on what you’re doing.
Cush was the father of Nimrod, who became a mighty warrior on the earth. He was a mighty hunter before the Lord; that is why it is said, “Like Nimrod, a mighty hunter before the Lord.” The first centers of his kingdom were Babylon, Uruk, Akkad and Kalneh, in Shinar. From that land he went to Assyria, where he built Nineveh, Rehoboth Ir, Calah and Resen, which is between Nineveh and Calah – which is the great city.
— Genesis 10:8-12
> Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.
I've seen plenty such projects omitting this on their homepage, but it seems odd to expect it of every deeplink.
It's effectively free to distribute after all
For a language developer to charge for a book about that language, I think that's a completely valid way to make some money off of their work.
Even the Rust book, "The Rust Programming Language" is available freely online [0], but also as a print and ebook for sale via NoStarchPress [1].
[0] https://doc.rust-lang.org/book/
[1] https://nostarch.com/rust-programming-language-2nd-edition
I'd prefer a GitHub repo with examples over this. At least that can be easily updated
EDIT: In particular, the "Nim for X Programmers" pages seem popular.
I'll check this out this weekend.