Templates and generics

2022-02-17 Thread tanguymario
Hello, I do not understand why the template in the following code fails and its error message: > template/generic instantiation of `matrix22` from here Error: type expected, > but got: 2 I am trying to create some utils functions for creating a matrix. Could someone help me ? ty

Can Nim be made more "purely functional""...

2022-02-17 Thread mardiyah
Some believe "FP is better and only myths and misconceptions keep it from becoming more mainstream" whereas I think that FP itself is a big misconception -- it ignores the reality of what computers are used for and what you need to do when you "program". How come it's exactly on my mind ?

Nim devroom at FOSDEM this weekend

2022-02-17 Thread pietroppeter
Videos need to wait for a review by author but more likely the problem is that there when there are issues for a video they have to intervene and they have very little manpower. Anyway very happy to see that “HPC from Python to Nim” finally is released! this is the one video we had issues while

Macro fails with `got: but expected `

2022-02-17 Thread Hlaaftana
It works if you use `copy` too. import macros type MyModel[T] = object discard macro network*(): untyped = let underlyingTypeSymbol = genSym(nskGenericParam, "WHAT") var params = @[ newNimNode(nnkBracketExpr).add(

Macro fails with `got: but expected `

2022-02-17 Thread tsojtsoj
Yes, this is what I chose to use as a workaround. Because in my real program the ident"S" is instead a generated unique symbol, I need to basically create a new ident by converting the generated symbol to a string literal and then using that as ident strVal.

Macro fails with `got: but expected `

2022-02-17 Thread Hlaaftana
If you don't reuse the `ident` node and recreate it every time it works.

Can Nim be made more "purely functional""...

2022-02-17 Thread Araq
Sorry, but it feels like you started this thread with an idea like "FP is better and only myths and misconceptions keep it from becoming more mainstream" whereas I think that FP itself is a big misconception -- it ignores the reality of what computers are used for and what you need to do when yo

Can Nim be made more "purely functional""...

2022-02-17 Thread ElegantBeef
> Although such data structures could be added to Nim, most of the standard > library would still use seq s and mutable hashes, so persistent data > structures would always be "second-class citizens." In my view another case for encouraging usage of concepts, or having the ability to import typ

Can Nim be made more "purely functional""...

2022-02-17 Thread Araq
I don't think that "FP is slow" I think "FP is inconvenient", for example program this in a pure FP language with tail recursion (!) for the `for` statement and see if you like the result better: proc traverseDir(dir: string) = for kind, name in walkDir(dir): if kind =

Can Nim be made more "purely functional""...

2022-02-17 Thread spip
> Build a new language that uses Nim as a back end, using the functional code > from a language such as Elm to emit Nim code that would be converted to c/C++ > by Nim. As macros are part of Nim language definition, so is Nim AST definition. If it were possible to plug into Nim compiler to provi

Nim devroom at FOSDEM this weekend

2022-02-17 Thread SolitudeSF
week later, still not all videos are uploaded. were some talks cancelled or something?

Macro fails with `got: but expected `

2022-02-17 Thread jyapayne
It might be a bug because this works: import macros type MyModel[T] = object discard macro network*(): untyped = result = quote do: proc init[WHAT](a: MyModel[WHAT]): MyModel[WHAT] = discard network() echo init(M

Can Nim be made more "purely functional""...

2022-02-17 Thread deech
I write Haskell full time and I don't see a reason to make Nim more FP, it's an imperative language with good metaprogramming features and it's best to approach it that way. Persistent data structures are nice but tend to fork a collections library because now you need two versions of all the CR

Can Nim be made more "purely functional""...

2022-02-17 Thread sschwarzer
I've spent by far most of my "programming life" with imperative languages. I learned a bit of Haskell years ago, but didn't stick because of the perceived complexity, but it got me intrigued by FP. About one and a half year ago I switched to [Racket](https://racket-lang.org/) (a Lisp/Scheme var

Can Nim be made more "purely functional""...

2022-02-17 Thread sschwarzer
Thanks for taking the time to write this message! :-) I agree with your opinion that _some_ FP languages make it seem that FP is necessarily complicated, whereas that's not the case. (This is like concluding from Java experience that "statically-typed languages are verbose".) While I appreciate

Macro fails with `got: but expected `

2022-02-17 Thread tsojtsoj
The following macro fails, and I don't understand why. [here on the Nim playground](https://play.nim-lang.org/#ix=3PRf) import macros type MyModel[T] = object discard macro network*(): untyped = let underlyingTypeSymbol = ident"WHAT"

Can Nim be made more "purely functional""...

2022-02-17 Thread kobi
Sorry, but I feel this is a theoretical complaint born from the mind, a perception of what is better, instead of a practical actual issue. There are packages that provide fast functional programming, and changing the Nim front end means changing the language and style that many here enjoy. Funct

Can Nim be made more "purely functional""...

2022-02-17 Thread GordonBGood
This question of making Nim more functional seems to come up from time to time, so I thought it might be useful to summarize "the state of Nim as to being a functional language", at least as I see it... **History** Nim's background story would seem to in no way include any back trace to what h

Nim 1.6.4 released

2022-02-17 Thread Araq
No. If you tell me how to do that, I might consider it though...

Need to move all Nim required compilation stuffs to ram disk

2022-02-17 Thread cblake
The Nim compiler will also honor `XDG_CACHE_HOME` on Unix-like systems like MacOS/Linux. Note that you can also set the CL switch in your nim config files and that the command-line switch PMunch mentions overrides that environment variable setting.

Need to move all Nim required compilation stuffs to ram disk

2022-02-17 Thread PMunch
Assuming you already have a RAM disk set up in `/tmp` (e.g. mounted as tempfs) you can simply do `--nimcache:/tmp/myproject` to put all the compiled files into there (but leave the binary in the folder where you ran the command).