Comments and criticism,please: Nimplementation of Church Numerals

2021-03-04 Thread bpr
I think there's a simpler solution, with no templates or macros. My Nim is rusty, but something like this: import sugar type Fn[T] = T -> T type ChurchNum[T] = Fn[T] -> Fn[T] proc zero[T](f: Fn[T]): Fn[T] = return proc(x: T): T = x proc succ[T](c:

How to have the generated executables in a bin directory out of the way when using testament

2021-03-04 Thread timothee
* somewhat related: [`nimble test`, `nimble build` etc should build all artifacts under `./build` · Issue #787 · nim-lang/nimble](https://github.com/nim-lang/nimble/issues/787) * IMO the least hacky, most useful way is to support: `testament --outdir:dir`

How to detect a hard link in Nim?

2021-03-04 Thread timothee
> since my dups example has way more going on than necessary for just this and > is not standalone, here is how one might do a "print sets of referrers" style > query that indeed clarifies your initial link cligen/examples/dups.nim > Exercise for would be user is to extend to os.walkDirRec or e

Full-time Nim developer rates for new software company

2021-03-04 Thread moigagoo
I think it very much depends on the kind of work you need done. Nim suits many domains, some harder than the others. A web developer is probably going to cost less than a low level cryptography library developer. To learn the rates, I’d check those specific domains rather than languages. At the

Full-time Nim developer rates for new software company

2021-03-04 Thread JohnAD
Congrats on starting up a company! Becoming an Entrepreneur can be quite and adventure; and as a bonus you will learn, the hard way sometimes, how to eat stress for breakfast. As to going rates for a Nim developer, I don't think there are enough to give that an industry value. I'd put it into t

Show Nim: Puppy - Easy HTTP(S) requests without DLLs, --d:ssl or cacerts.pem.

2021-03-04 Thread treeform
I don't think it will support `async` because it uses the OS apis directly. It's a much harder problem then. I don't have plans for it, but patches welcome.

How to have the generated executables in a bin directory out of the way when using testament

2021-03-04 Thread Araq
As far as I know, that's currently impossible. PRs welcome.

Show Nim: Puppy - Easy HTTP(S) requests without DLLs, --d:ssl or cacerts.pem.

2021-03-04 Thread benob
This is really cool, I'll try it. Any plan for async?

template - Error: in expression 'p.some(n)': identifier expected, but found 'some(n)'

2021-03-04 Thread Araq
It's a common gotcha but it's also hardly fixable, using templates to abstract over field names is an important capability. In your case you can simply use an inline proc though. Also, use the object constructor syntax instead of this mess of assignments -- esp under Orc object constructors gene

Show Nim: Puppy - Easy HTTP(S) requests without DLLs, --d:ssl or cacerts.pem.

2021-03-04 Thread treeform
Hey, @guzba and I work on Windows so the recent Nim update kind of gave us some trouble by breaking how we use SSL. We also don't really love having to remember `-d:ssl` all the time, so we've made a new simple HTTP(S) lib for making requests. We've called it Puppy because it plays fetch with w

array, seq : is there something in between?

2021-03-04 Thread ynfle
Or Areq

template - Error: in expression 'p.some(n)': identifier expected, but found 'some(n)'

2021-03-04 Thread mantielero
@mratsim well spotted. I was becoming crazy!

array, seq : is there something in between?

2021-03-04 Thread pietroppeter
If we end up with a new container between an array and a seq I think we should call it an `arreq`. ...🥶🤣

template - Error: in expression 'p.some(n)': identifier expected, but found 'some(n)'

2021-03-04 Thread mratsim
This is with template substitution this line p.derivative = derivative Run becomes p.0.uint.some = 0.uint.some Run Don't name your template parameter the same as an object field.

template - Error: in expression 'p.some(n)': identifier expected, but found 'some(n)'

2021-03-04 Thread ynfle
What is the surrounding context besides `import options`

template - Error: in expression 'p.some(n)': identifier expected, but found 'some(n)'

2021-03-04 Thread mantielero
I have a template like: template register*( val: float; caus:Option[Causality] = none(Causality); #cLocal; varia:Option[Variability] = none(Variability); #vContinuous; ini:Option[Initial] = none(Initial); #iUnse

Comments and criticism,please: Nimplementation of Church Numerals

2021-03-04 Thread shirleyquirk
Y combinator thanks to Ruby: and Haskell: import sugar type Fn[T] = (T)->T func Y[T](X: (Fn[T])->Fn[T]): Fn[T] = template lift(f): untyped = cast[ptr Fn[Fn[T]]](f

array, seq : is there something in between?

2021-03-04 Thread HJarausch
Many thanks Charles for the pointers to _vla_ and _stew_. I'll probably try to build my first _C-wrapper_.

array, seq : is there something in between?

2021-03-04 Thread HJarausch
Many thanks Mamy! I agree that the logic of **FlowVar** looks difficult and isn't user friendly. IMHO, simple (but powerful) multi-threading would be a killer feature of Nim. So, I'd like to ask the Delphic Oracle what the future of multi threading will be in Nim. I'll definitely try _Weave_ an

array, seq : is there something in between?

2021-03-04 Thread cblake
Also, the nimbleverse has [vla](https://github.com/bpr/vla). It's pushing 4 years old and looks under-tested, but it might help @HJarausch as a starting point. If no one points out a more up-to-date thing, I would encourage @HJarausch to do their own though, maybe call it `StackArray` or `Array

array, seq : is there something in between?

2021-03-04 Thread mratsim
In general I strongly discourage using the `parallel` construct. I tried to look into what went inside before writing Weave to check if something was usable. I didn't really understand what was going on, in particular in terms of checks and rules for Flowvar lifting. Anyway here is the fixed co

array, seq : is there something in between?

2021-03-04 Thread HJarausch
Thanks, I'll have a look at wrapping `alloca`, but I am pessimistic: The problem arose when I tried to return a _seq_ within a parallel for loop. I fear (currently) a **parallel for loop** doesn't work with custom types. Here is a slightly modified version of an example given by _ynfle_ which fa

array, seq : is there something in between?

2021-03-04 Thread cblake
Sounds like you should wrap the C alloca interfaces and do your own container either like `UncheckedArray[T]` or like `seq[T]`. There is nothing fundamentally wrong with growing your stack big on many machines these days, but deployment can be tricky. Limits are often still set up with 1990s er

SQLite getRow data changing

2021-03-04 Thread Neodim
great, will try it!

Restrictions in a parallel for loop?

2021-03-04 Thread ynfle
The weird part is that if `Coeff` is `seq[float]` then `FlowVar[Coeff]` is valid. But if `Coeff` is an object that contains a `seq[float]` then `FlowVar[Coeff]` doesn't work.

array, seq : is there something in between?

2021-03-04 Thread xigoi
Variable Length Array is the official term for this.

array, seq : is there something in between?

2021-03-04 Thread HJarausch
@Araq Unfortunately a **seq** variable doesn't play well in **parallel** section.

array, seq : is there something in between?

2021-03-04 Thread HJarausch
@mratsim For me the C++ example is not a variable length array since it cannot change size of the declaration. Why should it blow up the stack? On a 64bit machine the stack segment can be really large and it can grow. I have definitely used objects of several megabytes on the stack. And each re

Comments and criticism,please: Nimplementation of Church Numerals

2021-03-04 Thread WilliamTi
right. I enjoyed playing Go and your information was really helpful to me. thanks you[.](https://forum.nim-lang.org/forum.nim-lang.org)

SQLite getRow data changing

2021-03-04 Thread teroz
If I can plug [SQLiteral](https://github.com/olliNiinivaara/SQLiteral) which does this for you and more and is actively being developed

array, seq : is there something in between?

2021-03-04 Thread Araq
Use a `seq` and don't call `add` on it. Or roll your own custom container.

array, seq : is there something in between?

2021-03-04 Thread mratsim
Use `let`. What you are trying to do in C++ is a VLA (variable-length array), and has many restrictions besides the possibility to blow up your stack if you try to allocate more than a couple hundreds of bytes.

array, seq : is there something in between?

2021-03-04 Thread HJarausch
The use of an **array** is very restricted since its length has to be known at compile time. On the other hand, the flexibility of a **seq** which can change its length during its lifetime and which can even be reallocated at lifetime, is not necessary in many cases. Many applications read the

SQLite getRow data changing

2021-03-04 Thread Clonk
I made a PR a while back that has been merged into develop (but not yet released) with an example of how to deal with binary data with the `db_sqlite`. If you read the bvleeding edge doc there is a nice example :