Can I haz splat operator

2022-01-11 Thread bg
It's not hard to roll your own (which I know many have done). eg:

Can I haz splat operator

2022-01-11 Thread adigitoleo
Just learned about `tupleLen` from `std/typetraits` which could make things a bit less clunky at the cost of a manual loop. However, I'm a bit tired so I can't work out how to fix this: import typetraits var t = (1, 2, 3) var a:array[tupleLen(t), int] for i in 0..tu

Can I haz splat operator

2022-01-11 Thread adigitoleo
Yes, I noticed that it is only for tuples :( This is unfortunate. Performance considerations aside, concise unpacking seems like a very convenient thing to have. Maybe I'm still holding too tightly to my dynamic typing ways, but in Julia/Python I enjoy using small namedtuples and unpacking them

Can I haz splat operator

2022-01-11 Thread SolitudeSF
i would advise using standalone version since fusion version isn't maintained and fusion itself is code graveyard.

Can I haz splat operator

2022-01-11 Thread Hlaaftana
There is a [module in fusion for pattern matching](https://nim-lang.github.io/fusion/src/fusion/matching.html). There have been efforts to move this to the standard library but it seems like the goal has been changed to have an implementation in the language itself as shown in the [roadmap](htt

Can I haz splat operator

2022-01-10 Thread xigoi
How would you even imagine that to work in a statically typed language?

Can I haz splat operator

2022-01-10 Thread juancarlospaco
https://github.com/Yardanico/nimpylib/blob/master/src/pylib/unpack.nim#L74

Can I haz splat operator

2022-01-10 Thread adigitoleo
Unless I've missed it, it seems like nim doesn't offer a "splat" operator for unpacking (some) collections. In Python, they use asterisks, see [PEP448](https://www.python.org/dev/peps/pep-0448/). In Julia, there is a [ellipsis operator](https://docs.julialang.org/en/v1/manual/faq/#The-two-uses-