How to ensure that all attributes of an object are explicitly set during creation?

2020-07-30 Thread gemath
That's a good syntax, but it's already taken for construction and it would conflate construction with initialization, default values and inheritance behavior. For the first two, we now have `Car(..)` and `initCar(..)`. For default values, I would be happy with allowing this: type

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-30 Thread JohnAD
This subject has been discussed many times: a language enforced, but optional, yet inheritable initialization method. Having thought about it for about a year, I wonder if this could be done with a "backtick operator" similar to how op codes and access methods like + and [] are done. Something

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread Pumpus
As Maple user I can say that maxima, simpy, sage and similar atrocities are just toys in compare. Just start the best free multiplatform Nim symbolic environment and the whole world will use it. Believe me! It must have solid bases as Maple: object hierarchy, nops command, op command, possibilit

cross platform symmetric and assymetric cryptography

2020-07-30 Thread moerm
@mratsim > * At this point, any GNU tools should actively be avoided for any > cryptographic purposes. > Yes, absolutely. In fact, if there is any worse clusterf_ck than OpenSSL it's GnuTLS and other Gnu crypto. @snej > * feel that a public API should never use 'ptr’ unless absolutely n

Custom DllMain Windows

2020-07-30 Thread Recruit_main707
This code works import winim/com proc mainThread(hModule: HINSTANCE) = AllocConsole() discard stdout.reopen("CONOUT$", fmWrite) while true: echo "Hello World YEY", hModule proc NimMain() {.cdecl, importc.} proc DllMain(hMo

Custom DllMain Windows

2020-07-30 Thread Recruit_main707
@Shucks ive found out, using nim threads is what causes the issue, try creating the new thread with winim directly

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread hugogranstrom
That's some really interesting use cases :D Yes especially when accuracy is important I can imagine that the analytic solution is more efficient. Complex step diff blew my mind first time I heard about it, it seemed too good to be true :O @cantanima you are bringing a lot of good points to the

Python transpiler

2020-07-30 Thread bobg
Why would you want to go from Nim to Python? Once you have the Nim program, you are home free.

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread cantanima
> I'm not much of a symbolic algebra user myself really (I just got feeling > when I wrote this, really xD) so I'm asking you all what kind of features you > would like to be added for you to consider using this? I need a carrot > (someone else's needs) basically :-D The #1 problem with symboli

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread cblake
Calculus has many applications. ;-) One thing people might be able to use this for is algebraically derived first or second derivatives (or their matrix forms gradients and Jacobians, Hessians). While few statements can be absolute, typically algebraic forms are both faster to evaluate and more

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread hugogranstrom
I couldn't agree more! It's probably quite heavy for the code as well as you have to check all patterns against all levels of the expression. I'm thinking about different ways to create and match patterns without having to write all if/case-statements by hand for everything...

cross platform symmetric and assymetric cryptography

2020-07-30 Thread snej
@federico3, it’s great to have Nim wrappers! I’d like to see higher level APIs, though. In particular, I feel that a public API should never use 'ptr’ unless absolutely necessary ... in this case, ‘array[byte]’ would be a better choice for keys/digests/nonces, and ‘seq[byte]’ for cipher/clear-te

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread jxy
Usually the most complicated and most visible and useful feature is simplification, for example: [https://github.com/calyau/maxima/blob/master/src/simp.lisp](https://github.com/calyau/maxima/blob/master/src/simp.lisp) I guess it entirely depends on what your goal is.

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread hugogranstrom
Yes I've felt the same. Feels like Nim should be the perfect language for these kinds of things if you build a neat DSL around it. Equation solving should be do-able :) For linear equations, we should be able to slap on a Gaussian elimination algorithm and we could probably write a simple diffeq

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread xigoi
Perfect! A symbolic math library is something I feel has been missing from Nim and I don't have enough knowledge to make it myself. I'd definitely appreciate solving of equations and equation systems (at least those which can be easily solved with known algorithms, such as linear or simple diffe

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Serge
Thanks!

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Serge
Thanks!

How to cast a slice of seq[char] to uint?

2020-07-30 Thread digitalcraftsman
Right, I didn't thought about the endianess. Converting betweens little and big endian seems to be a bit overkill for my needs since the size of the processed data is negligible. I just wanted to explore "nice-to-have" optimizations for this case.

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread cblake
This is sort of a first step along the lines I was suggesting: import tables type Strings = object strings*: string str2ix*: Table[string, int32] proc put*(s: var Strings, x: string) = let n = s.strings.len.int32 if s.str2ix.mgetOrP

How to cast a slice of seq[char] to uint?

2020-07-30 Thread lqdev
Sure is. But you have to handle endianness, as x86_64 is a little endian architecture and data returned by nimPNG is stored in big endian order. import strutils let pixels = @[uint8 0, 0, 255, 0, 255, 255, 255, 0, 0] var arrayPixel: array[4, uint8] copyMem(arrayPixel

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread hugogranstrom
Yes, I looked at symengine before I started but I got a bit intimidated by all the dependencies (I'm a Windows guy, don't really know for example how to get the libgmp-dev things installed) so I thought this could be a learning opportunity how symbolic libraries work. And I feel like I've learnt

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread inventormatt
I tend to use symbolic programming every once in a while for robotics and physics purposes. however for that usually we start to deal with matrices and computations with those matrices to generate the forward kinematics. so I guess the two main things I would want to see would be symbolic matric

How to cast a slice of seq[char] to uint?

2020-07-30 Thread digitalcraftsman
Hello everyone, for a little project I'm using [nimPNG](https://github.com/jangko/nimPNG) to manipulate the pixels of a PNG image. Loading a pixel with loadPNG24 makes the pixels accessible as seq[char], where the RGB-triplets are stored consecutively. Now I want to pack an RGB-triplet into an

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread cblake
For what it's worth, that `names` module has pretty large objects for unique names - two 8 byte pointers and an 8 byte refcount as well as the string itself. So, probably 32B*nUnique + string data. Natural language words tend to average around 8B. `names` does use only an array of pointers for h

SymbolicNim, symbolic algebra in Nim

2020-07-30 Thread hugogranstrom
I've started developing [SymbolicNim](https://github.com/HugoGranstrom/symbolicnim/) the past few weeks so it's still just in its youth and lacks a lot of features. Right now it can create symbolic variables and combine them with `+`, `-`, `*`, `/`, `^` as well as `sin`, `cos`, `tan`, `exp` and

cross platform symmetric and assymetric cryptography

2020-07-30 Thread mratsim
At this point, any GNU tools should actively be avoided for any cryptographic purposes. There isn't any crypto-related GNU project that should be used. See: * [https://soatok.blog/2020/07/08/gnu-a-heuristic-for-bad-cryptography](https://soatok.blog/2020/07/08/gnu-a-heuristic-for-bad-cryptogra

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread mratsim
For NLP you might want to look at the Nim-NLP organization: * [https://github.com/Nim-NLP](https://github.com/Nim-NLP) I've also played with CharRNN in Arraymancer though it's very very raw at the moment in terms of usage: * [https://github.com/mratsim/Arraymancer/blob/master/examples/ex

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread cblake
Often "interned string" databases are "append only". I.e., no deletes. If you don't mind 2 copies instead of 1, you can roll your own in like 10 lines of code: import tables type Strings = object ix2str*: seq[string] str2ix*: Table[string, int] pr

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Yardanico
Some good ones: * Nim in Action * [https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)/ * [http://ssalewski.de/nimprogramming.html](http://ssalewski.de/nimprogramming.html) You can see more on [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Serge
I'm planning to do so as soon as I have managed to master Nim well enough. What's slowing me down is the lack of teaching material (which is normal, I guess for a relatively new language) :-)

numpy like library for nim

2020-07-30 Thread cumulonimbus
A quick look at the source code, seems like you are going for a Numpy+Pandas implementations (evidenced by the DataFrame implementation, which closely follows the way Pandas implements it). Just FYI, Wes McKinney, the original Pandas author and main contributor, has written an [article](https:/

Whether or not there is still a thread-local heap when using --gc:arc?

2020-07-30 Thread wt
I see.

Intellij ( PhpStorm, PyCharm, RubyMine, Webstorm, Clion ) platform

2020-07-30 Thread Recruit_main707
I tried to use nim lsp in intellij, but it kept crashing

some questions on generating dynamic library

2020-07-30 Thread Yardanico
It's generally not possible to "export" a variable in a DLL, no matter the language. You need to make a function which will return that variable.

numpy like library for nim

2020-07-30 Thread cumulonimbus
Cool, thanks! Are you aware of [Arraymancer https://mratsim.github.io/Arraymancer/index.html](https://forum.nim-lang.org/postActivity.xml#arraymancer-https-mratsim-github-io-arraymancer-index-html) ? It covers a lot of the same ground, supports GPU and multithreaded computations, and more; Even

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread exelotl
Looks like a promising concept, but keep in mind that this library was written back when nil was a valid value for strings in Nim, so it's probably a little outdated. Seems simple enough that you could quite easily write your own implementation that best suits your project. :)

some questions on generating dynamic library

2020-07-30 Thread oyster
no matter let or var is used, no variable is exported in the DLL. yes, I know nimpy can be used to write PYD, but it has nothing to do with a common DLL.

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Serge
Natural language processing, which implies dealing with large bodies of text, in which case a strategy for "interning" string is a huge memory saver.

Intellij ( PhpStorm, PyCharm, RubyMine, Webstorm, Clion ) platform

2020-07-30 Thread AMoura
There is also QtCreator with the Nim plugin [https://doc.qt.io/qtcreator/creator-project-nimble.html](https://doc.qt.io/qtcreator/creator-project-nimble.html).

Intellij ( PhpStorm, PyCharm, RubyMine, Webstorm, Clion ) platform

2020-07-30 Thread Yardanico
Yes, and it actually supports autocompletion and go to definition via nimsuggest :)

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread michy
NPL? > NPL - What does NPL stand for? The Free > Dictionaryacronyms.thefreedictionary.com › ... >Acronym, Definition. NPL, > National Priorities List (US EPA). NPL, National Physical Laboratory (UK). > NPL, >Nepal (ISO Country code). NPL, Nigeria Premier ... please help

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Yardanico
I think it's a typo for NLP which is Natural Language Processing

String interning (seen on Github) : Is it good? has anybody been using it?

2020-07-30 Thread Serge
I have seen the following module on Github: [https://github.com/pragmagic/names](https://github.com/pragmagic/names) "names" proposes a solution to the problem of "interning" strings (avoiding unnecessary memory allocation for duplicate identical strings when doing NPL, for instance). Has anyb

Whether or not there is still a thread-local heap when using --gc:arc?

2020-07-30 Thread Araq
Ah, good question. One more point to cover in my upcoming ARC article. So when you use `--gc:arc --threads:on` the allocations done for seqs, closures, refs etc are shared. The distinction between `alloc` vs `allocShared` remains. However, `alloc` is mapped to `malloc` when you use `-d:useMalloc

Whether or not there is still a thread-local heap when using --gc:arc?

2020-07-30 Thread wt
The runtime `--gc:arc` says that it offers a shared heap. So, is there still a thread-local heap when using this runtime? When using `--gc:arc`, I found that the memory allocated by `alloc0()` is not reclaimed when the thread exits. Is the memory allocated by `alloc0()` in a shared heap? And th