Re: Nim newbie request/challenge

2017-09-04 Thread jzakiya
Hey thanks. I'll try to play around with the settings to get your code to compile when I get some time. On my System76 Gazelle laptop, with I7-6700HQ, 2.6-3.5GHz, 16GB ram, running in a VB VM for Manjaro KDE, using Nim 0.17.0 compiled with: **$ nim c --cc:clang --d:release ssozp5.nim** I get

Re: Compositional inheritance voodo

2017-09-04 Thread jacmoe
So, what I basically want to know is if what I wrote is valid and sound Nim code. It seems to work, though.

Re: Compositional inheritance voodo

2017-09-04 Thread jacmoe
Thanks! I searched for 'concept' but it failed me - I even looked at the section you linked to, but managed to overlook the (prominent) section on concepts ;p Yes, even though I am a programmer - and thus prone to overthinking - I guess I'd get the basics down before moving on to unchartered te

Re: Compositional inheritance voodo

2017-09-04 Thread bpr
> I guess I can't find them because they are unstable, right? They're in the [language manual](https://nim-lang.org/docs/manual.html#generics-type-classes), right after `type classes`, as they used to be known as "user defined type classes". Beware that some [parts](https://nim-lang.org/docs/m

Re: Compositional inheritance voodo

2017-09-04 Thread jacmoe
> Generally Nim's docs = [..] concise and legible. Exactly. And one of the main reasons why I have decided to prefer Nim

Re: Nim newbie request/challenge

2017-09-04 Thread mratsim
You probably need to specify a path while importing. For example, running from ./bin "prime_bench.nim" file: from ../src/lib/lib_euler_primes import primeSieve from os import commandLineParams from strutils import parseUInt let arguments = commandLineParams()

Re: Compositional inheritance voodo

2017-09-04 Thread LeuGim
Generally Nim's docs = Nim's manual, and generally to find an answer in it takes seconds, it's concise and legible.

Re: Nim newbie request/challenge

2017-09-04 Thread jzakiya
I tried the run your code but the compiler doesn't see the euler libraries. eulerprimes.nim(24, 6) Error: cannot open 'lib_euler_math' How do I get all the libraries to get it to run? I'd be interested in benchmark times. Can you post your hardware specs and the times for coun

Re: Compositional inheritance voodo

2017-09-04 Thread jacmoe
Any good docs on concepts in Nim ? I failed to find it in the tutorial - perhaps I should browse the manual as well ?

Re: Compositional inheritance voodo

2017-09-04 Thread Tiberium
You can also try concepts

Compositional inheritance voodo

2017-09-04 Thread jacmoe
I am very new to Nim, and am trying to port the libtcod tutorial written in Python - here: [Complete Roguelike Tutorial, using python+libtcod](http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod) \- to Nim. For the most part, it is smooth sailing, but n

Re: Bug with generic methods?

2017-09-04 Thread LeuGim
> Please note the biggest problem of inheritance-based interfaces: you cannot > add one to a type already in existence when you define the interface Certainly you cannot; that is the point - not interfaces state, what types satisfy (implement) them, but the other way round, types state, what the

Re: Bug with generic methods?

2017-09-04 Thread LeuGim
> two interfaces or concepts requiring a routine of the same name and arguments > either have to share it type A = concept x p x B = concept x q x C = distinct int D = distinct int proc p(v: C) = discard proc q(v: D) = discard proc

Re: Audio/Video File Read/Write Support In NIM

2017-09-04 Thread jacmoe
This is an odd request Yes, there are languages that _has support for audio read/write_ \- but the point is that those languages has that support by means of packages/libraries - that kind of functionality is never in the core language. So, if Nim doesn't have it, I guess it's because Nim user

Re: Should/can we get explicit concepts?

2017-09-04 Thread Udiknedormin
I see. Good to know I'm not the only one who would write it this way. I had had some break from Nim language and I was pretty excited to use heap-allocated containers in compile-time contexts, especially for moving data between compile-time and runtime. Sadly, I found these features quite faulty

Re: Should/can we get explicit concepts?

2017-09-04 Thread LeuGim
I tried use NimNode for that sketch initially. ׃) [https://github.com/nim-lang/Nim/issues/6313](https://github.com/nim-lang/Nim/issues/6313)

Re: Should/can we get explicit concepts?

2017-09-04 Thread Udiknedormin
@LeuGim It seems to me you made a type factory, actually. That's not something I would like to see, actually. Especially considering the fact I can't add concepts to types already in existence which is, by far, the greatest advantage of concepts over inheritance/interfaces. I tried something li

Re: Convert tuple into a Object

2017-09-04 Thread Udiknedormin
@Araq What Nim version? It fails with "object constructor needs an object type" on my fresh-downloaded Nim 1.17.0... By the way, it is counter-intuitive, I guess. It wouldn't be so if the syntax was available for any type, e.g. arrays. It's a bit misleading as casts can look a bit similar to co

Re: Audio/Video File Read/Write Support In NIM

2017-09-04 Thread mratsim
I did a lot of video processing in the past. What you want is a frameserver like [Avisynth](http://avisynth.nl/index.php/First_script) (Windows-only, multithreading an afterthought, custom scripting language) or [Vapoursynth](http://www.vapoursynth.com/doc/gettingstarted.html#example-script) (

Re: Nim newbie request/challenge

2017-09-04 Thread mratsim
Hey, welcome to Nim, If you like learning with mathematical challenges, I started Nim and many other languages with Project Euler, which gives you small mathematical challenges for your programming languages craving. [https://projecteuler.net](https://projecteuler.net)/ Here are my [solutions

Re: Bug with generic methods?

2017-09-04 Thread Udiknedormin
Well, for me the BEST "interfaces" would be explicit, namespaced concepts, actually (hello, Rust!). Please note the biggest problem of inheritance-based interfaces: you cannot add one to a type already in existence when you define the interface. Also, both interfaces and Nim's concepts are, let'

Re: Any future for true associative arrays?

2017-09-04 Thread stbalbach
Excellent, thanks. That's all I need is a variable for the key. I'd never looked into tables.

Re: Introduction

2017-09-04 Thread jacmoe
Hi Nim'ers I was introduced to Pascal in 1986 in high school, and it was my first language, not counting the very few lines of Commodore Basic I had under my programming belt before that. Then, a long pause, and I got into programming again in 1997. This time Visual Basic, very quickly follow