Re: Crash with libsoundio

2019-08-08 Thread flattened
I ended up using sdl2 and it seems to be working fine for my purposes

Re: Crash with libsoundio

2019-08-08 Thread treeform
I don't know what is going on with your library and libsound.io. I have done some sound programming in nim here: * [https://github.com/treeform/openal](https://github.com/treeform/openal) * [https://github.com/treeform/euphony](https://github.com/treeform/euphony)

Re: How to add a symbol to represent the infinity (∞)

2019-08-08 Thread LeuGim
For something "more infinite" try [JustForFun](https://github.com/Leu-Gim/Nim-modules/blob/master/justforfun.nim). Your examples should work with that as expected, and even in an infinite amount of time. BiggestInt seems not so much fun - will print just some looong finite number.

Crash with libsoundio

2019-08-08 Thread flattened
I've been trying to write a simple program to play a sine wave for specific duration. I tried to use [http://libsound.io](http://libsound.io) and a Nim wrapper for it: [https://github.com/ul/soundio](https://github.com/ul/soundio). I wrote the program in C first, which can be found here: [https

Re: What text editor are you using for Nim?

2019-08-08 Thread monetus
Since only one person mentioned it, I thought I should give a plus one to howl. I've been coding on my raspberry pi a lot lately, and it is perfect for that. [https://howl.io](https://howl.io)/

Re: How to add a symbol to represent the infinity (∞)

2019-08-08 Thread mrhdias
Thanks @leorize it's so easy! and work :-) const ∞ = high(BiggestInt) echo ∞ for number in -∞ .. ∞: echo number Run

Re: What text editor are you using for Nim?

2019-08-08 Thread Neil_H
Wasn't Vim the name of some detergent at one time? My Emacs takes about 20 seconds to start up but when it does, its amazing. better than detergent anyway ;-) Hehehe

Re: Error when using foldl on BigInts

2019-08-08 Thread leorize
It could be a bug in `bigints`. My stacktrace was: test.nim(24)test nim/pure/collections/sequtils.nim(727) product nimble/pkgs/bigints-0.4.3/bigints.nim(395) multiplication Run

Re: How to add a symbol to represent the infinity (∞)

2019-08-08 Thread leorize
Have fun const ∞ = high(BiggestInt) echo ∞ Run

Re: Using a generic type in 'raises' pragma's argument

2019-08-08 Thread leorize
>From what I understood, the `E` inside the pragma is not instantiated. Not >sure if it's a bug or intentional design. For now just drop the `{.raises.}` annotation, the compiler can compute this on its own.

Re: Default implementation of generic proc

2019-08-08 Thread vitreo12
I just realized that this syntax seems to compile, even if it doesn't work: proc returnZero[T = float]() : T = return T(0) Run Will this syntax work in the future? I think it is quite neat in its separation between types and values, opposed to the typedesc impl

Using a generic type in 'raises' pragma's argument

2019-08-08 Thread thenjip
Hello everyone, I am trying to wrap the `raise` operator in a procedure like so: proc raiseException* [E: CatchableError](e: ref E; R: typedesc): R {.raises: [E].} = raise e when isMainModule: try: newException(IOError, "").raiseException(void) ex

Re: Default implementation of generic proc

2019-08-08 Thread vitreo12
To be honest, I don't particularly like the idea of a different proc name for a default state, especially if the code will be reused by others.

Re: Error when using foldl on BigInts

2019-08-08 Thread roel
yeah, something is broken :(

Re: How to add a symbol to represent the infinity (∞)

2019-08-08 Thread cblake
I assume you realize that your second example will not get to "Year Zero" since it sure looks like you are requesting an infinite number of B.C. years? Not sure you want to build an entire lazy evaluation system and symbology like Perl6..It's easy to do an infinite iterator by just doing your ow

How to add a symbol to represent the infinity (∞)

2019-08-08 Thread mrhdias
The Perl 6 language has a symbol to represent infinity (∞). Anyone have any ideas on how I can implement it in nim? Just for fun! Use cases: import math import strformat proc is_prime(n: int64): bool = for i in 2 .. n-1: if (n mod i) == 0:

Return a table from a macro: "Error the field 'data' is not accessible'

2019-08-08 Thread zevv
I'm trying to return a Table from a macro using "quote do", but the generated AST contains fields that are no accesible outside the tables module /tmp/t.nim(8, 3) Error: the field 'data' is not accessible. Run import macros import tables macro

Re: What text editor are you using for Nim?

2019-08-08 Thread cblake
I should perhaps also have mentioned that if emacs' garbage collection behavior was the real pause-time culprit for @amalek then that may not be any better with a JIT since the problem may be about memory loads more expensive than interpreter CPU cycles. [https://cse.buffalo.edu/~mhertz/bc-pldi

Re: Default implementation of generic proc

2019-08-08 Thread kaushalmodi
Dumb question.. wouldn't it then make sense to define your "default type proc"? proc returnZero[T]() : T = return T(0) proc returnZeroDefault() : float = return returnZero[float]() echo returnZeroDefault() echo returnZero[int]() Run [ht

Re: Default implementation of generic proc

2019-08-08 Thread vitreo12
Thanks for the answer. The system.default() is a nice option, but the code I proposed was only a minimal example, in my real case I don't need to return a zero. Regarding the option you proposed, I only have the problem that I would still like to maintain the let val = returnZero[

Re: Default implementation of generic proc

2019-08-08 Thread leorize
Try this: proc returnZero(T: typedesc = typedesc[float64]): T = T(0) discard returnZero(int) discard returnZero() Run Although you might want to use `system.default[T]()` instead

Default implementation of generic proc

2019-08-08 Thread vitreo12
Hello everyone, I have a function that looks like this: proc returnZero[T]() : T = return T(0) Run and I would like to provide a default implementation that doesn't not require to call the T type, defaulting it to float64. The call would look like:

英国成绩abcd办理约克大学degree毕业证文凭办理英国成绩单威信Q729926040

2019-08-08 Thread huouuohou02
咨询专业顾问Ray【QQ/微信729926040】宏洋国外文凭制作中心代办国外文凭证件,快速办理海外学历认证等证件,专业从事海外留学人员制作国外证件:国外毕业证,外国文凭、外国学历、国外学历学位认证、留学文凭,留学人员回国证明、国外大学成绩单、国外大学学历公证书、大使馆公证书等各国学历学位认证的业务,在各大留学服务机构及国外同行的鼎力支持下,搜集了几百所世界各地大学的文凭及范本,其中美国、英国,澳大利亚,加拿大,德国,法国,新加坡,新西兰,日本,韩国,香港,澳门,台湾等国家和地区的大学毕业文凭我们制作得最多,涉及从普通的专科毕业证至本科学士学位证书、硕士学士学位证书、博士研究生学历学位等各种

英国成绩abcd办理约克大学degree毕业证文凭办理英国成绩单

2019-08-08 Thread huouuohou02
英国成绩abcd办理约克大学degree毕业证文凭办理英国成绩单威信Q729926040英国成绩abcd办理约克大学degree毕业证文凭办理英国成绩单威信Q729926040