00:00:01 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:52 | * | wildtrees quit (Quit: Leaving) |
00:01:45 | * | junland joined #nim |
00:25:50 | * | abm quit (Quit: Leaving) |
01:22:04 | * | laaron quit (Remote host closed the connection) |
01:25:40 | * | laaron joined #nim |
01:43:30 | * | laaron quit (Remote host closed the connection) |
01:48:16 | * | laaron joined #nim |
01:49:21 | * | nif_ quit (Quit: ...) |
01:49:32 | * | nif joined #nim |
01:58:04 | * | actuallybatman quit (Ping timeout: 272 seconds) |
02:05:44 | leorize[m] | zedeus: getAst() is your friend |
02:55:18 | * | gangstacat joined #nim |
03:22:48 | FromDiscord_ | <Adam Kowalski> How do you get an equivalent of this in nim? I want to mimic variadic generics from languages like D and C++. |
03:22:48 | FromDiscord_ | <Adam Kowalski> |
03:22:48 | FromDiscord_ | <Adam Kowalski> Here is the example in D |
03:22:48 | FromDiscord_ | <Adam Kowalski> |
03:22:49 | FromDiscord_ | <Adam Kowalski> ``` |
03:22:49 | FromDiscord_ | <Adam Kowalski> struct Tensor(T, Dims...) { |
03:22:49 | FromDiscord_ | <Adam Kowalski> } |
03:22:51 | FromDiscord_ | <Adam Kowalski> |
03:22:52 | FromDiscord_ | <Adam Kowalski> void main() { |
03:22:54 | FromDiscord_ | <Adam Kowalski> const x = Tensor!(int, 3, 5, 7)(); |
03:22:55 | FromDiscord_ | <Adam Kowalski> } |
03:22:56 | FromDiscord_ | <Adam Kowalski> ``` |
03:23:35 | FromDiscord_ | <Adam Kowalski> Here is the the example in C++ |
03:23:35 | FromDiscord_ | <Adam Kowalski> |
03:23:35 | FromDiscord_ | <Adam Kowalski> ``` |
03:23:35 | FromDiscord_ | <Adam Kowalski> template <class T, size_t... Dims> |
03:23:36 | FromDiscord_ | <Adam Kowalski> struct Tensor {}; |
03:23:36 | FromDiscord_ | <Adam Kowalski> |
03:23:36 | FromDiscord_ | <Adam Kowalski> int main() { |
03:23:38 | FromDiscord_ | <Adam Kowalski> auto x = Tensor<int, 3, 5, 7>{}; |
03:23:39 | FromDiscord_ | <Adam Kowalski> } |
03:23:41 | FromDiscord_ | <Adam Kowalski> ``` |
03:23:48 | FromGitter | <awr1> please do not post markdown in here |
03:23:51 | FromGitter | <awr1> use a pastebin |
03:26:27 | FromGitter | <awr1> @Adam Kowalski https://play.nim-lang.org/#ix=1SnU |
03:28:12 | FromDiscord_ | <Adam Kowalski> Thanks! |
03:28:33 | FromDiscord_ | <Adam Kowalski> How about reflection? Can I do things like grab all the fields from a struct |
03:29:26 | FromGitter | <awr1> yes, use `fields()` or `fieldPairs()` iterator |
03:36:21 | FromDiscord_ | <Adam Kowalski> Is that documented anywhere? What other things can we reflect on? |
03:40:27 | FromDiscord_ | <Adam Kowalski> Also with your tensor example can you overload methods on the size of the dimensions? |
03:53:39 | * | chemist69 quit (Ping timeout: 250 seconds) |
03:55:51 | * | chemist69 joined #nim |
03:59:03 | * | Calinou quit (Quit: No Ping reply in 180 seconds.) |
04:00:12 | * | Calinou joined #nim |
04:04:29 | FromGitter | <Riderfighter> Hello everyone, does anyone know how to change the hashpart of the current page using karax? I can't seem to find a good example of how to do this with a proc when I searched in karax. |
04:07:38 | * | laaron quit (Remote host closed the connection) |
04:10:55 | * | laaron joined #nim |
04:24:29 | FromDiscord_ | <Adam Kowalski> @awr1 How would I mimic something like this? https://pastebin.com/wskJtSYJ |
04:24:47 | FromDiscord_ | <Adam Kowalski> That prints |
04:24:47 | FromDiscord_ | <Adam Kowalski> |
04:24:47 | FromDiscord_ | <Adam Kowalski> I match vectors |
04:24:47 | FromDiscord_ | <Adam Kowalski> I match matrices |
04:24:50 | FromDiscord_ | <Adam Kowalski> I match cubes |
04:27:54 | leorize | Riderfighter: I believe you just use JS functions for that |
04:31:06 | * | seni quit (Remote host closed the connection) |
04:32:53 | leorize | @Adam variadic generics is not supported by Nim |
04:33:05 | leorize | there's a RFC for it, but doesn't gain much traction: https://github.com/nim-lang/Nim/issues/1019 |
04:33:54 | leorize | for matrix stuff, you can try @mratsim's arraymancer: https://mratsim.github.io/Arraymancer/index.html |
04:50:25 | * | nsf joined #nim |
05:31:33 | * | dddddd quit (Remote host closed the connection) |
05:43:26 | * | narimiran joined #nim |
05:44:40 | * | Jesin quit (Ping timeout: 268 seconds) |
05:51:09 | * | solitudesf joined #nim |
05:52:09 | FromGitter | <zacharycarter> @awr1: https://magnum.graphics/ |
05:52:43 | * | endragor joined #nim |
05:59:10 | FromDiscord_ | <me2beats> could not load: SDL2.dll - how to solve it? |
05:59:24 | FromGitter | <zacharycarter> put sdl2.dll in the same directory as your executable |
06:00:47 | FromDiscord_ | <me2beats> do I have to download it first? I'm on Windows 7 |
06:01:37 | FromDiscord_ | <me2beats> just trying to run nimx hello world |
06:02:02 | FromGitter | <zacharycarter> well nimx depends on sdl2 I imagine |
06:02:07 | FromGitter | <zacharycarter> so yes you'd need to download it first |
06:10:55 | leorize | @me2beats: https://libsdl.org/download-2.0.php |
06:11:01 | * | terps joined #nim |
06:13:32 | FromDiscord_ | <Shield> yeah you need to copy any dll dependency to the binary folder |
06:19:54 | FromDiscord_ | <me2beats> well I put sdl2.dll in the same directory as my executable and that worked - the app runs. But I can see sdl2.dll in nim bin folder ass well |
06:20:09 | FromDiscord_ | <me2beats> well I put sdl2.dll in the same directory as my executable and that worked - the app runs. But I can see sdl2.dll in nim bin folder as well |
06:21:50 | FromDiscord_ | <me2beats> can my executable file (main.nim) take sld2.dll from that (nim bin) folder? |
06:32:37 | FromGitter | <awr1> that's very strange that sdl2.dll is in the nim bin folder. i wonder what it's for |
06:33:44 | FromGitter | <awr1> in general on win32 you should bundle the dlls in the same folder as the exe |
06:34:18 | FromDiscord_ | <me2beats> I mean that folder where bin, compiler, config, dist are |
06:34:35 | FromDiscord_ | <me2beats> I'm on win 7 64 |
06:34:47 | FromGitter | <awr1> yeah i know what you're talking about |
06:35:03 | FromGitter | <awr1> and by win32 i just mean the windows API in general, not 32-bit specifically |
06:36:09 | FromGitter | <awr1> i don't really know why you would want to link directly to the copy in nim's folder |
06:36:33 | FromGitter | <awr1> for the record this is how DLLs are loaded on win32 |
06:36:34 | FromGitter | <awr1> https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order |
06:37:27 | FromGitter | <awr1> so if you really wanted to, you can use a manifest |
06:37:44 | FromGitter | <awr1> but i don't really see why that's necessary |
06:43:07 | FromGitter | <awr1> @Adam Kowalski https://play.nim-lang.org/#ix=1St4 (for the record, yes, that case should be a compile-time branch) |
06:46:39 | FromDiscord_ | <me2beats> do I understand right that when executing every nim file that requires sdl2.dll I have to have this dll file next to the nim file? Is it normal practice? |
06:47:29 | leorize | that's a normal thing for all windows programs |
06:47:31 | FromGitter | <awr1> that's extremely normal for windows apps. |
06:47:45 | FromGitter | <awr1> if you really really want to just put SDL2.dll in your PATH somewhere |
06:48:10 | FromGitter | <awr1> and pray that it doesn't break anything |
06:49:27 | FromGitter | <awr1> (in spite of this, i still think DLL searching on win32 is implemented in a reasonable way) |
06:50:25 | FromDiscord_ | <Shield> that's dynamic linking for you, always ship the DLL with the exe, maybe the user would have an older version, or an uncompatible one, althought the later is rare for mature libraries |
06:51:28 | FromGitter | <awr1> if you're shipping a game on steam valve has a special version of SDL2 that launched apps automatically link to (somehow) |
06:51:39 | FromGitter | <awr1> maybe some rpath magic |
06:51:44 | FromGitter | <awr1> (for linux) |
06:51:56 | FromGitter | <awr1> i think it is the same on windows though too |
06:53:47 | FromDiscord_ | <me2beats> well ok then) |
06:54:07 | FromDiscord_ | <me2beats> it seems I need some kind of guide on the structure of projects using Nim |
06:54:56 | * | lritter joined #nim |
06:55:00 | FromGitter | <awr1> are you not familiar with developing for windows? |
06:55:27 | FromGitter | <awr1> if you have a unix background, windows dev has its own quirks |
06:56:47 | FromGitter | <awr1> find the location of any installed exe on windows and you'll typically see a bunch of DLLs in the same folder |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:01:33 | FromGitter | <awr1> also @Adam Kowalski https://nim-lang.org/docs/iterators.html#fields.i%2CT |
07:04:57 | * | gmpreussner joined #nim |
07:12:12 | * | narimiran quit (Ping timeout: 272 seconds) |
07:27:06 | * | krux02 joined #nim |
07:41:09 | * | terps quit (Ping timeout: 250 seconds) |
07:49:52 | * | nsf quit (Quit: WeeChat 2.5) |
07:54:02 | * | terps joined #nim |
07:54:14 | Zevv | strutils.normalize notes that i shohuld NOT use that for normalizing Nim identifier names. What should I use then? |
07:54:30 | Araq | eqIdent |
07:59:08 | Zevv | I don't want to compare, I want to normalize so that I can use it as in index in a Table[] |
07:59:17 | Zevv | but not a str<->str table |
08:01:51 | Zevv | oh araq btw, I have files that are imported but dont export any symbols. Is there a way to suppress the "imported but not used" warnings *by the imported module*? |
08:04:00 | * | nc-x joined #nim |
08:04:36 | nc-x | does anybody know how to debug stack corruption on windows? |
08:05:34 | Zevv | compile for linux, run valgrind :( |
08:09:17 | FromGitter | <awr1> which compiler? |
08:09:44 | FromGitter | <awr1> if it's MSVC you can do /GZ |
08:09:54 | nc-x | Zevv: (⊙_⊙;) |
08:10:09 | nc-x | awr1: gcc/clang/msvc on windows |
08:10:15 | FromGitter | <awr1> sry /RTC |
08:10:17 | nc-x | or i might install linux vm now |
08:10:19 | * | terps quit (Ping timeout: 252 seconds) |
08:10:26 | Zevv | haha :) |
08:10:38 | Zevv | valgrind saved my behind *so* many times |
08:10:51 | FromGitter | <awr1> try `when vcc: {.passC: "/RTC".}` |
08:11:30 | FromGitter | <awr1> or actually `when vcc: {.passC: "/RTCs".}` |
08:12:33 | FromGitter | <awr1> supposedly Asan works on windows, i haven't tried it. |
08:15:11 | nc-x | Okay thanks. let me try. |
08:18:22 | nc-x | Well, msvc fails to even compile the code - stdlib_system.nim.c(1492): error C2371: 'genericResetAux__9bFXTAJ8caOL4Ioy2o3B3aw_actual': redefinition; different basic types |
08:19:13 | nc-x | nope. sorry. wrong code i think. |
08:21:59 | FromGitter | <awr1> https://clang.llvm.org/docs/AddressSanitizer.html |
08:25:18 | * | endragor quit (Remote host closed the connection) |
08:30:10 | * | nc-x quit (Remote host closed the connection) |
08:30:23 | * | endragor joined #nim |
08:36:19 | krux02 | not sure how much the addresssanitizer of clang will be useful in Nim since Nim has its own memory allocator |
08:40:21 | FromGitter | <awr1> hmmmmmm you could force malloc |
08:58:22 | * | ehmry quit (Ping timeout: 245 seconds) |
09:00:18 | * | ehmry joined #nim |
09:05:45 | * | endragor_ joined #nim |
09:08:49 | * | endragor quit (Ping timeout: 246 seconds) |
09:12:06 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
09:12:35 | * | laaron joined #nim |
09:19:52 | * | terps joined #nim |
09:20:20 | * | ng0 joined #nim |
09:33:48 | * | nsf joined #nim |
09:50:13 | * | laaron quit (Remote host closed the connection) |
09:54:18 | * | laaron joined #nim |
09:55:17 | * | endragor_ quit (Remote host closed the connection) |
10:05:39 | * | laaron quit (Remote host closed the connection) |
10:08:09 | * | laaron joined #nim |
10:14:30 | * | shomodj joined #nim |
10:16:58 | * | shomodj quit (Client Quit) |
10:27:23 | * | ehmry quit (Quit: leaving) |
10:28:19 | * | ehmry joined #nim |
10:47:53 | * | endragor joined #nim |
10:50:51 | * | nsf quit (Quit: WeeChat 2.5) |
10:59:00 | * | endragor quit (Remote host closed the connection) |
11:02:42 | * | stefanos82 joined #nim |
11:13:35 | * | shomodj joined #nim |
11:13:57 | * | shomodj quit (Client Quit) |
11:19:09 | * | terps quit (Ping timeout: 252 seconds) |
11:20:52 | * | ng0 quit (Remote host closed the connection) |
11:21:56 | * | ng0 joined #nim |
11:26:34 | * | endragor joined #nim |
11:31:22 | * | endragor_ joined #nim |
11:34:54 | * | endragor quit (Ping timeout: 258 seconds) |
12:03:16 | * | abm joined #nim |
12:16:39 | * | vesper11 joined #nim |
12:19:32 | * | endragor_ quit (Remote host closed the connection) |
12:20:28 | * | vesper joined #nim |
12:21:18 | * | vesper11 quit (Ping timeout: 245 seconds) |
12:27:13 | * | terps joined #nim |
12:27:43 | * | laaron quit (Remote host closed the connection) |
12:30:28 | * | laaron joined #nim |
12:44:35 | * | Ven`` joined #nim |
13:16:59 | * | joki1337 joined #nim |
13:18:49 | * | joki1337 quit (Client Quit) |
13:44:04 | * | dddddd joined #nim |
13:46:59 | * | narimiran joined #nim |
13:48:12 | * | leorize_ joined #nim |
13:50:44 | * | leorize quit (Ping timeout: 260 seconds) |
13:57:06 | * | laaron quit (Remote host closed the connection) |
13:58:34 | * | laaron joined #nim |
14:04:13 | * | Ven`` quit (Ping timeout: 245 seconds) |
14:04:41 | * | apeiro joined #nim |
14:05:07 | * | apeiro quit (Client Quit) |
14:16:59 | * | Ven`` joined #nim |
14:53:26 | * | nsf joined #nim |
15:11:15 | shashlick | Why isn't parallelBuild 0 by default |
15:12:50 | shashlick | Looks like it is in nim.cfg but doesn't seem to take effect by default |
15:13:10 | shashlick | --parallel_build: "0" |
15:25:31 | FromGitter | <awr1> 0 is autodetect |
15:25:43 | FromGitter | <awr1> not "false" |
15:28:41 | * | laaron quit (Remote host closed the connection) |
15:30:31 | * | laaron joined #nim |
15:46:22 | * | lritter quit (Ping timeout: 258 seconds) |
16:02:46 | * | laaron quit (Remote host closed the connection) |
16:05:06 | * | laaron joined #nim |
16:15:30 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:17:37 | * | enthus1ast quit (Ping timeout: 276 seconds) |
16:31:24 | * | enthus1ast joined #nim |
16:35:27 | * | xet7 quit (Quit: Leaving) |
16:59:43 | * | terps quit (Ping timeout: 250 seconds) |
17:14:37 | * | solitudesf quit (Ping timeout: 245 seconds) |
17:23:16 | * | solitudesf joined #nim |
17:42:56 | * | terps joined #nim |
17:55:55 | * | NimBot joined #nim |
17:56:07 | * | shomodj joined #nim |
17:58:26 | * | Trustable joined #nim |
17:59:27 | * | terps quit (Ping timeout: 264 seconds) |
17:59:55 | * | ZORR0W joined #nim |
18:00:54 | * | shomodj quit (Client Quit) |
18:08:18 | * | shomodj joined #nim |
18:15:26 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:23:25 | FromDiscord_ | <Adam Kowalski> @Araq is there any way to encode the dimensions of a tensor in the type system? There are no variadic generics, but I've seen people propose using tuples. However, can I then use that to statically at compile time overload a function based on the amount of dimensions or the size of those dimensions? |
18:24:08 | FromDiscord_ | <Adam Kowalski> https://pastebin.com/wskJtSYJ |
18:24:19 | FromDiscord_ | <Adam Kowalski> The nim example I've seen is https://play.nim-lang.org/#ix=1St4 |
18:24:28 | FromDiscord_ | <Adam Kowalski> The problem here is that all the logic is inside of the one function |
18:24:54 | FromDiscord_ | <Adam Kowalski> So i cannot extend the overload set to add on new behavior without modifying the function body |
18:25:26 | FromDiscord_ | <Adam Kowalski> If that function is provided by a library (or any code that you cannot modify as the source is not yours) then you are stuck and cannot extend it. |
18:30:22 | FromDiscord_ | <Adam Kowalski> I want something like this https://play.nim-lang.org/#ix=1SCN |
18:30:56 | Araq | hm |
18:35:32 | Araq | seems to complex for today's compiler. |
18:36:32 | FromDiscord_ | <Adam Kowalski> Are there any plans to enable something like this? This is my main use case for variadic generics |
18:37:04 | FromDiscord_ | <Adam Kowalski> I want to be able to for example take in a list of dimensions at compile time, and then if I say transpose the tensor, produce a new variadic list of dimensions and instantiate a tensor of that type |
18:37:18 | FromDiscord_ | <Adam Kowalski> Or if you reshape a tensor, or add two tensors |
18:37:34 | FromDiscord_ | <Adam Kowalski> Only allow addition of tensors of the same shape and that share a element type that can be added |
18:40:44 | Araq | I would have them shapeless, all the generic instantiations would kill me. But sure, we want to support Tensor properly in the type system |
18:41:47 | FromDiscord_ | <Adam Kowalski> Having a compile time knowable shape is huge in my opinion. It can eliminate a whole class of bugs in the world of machine learning |
18:42:18 | Araq | not sure how @mratsim does it |
18:42:23 | FromDiscord_ | <Adam Kowalski> If there is only a runtime shape, that is our equivalent of a dynamically typed language |
18:42:26 | Araq | hopefully he is around |
18:42:36 | FromDiscord_ | <Adam Kowalski> I've chatted with him in the past |
18:43:27 | * | stefanos82 quit (Quit: Quitting for now...) |
18:43:33 | Araq | well I know the argument and it doesn't convince me. Firstly, every type is always an approximation of the real runtime constraint (think about strings of the pattern [A-B]*) |
18:45:59 | Araq | Secondly, pre- and post-conditions could be proved by some proof-engine and the result could be much more useful than encoding the same in a traditional type system |
18:46:08 | FromDiscord_ | <Adam Kowalski> I think me and mratsim agreed when we spoke last time and we both wished this was supported by the language |
18:46:25 | FromDiscord_ | <Adam Kowalski> There is a huge advantage to being able to dispatch and do different logic depending on the amount of dimensions |
18:46:54 | FromDiscord_ | <Adam Kowalski> For example in reinforcement learning you need to build a completely different perception system depending on if your input is coming as a vector, matrix, or a cube |
18:46:55 | FromGitter | <awr1> @Adam Kowalski did you see my example from last night |
18:47:06 | FromGitter | <awr1> i.e. https://play.nim-lang.org/#ix=1St4 |
18:47:24 | FromDiscord_ | <Adam Kowalski> if you have a cube or a matrix coming in you need to build a convolutional neural network and extract information out of your image/video |
18:47:49 | FromDiscord_ | <Adam Kowalski> But if you have a vector, then you can get away with just using a dense layer |
18:49:17 | FromDiscord_ | <Adam Kowalski> You can also ensure that you will not get any runtime shape errors at compile time which is huge for the self driving industry or medical domains |
18:49:39 | FromDiscord_ | <Adam Kowalski> Python is notorious for this problem where you cannot validate behavior up front and must check everything at runtime and through unit tests |
18:49:57 | FromDiscord_ | <Adam Kowalski> I want a much higher level of correctness proof |
18:51:11 | FromGitter | <awr1> is there anything not satisfactory about the example i showed |
18:51:30 | FromDiscord_ | <Adam Kowalski> Yes I discuess this earlier up above |
18:51:30 | FromGitter | <awr1> the case is a compile time branch (or it should be, either that or you can use when) |
18:51:59 | FromDiscord_ | <Adam Kowalski> The main issue is I cannot extend it |
18:52:25 | FromDiscord_ | <Adam Kowalski> if I want to add new branches to that I have to modify that funciton |
18:52:36 | FromDiscord_ | <Adam Kowalski> with overloading I can add addiitonal behavior by adding to the overload set |
18:52:51 | FromDiscord_ | <Adam Kowalski> Meaning people who have special logic they want to add on don't need to submit a pull request to my library |
18:53:01 | FromDiscord_ | <Adam Kowalski> they can just add an overload and run with it |
18:53:26 | FromDiscord_ | <Adam Kowalski> If we could turn your example into something like this https://play.nim-lang.org/#ix=1SCN I would be really happy |
18:54:49 | * | terps joined #nim |
18:56:27 | Araq | https://play.nim-lang.org/#ix=1SD4 it should be done like this IMO |
18:56:53 | Araq | the compiler doesn't like it, but that seems to me the one bug I'm currently hunting |
18:57:30 | FromGitter | <awr1> i was going to suggest something like that, but yeah i ran into issues too. |
18:57:40 | FromGitter | <awr1> i have a linear algebra library that does something like this |
18:58:07 | FromGitter | <awr1> but it's less complicated because only one generic param and it was `static[int]` |
18:58:13 | FromDiscord_ | <Adam Kowalski> Okay cool! I will try to build out the library in nim too once that bug gets fixed and see how the experience goes between D/C++/nim |
18:58:30 | FromDiscord_ | <Adam Kowalski> Araq so with that setup can we have an additional requirement |
18:58:55 | FromDiscord_ | <Adam Kowalski> Can I now also overload and say that I want a 3D tensor (cube) but only match that overload if the middle dimension is of length 10 |
18:59:10 | FromDiscord_ | <Adam Kowalski> so if I have a Tensor[int, [M, 10, N]] |
18:59:16 | FromDiscord_ | <Adam Kowalski> take one branch |
18:59:28 | FromDiscord_ | <Adam Kowalski> and Tensor[int, [M, N, O]] in another branch |
18:59:50 | Araq | really? |
18:59:51 | FromDiscord_ | <Adam Kowalski> Not an if branch within one function, but as two overloads |
18:59:59 | Araq | is that wise? |
19:00:15 | Araq | looks to me 'when N == 10' is superior |
19:00:31 | Araq | otherwise some implementation detail is leaked into the proc definitions |
19:01:22 | FromGitter | <awr1> https://play.nim-lang.org/#ix=1SD9 using typeclasses doesn't work either |
19:04:05 | * | terps quit (Ping timeout: 252 seconds) |
19:05:58 | FromDiscord_ | <Adam Kowalski> Well the real use case is this |
19:06:10 | FromDiscord_ | <Adam Kowalski> You may not always know the dimension in advance, but you sure know the rank |
19:06:26 | FromDiscord_ | <Adam Kowalski> for example with images you load them in, you know it's a cube (width x height x color) |
19:06:42 | FromDiscord_ | <Adam Kowalski> But you don't know the width and height dimension so you need the shape to have two dynamic entries and 1 static |
19:07:01 | FromDiscord_ | <Adam Kowalski> I typically use -1 in c++/d to mean dynamic and positive integers to mean static |
19:07:34 | FromDiscord_ | <Adam Kowalski> Now if you reshape the image so they are all a known size like lets say 1920 x 1080 x 3. Then you want to get back a statically known tensor dimension |
19:08:01 | * | FromGitter quit (Remote host closed the connection) |
19:08:15 | FromDiscord_ | <Adam Kowalski> But now if you have a batch of images lets say 30 at a time |
19:08:19 | * | FromGitter joined #nim |
19:08:32 | FromDiscord_ | <Adam Kowalski> so your tensor is Tensor[float32, [1920, 1080, 3, 30]] |
19:08:51 | FromDiscord_ | <Adam Kowalski> But really the last dimension should be -1 because you can't garuantee you have a multiple of 30 images |
19:09:12 | FromDiscord_ | <Adam Kowalski> The point is I need to do arbitrary compile time dimension analysis and do dispatch on all sort of different weird situations |
19:09:34 | FromDiscord_ | <Adam Kowalski> I need either variadic non type generics or tuples that I can dispatch with |
19:12:02 | FromGitter | <awr1> actually this works, but it's verbose |
19:12:03 | FromGitter | <awr1> https://play.nim-lang.org/#ix=1SD9 |
19:12:45 | FromGitter | <awr1> oh lol |
19:12:45 | FromGitter | <awr1> https://play.nim-lang.org/#ix=1SD9 |
19:12:48 | FromGitter | <awr1> wait whoops |
19:12:51 | FromDiscord_ | <Adam Kowalski> I'm getting |
19:12:51 | FromDiscord_ | <Adam Kowalski> |
19:12:51 | FromDiscord_ | <Adam Kowalski> Hint: used config file '/nim/config/nim.cfg' [Conf] |
19:12:51 | FromDiscord_ | <Adam Kowalski> Hint: system [Processing] |
19:12:51 | FromDiscord_ | <Adam Kowalski> Hint: widestrs [Processing] |
19:12:52 | FromDiscord_ | <Adam Kowalski> Hint: io [Processing] |
19:12:53 | FromDiscord_ | <Adam Kowalski> Hint: in [Processing] |
19:12:55 | FromDiscord_ | <Adam Kowalski> /usercode/in.nim(15, 4) Error: type mismatch: got <Tensor[system.int, array[0..0, int]]> |
19:12:55 | FromDiscord_ | <Adam Kowalski> but expected one of: |
19:12:57 | FromDiscord_ | <Adam Kowalski> proc foo[T; M: static array[1, int]](tensor: Tensor[T, M]) |
19:12:58 | FromGitter | <awr1> https://play.nim-lang.org/#ix=1SDg |
19:12:59 | FromDiscord_ | <Adam Kowalski> proc foo[T; M: static array[2, int]](tensor: Tensor[T, M]) |
19:13:01 | FromDiscord_ | <Adam Kowalski> proc foo[T; M: static array[3, int]](tensor: Tensor[T, M]) |
19:13:03 | FromDiscord_ | <Adam Kowalski> |
19:13:04 | FromDiscord_ | <Adam Kowalski> expression: foo(Tensor[int, [3]]()) |
19:13:36 | FromGitter | <awr1> it works if you make the Dims thing its own type |
19:14:51 | FromDiscord_ | <Adam Kowalski> It wokrs even if I inline the openarray[int] into the type |
19:14:54 | FromDiscord_ | <Adam Kowalski> We are getting there! |
19:17:13 | FromDiscord_ | <Adam Kowalski> Can you put constraints on types? Like beyond concepts can I do something like SFINAE in C++ |
19:17:54 | FromDiscord_ | <Adam Kowalski> Can I say, this method only participates in the overload set when compile time condition is met |
19:18:15 | FromDiscord_ | <Adam Kowalski> Like if I define transpose |
19:18:25 | FromDiscord_ | <Adam Kowalski> The product of the input dimensions and the product of the output dimensions must match |
19:18:45 | FromGitter | <awr1> static assert |
19:20:19 | FromDiscord_ | <Adam Kowalski> Right but thats part of the body of the function |
19:20:31 | FromDiscord_ | <Adam Kowalski> which means I then cannot add another function to the overload set which relaxes that constraint? |
19:21:38 | FromGitter | <awr1> then a compile-time branch? |
19:21:56 | FromDiscord_ | <Adam Kowalski> what do you mean by that |
19:22:12 | FromDiscord_ | <Adam Kowalski> like |
19:22:12 | FromDiscord_ | <Adam Kowalski> |
19:22:12 | FromDiscord_ | <Adam Kowalski> when somethign: |
19:22:12 | FromDiscord_ | <Adam Kowalski> do one thing |
19:22:12 | FromDiscord_ | <Adam Kowalski> else: |
19:22:13 | FromDiscord_ | <Adam Kowalski> do something else? |
19:22:14 | FromGitter | <awr1> `when notSatisfies(): a() else: b()` |
19:22:28 | FromDiscord_ | <Adam Kowalski> Yeah I guess |
19:22:28 | FromDiscord_ | <Adam Kowalski> I don't like that |
19:22:44 | FromDiscord_ | <Adam Kowalski> I prefer things that are open to extension as much as possible |
19:22:57 | * | terps joined #nim |
19:23:42 | FromDiscord_ | <Adam Kowalski> I will try things out like this and see if I run into any concrete problesm |
19:24:04 | FromGitter | <awr1> do you know of another langauge that allows for that sort of thing that isn't like...Agda or some weird functional language |
19:24:14 | FromDiscord_ | <Adam Kowalski> C++/D? |
19:24:45 | FromGitter | <awr1> i mean i guess you have SFINAE but i don't know how that applies to your case |
19:24:49 | FromDiscord_ | <Adam Kowalski> Let me write an example if that helps |
19:31:35 | * | xet7 joined #nim |
19:34:25 | * | terps quit (Ping timeout: 250 seconds) |
19:36:47 | * | abm quit (Ping timeout: 244 seconds) |
19:39:41 | * | Trustable quit (Remote host closed the connection) |
19:43:02 | FromGitter | <arnetheduck> is there a difference between `typedesc` and `type` in `f(x: typedesc)` vs `f(x: type)`? |
19:47:32 | dom96 | there isn't |
19:47:55 | dom96 | and yes, removing `type` has been discussed |
19:49:21 | Araq | 'x: type' needs to die, it's terrible |
19:52:28 | * | terps joined #nim |
19:53:21 | FromGitter | <arnetheduck> uh ok. I kind of remember @zah recommending it at some point.. can it be.. deprecated then so there's a warning? |
19:56:21 | * | laaron quit (Remote host closed the connection) |
19:58:59 | * | abm joined #nim |
19:59:28 | * | laaron joined #nim |
20:03:52 | * | elrood joined #nim |
20:06:46 | krux02 | arnetheduck: There is no warning yet, though there will be in the future. |
20:06:55 | * | terps quit (Ping timeout: 250 seconds) |
20:07:03 | FromDiscord_ | <Shield> I remember doing something dumb like having a macro that you can call from anywhere and it will feed the body into a body of a proc, with an optional priority argument |
20:07:49 | FromDiscord_ | <Shield> maybe you can use that so people get to define their own specific cases in their code but under the hood you use when X : do Y? |
20:10:09 | krux02 | Shield: What were you trying to solve with that? |
20:15:10 | * | elrood quit (Remote host closed the connection) |
20:17:24 | * | nsf quit (Quit: WeeChat 2.5) |
20:19:14 | FromDiscord_ | <Shield> it was more of an exercice than anything, I wanted to see if I macro can sort a bunch of statements and outputs a correct function without me having to put things in order manually in a gigantic function |
20:19:56 | FromDiscord_ | <Shield> it was also silly |
20:24:17 | krux02 | Shield: in my experience, if there is a solution where you just need to put things in the right order, go for that one. |
20:25:08 | krux02 | Keep things simple, sorting things might take some effort, but it also flatens the problem and after the things have been sorted you don't have to deal with the automagical sorting thing anymore. |
20:30:49 | * | narimiran quit (Ping timeout: 268 seconds) |
20:30:58 | * | ZORR0W quit (Quit: Quit) |
20:33:13 | shashlick | my libarchive wrapper works fine on windows but segfaults in linux - any suggestions? http://ix.io/1SDh |
20:34:05 | shashlick | https://github.com/genotrance/nimarchive/tree/nimterop |
20:41:55 | Araq | valgrind |
20:42:19 | Araq | we have a suppression file for Nim somewhere |
20:42:50 | Araq | in tools/nimgrind.supp |
20:45:35 | * | shomodj joined #nim |
20:47:09 | shashlick | guess i have to learn valgrind again |
20:52:28 | shashlick | Same on osx - https://pastebin.com/FvaQutx9 |
20:53:39 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:56:09 | Araq | shashlick, you use 'free' on a pointer that wasn't malloc'ed |
20:58:49 | shashlick | well, i open an archive, read its files and then attempt to close it with libarchive's free routine |
20:59:00 | shashlick | it is calling free internally |
20:59:33 | shashlick | the wrapper is super simple so i'm probably not setting a #define or compiling in the wrong file |
21:00:03 | FromGitter | <erhlee-bird> is it possible for a generic variant type to have a property of the generic type in fewer than all possible variants? |
21:14:15 | FromDiscord_ | <Adam Kowalski> @Araq Can you help me reproduce this example with Nim https://run.dlang.io/is/ftOBbX |
21:14:34 | FromDiscord_ | <Adam Kowalski> I really want to switch over if I can I just want to make sure that I can build what I need |
21:16:28 | Araq | no, sorry, I need to sleep. But as I said, what keeps it from working is a bug that I'm working on |
21:17:00 | FromDiscord_ | <Adam Kowalski> Yeah no rush, this is an ongoing effort to evaluate several options and decide which one our company should move towards |
21:17:14 | FromDiscord_ | <Adam Kowalski> I need to build a proof of concept in each language we are considering |
21:17:58 | Araq | I've outlined how I think it should work, right? |
21:18:31 | FromDiscord_ | <Adam Kowalski> Just have the type contain an openarray? |
21:18:43 | FromDiscord_ | <Adam Kowalski> Then I can operate on that using compile time function evaluation? |
21:18:55 | Araq | the static array[2, int] overloads |
21:19:15 | FromDiscord_ | <Adam Kowalski> I'll scroll up and reread |
21:19:34 | FromDiscord_ | <Adam Kowalski> I thought people were just mentioning to use a when instead of overloads |
21:20:03 | Araq | I said to use 'when' for your N == 10 specialization |
21:20:27 | Araq | makes more sense to me but I can be wrong |
21:20:44 | Araq | good night |
21:20:55 | FromDiscord_ | <Adam Kowalski> good night! |
21:24:40 | * | solitudesf quit (Ping timeout: 272 seconds) |
21:54:28 | * | krux02 quit (Remote host closed the connection) |
23:29:33 | skrylar[m] | i see people recommending arraymancer again. is it out of mothball? |
23:29:52 | skrylar[m] | i tried to do some neural tts with it around a year ago and kept getting told everything was shelved |
23:31:25 | disruptek | i don't think it was mothballed; it's just that mratsim is more focused on getting laser built up to empower arraymancer. |
23:39:51 | * | abm quit (Read error: Connection reset by peer) |