Kernel Matrix Calculation in Nim

2020-11-11 Thread dataPulverizer
Thank you very much for your suggestions, they were useful. My amendments, comments or otherwise: > "Consider a naive implementation of a .* operator to add two sequences > together:" -> to multiply two sequences This is correction is already done - maybe refresh your browser. I usually refres

Kernel Matrix Calculation in Nim

2020-11-11 Thread dataPulverizer
> No seqs are not reference types, they copy on assignment. If you need ref > semantics you would use ref seq[T]. When I first wrote that both arrays and sequences were value types in Nim I was fairly sure but then I haven't written Nim in a little while and, to be fair when I made the wrong am

Kernel Matrix Calculation in Nim

2020-11-11 Thread dataPulverizer
> You mean "compute the dot product"? That seems to be what that operation > actually does in the example beneath it. Thanks for spotting the mistake, not the dot product but just a simple element by element multiplication . It shows you can easily create operator similar to that in Julia's ele

Kernel Matrix Calculation in Nim

2020-11-10 Thread dataPulverizer
> Both arrays and sequences in Nim are value rather than reference types. > > This is not true, sequences are reference types, id suggest you to: > > 1st. Correct this. Corrected. Thanks > 2nd. Use an array instead of a seq, something like this maybe: ... Using sequences serves two purposes, i

Kernel Matrix Calculation in Nim

2020-11-10 Thread dataPulverizer
Thanks for letting me know. I've updated the link now.

Kernel Matrix Calculation in Nim

2020-11-10 Thread dataPulverizer
Hi All, I just finished a breif article on programming in Nim demonstrating it using Kernel Matrix calculations (. It's live, but I wanted to get the opinion of the Nim community on its fairness and accuracy. I will chan

Issue with compile time evaluation

2020-11-09 Thread dataPulverizer
Many thanks!

Issue with compile time evaluation

2020-11-09 Thread dataPulverizer
I am trying to get the following code to compile proc square[T](data: T): T = return data*data; proc cube[T](data: T): T = return data*data*data template isValid[T](fun: proc (data: T): T {.closure.}): bool = (fun == cube[T]) or (fun == square[T])