00:27:06 | * | dhalinar joined #nim |
00:36:34 | * | saml_ joined #nim |
00:52:08 | * | enthus1ast quit (Ping timeout: 260 seconds) |
00:56:53 | * | hcorion quit (Read error: Connection reset by peer) |
01:19:55 | * | saml_ quit (Remote host closed the connection) |
01:21:55 | * | saml_ joined #nim |
01:23:48 | * | onionhammer quit (Ping timeout: 245 seconds) |
01:33:40 | * | pregressive quit (Remote host closed the connection) |
01:34:16 | * | pregressive joined #nim |
01:35:27 | * | brechtm quit (Remote host closed the connection) |
01:38:23 | * | pregressive quit (Ping timeout: 245 seconds) |
01:43:30 | * | libman quit (Remote host closed the connection) |
02:24:25 | * | Kingsquee joined #nim |
02:25:04 | * | chemist69 quit (Ping timeout: 260 seconds) |
02:25:42 | * | pregressive joined #nim |
02:38:10 | * | chemist69 joined #nim |
03:27:43 | * | onionhammer joined #nim |
03:32:28 | * | onionhammer quit (Ping timeout: 256 seconds) |
03:34:51 | * | ibk joined #nim |
03:52:13 | * | byte512 quit (Ping timeout: 244 seconds) |
03:58:13 | * | couven92 quit (Quit: Client disconnecting) |
03:58:53 | * | saml_ quit (Remote host closed the connection) |
03:59:37 | * | Kingsquee quit (Ping timeout: 260 seconds) |
04:31:31 | * | brson quit (Quit: leaving) |
04:37:34 | * | dddddd quit (Remote host closed the connection) |
04:44:21 | * | dhalinar quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
04:45:25 | * | dhalinar joined #nim |
04:47:51 | * | pregressive quit (Remote host closed the connection) |
04:48:20 | * | hcorion joined #nim |
04:48:24 | * | pregressive joined #nim |
04:53:03 | * | pregressive quit (Ping timeout: 256 seconds) |
04:53:13 | * | shashlick left #nim (#nim) |
04:53:16 | * | shashlick joined #nim |
04:53:57 | * | shashlick quit () |
04:54:11 | * | shashlick joined #nim |
05:14:26 | * | space-wizard quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
05:16:46 | * | space-wizard joined #nim |
05:22:55 | * | bjz joined #nim |
05:31:52 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
05:39:13 | shashlick | hey guys, is there any documentation on getting libui working with nim on Windows? |
05:39:53 | * | zaquest joined #nim |
05:43:35 | * | bjz joined #nim |
05:50:36 | hcorion | @shashlick well, there is currently no pre-made port of libui to nim. So you'd have to use c2nim, here is a neat sort-of guide: http://goran.krampe.se/2014/10/16/nim-wrapping-c/ although it's fairly old |
05:51:59 | hcorion | Or if you'd rather not you could just use nimx ( https://github.com/yglukhov/nimx ) which is probably similar |
05:58:18 | shashlick | hcorion: looks like a lot of work for a newbie, I'll try nimx for now, thanks! |
05:58:37 | hcorion | np! Glad I could help |
05:59:35 | cheatfate | hcorion, i think you are wrong |
05:59:49 | hcorion | about what? |
06:00:02 | cheatfate | about libui |
06:00:04 | cheatfate | https://github.com/nim-lang/ui |
06:00:51 | hcorion | Wow, it only has 7 commits, how far along is it? |
06:01:23 | * | dhalinar quit (Ping timeout: 244 seconds) |
06:02:13 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
06:02:26 | cheatfate | hcorion, its in official Nim repository |
06:02:47 | hcorion | So @shashlick if you are more familiar with libui, I definitly give what cheatfate linked to a try |
06:04:57 | shashlick | I actually found ui on the nim packages page and installed it, was struggling to get libui to build on my windows laptop though |
06:05:14 | shashlick | just tried installing nimx and it fails while installing nake |
06:05:32 | hcorion | What nim version are you using? |
06:05:55 | shashlick | 0.15.2 |
06:06:04 | shashlick | Building nake/nake.exe using c backend... |
06:06:04 | shashlick | Build failed for '[email protected]', would you like to try installing 'nake@#head' (latest unstable)? [y/N] y |
06:06:31 | shashlick | Installing nake-1.9 |
06:06:31 | shashlick | Building nake/nake.exe using c backend... |
06:06:31 | shashlick | Traceback (most recent call last) |
06:06:31 | shashlick | nimble.nim(1004) nimble |
06:06:31 | shashlick | nimble.nim(936) doAction |
06:06:32 | shashlick | nimble.nim(580) install |
06:06:32 | shashlick | nimble.nim(392) installFromDir |
06:06:33 | shashlick | nimble.nim(270) processDeps |
06:06:33 | shashlick | nimble.nim(594) install |
06:06:34 | shashlick | nimble.nim(580) install |
06:06:34 | shashlick | nimble.nim(402) installFromDir |
06:06:35 | shashlick | nimble.nim(323) buildFromDir |
06:06:55 | shashlick | sorry, but should I be using pastebin for such long messages? |
06:07:15 | hcorion | Yeah, that would be the way to do it :P |
06:08:46 | hcorion | hmm, built and compiled fine on my windows system |
06:08:56 | hcorion | seems to be a problem with nimble on your end though |
06:09:49 | * | nsf joined #nim |
06:10:02 | shashlick | I'm on nimble v0.7.10 |
06:10:42 | hcorion | What if you just run nimble install nake@#head |
06:12:04 | shashlick | same deal - tries to install v1.9 and fails on the same line |
06:13:27 | hcorion | alright, let's try libui then :P you were having troubles compiling it? |
06:15:12 | hcorion | Someone already built a libui64.dll try downloading this: https://github.com/jlp765/ui/raw/ad4444e5dc861c31e1b5c8b593381b89bc3a2971/libs/libui64.dll |
06:16:02 | shashlick | oh neat, that helps |
06:16:41 | hcorion | and then try running one of the examples |
06:17:12 | * | lenstr joined #nim |
06:19:27 | shashlick | brilliant! works great :) |
06:19:37 | hcorion | Awesome! |
06:19:46 | hcorion | Maybe I'll have to try libui... |
06:20:25 | shashlick | for a guy coming from Python, I love how the upx'd version of the binary + libui = 200kb |
06:22:02 | shashlick | on the libui compilation side, the error was that gtk+-3.0 was missing |
06:22:21 | shashlick | i wonder why libui wanted gtk on windows, it's supposed to call the native UI |
06:22:35 | hcorion | yeah, it shouldn't |
06:25:31 | shashlick | as for nake build failing, looks like I hadn't run finish.exe |
06:25:47 | shashlick | but running it doesn't seem to help - it is unable to detect my mingw-w64 install under msys2 |
06:26:34 | hcorion | are you running nim in mingw-w64? |
06:27:32 | shashlick | yes |
06:27:50 | hcorion | try running it on the normal windows command line |
06:28:03 | shashlick | actually, let me correct that - I installed Nim using the installer, not msys2 |
06:28:08 | shashlick | and am running it in regular command line |
06:28:15 | shashlick | i've added mingw-w64 to the path |
06:29:52 | hcorion | ok |
06:30:25 | hcorion | so like C:/msys2/mingw64/bin/ ? |
06:30:57 | hcorion | woops, I mean C:/msys64/mingw64/bin |
06:31:26 | shashlick | yep the latter |
06:31:38 | shashlick | not sure how to pass that to finish.exe |
06:32:17 | hcorion | if you type in where gcc in the command line what shows up? |
06:32:36 | shashlick | > gcc |
06:32:36 | shashlick | gcc: fatal error: no input files |
06:32:36 | shashlick | compilation terminated. |
06:32:53 | shashlick | version 6.2.0 |
06:33:28 | hcorion | sorry, I meant: "where gcc" without quotation marks |
06:33:47 | shashlick | sorry - C:\msys64\mingw64\bin\gcc.exe |
06:36:16 | shashlick | this issue seems similar - is marked closed though: https://github.com/yglukhov/jsbind/issues/2 |
06:37:07 | hcorion | you installed the 64-bit version of Nim? |
06:38:33 | * | onionhammer joined #nim |
06:38:35 | shashlick | yes |
06:38:55 | shashlick | Nim Compiler Version 0.15.2 (2016-10-23) [Windows: amd64] |
06:39:43 | hcorion | hmm, I dunno |
06:43:04 | shashlick | okay well, I have libui working so will twiddle with that for now, thanks for all the help! |
06:43:58 | hcorion | Yep! Too bad we couldn't get nake working :( |
06:45:45 | shashlick | i'm hoping someone else here has some idea, will check later though, 1am :) |
06:45:57 | hcorion | yeah, maybe post in the forums |
07:17:50 | ibk | how to create `ptr ptr some_type` from `ptr sometype`? |
07:17:50 | ibk | It is for C binding that need `**sometype` argument |
07:18:21 | * | hcorion quit (Remote host closed the connection) |
07:19:05 | ibk | c2nim result : proc jwt_decode*(jwt: ptr ptr jwt_t; token: cstring; key: ptr cuchar; key_len: cint): cint |
07:22:10 | * | yglukhov joined #nim |
07:22:13 | * | yglukhov quit (Remote host closed the connection) |
07:22:32 | * | gokr joined #nim |
07:23:09 | * | yglukhov joined #nim |
07:23:19 | Araq | shashlick: nawabs c nake # works for me |
07:23:33 | * | Araq shameless tries to sell his nawabs tool again ... |
07:24:14 | ibk | maybe the question can be simplified to : how is `&some_var` (C syntax) in Nim? |
07:24:29 | Araq | ibk: addr some_var |
07:31:49 | ibk | Araq : thanks it works! |
07:31:49 | ibk | And how to produce `ptr cuchar` from string? |
07:31:49 | ibk | i've tried `addr(cuchar(str))`, `addr str` but none worked |
07:32:34 | Araq | that should be 'cstring' in your wrapper then |
07:32:44 | Araq | string auto converts to cstring |
07:35:03 | ibk | ok, thanks, it worked |
07:42:28 | * | bjz joined #nim |
08:03:26 | * | Arrrr joined #nim |
08:03:29 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:04:56 | * | yglukhov_ joined #nim |
08:06:01 | * | gangstacat quit (Ping timeout: 260 seconds) |
08:08:26 | * | yglukhov quit (Ping timeout: 256 seconds) |
08:11:22 | * | yglukhov_ quit (Remote host closed the connection) |
08:11:58 | * | yglukhov joined #nim |
08:14:08 | * | Andris_zbx joined #nim |
08:16:14 | * | yglukhov quit (Ping timeout: 244 seconds) |
08:29:45 | * | Trustable joined #nim |
08:30:21 | * | bjz joined #nim |
09:20:22 | * | brechtm joined #nim |
09:24:22 | * | yglukhov joined #nim |
09:31:34 | * | gangstacat joined #nim |
09:32:51 | * | yglukhov quit (Remote host closed the connection) |
09:33:51 | * | enthus1ast joined #nim |
09:42:36 | * | anp_ quit (Remote host closed the connection) |
09:44:57 | * | yglukhov joined #nim |
09:48:30 | * | space-wizard quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:49:20 | * | yglukhov quit (Ping timeout: 252 seconds) |
09:49:46 | * | space-wizard joined #nim |
09:50:03 | * | space-wizard quit (Client Quit) |
09:50:35 | * | space-wizard joined #nim |
09:50:51 | * | space-wizard quit (Client Quit) |
09:51:19 | * | space-wizard joined #nim |
09:51:39 | * | space-wizard quit (Client Quit) |
09:52:06 | * | space-wizard joined #nim |
09:52:10 | * | Matthias247 joined #nim |
09:52:27 | * | space-wizard quit (Client Quit) |
09:52:54 | * | space-wizard joined #nim |
09:53:15 | * | space-wizard quit (Client Quit) |
09:53:43 | * | space-wizard joined #nim |
09:54:03 | * | space-wizard quit (Client Quit) |
10:10:41 | * | bjz_ joined #nim |
10:10:51 | * | enthus1ast quit (Ping timeout: 265 seconds) |
10:11:20 | * | bjz quit (Ping timeout: 265 seconds) |
10:33:56 | * | vlad1777d joined #nim |
10:40:54 | * | cheatfate quit (Read error: Connection reset by peer) |
10:57:46 | * | yglukhov joined #nim |
10:58:51 | * | yglukhov quit (Remote host closed the connection) |
11:00:30 | * | yglukhov joined #nim |
11:05:49 | * | yglukhov quit (Remote host closed the connection) |
11:09:32 | * | cheatfate joined #nim |
11:15:36 | * | arnetheduck quit (Remote host closed the connection) |
11:26:37 | * | arnetheduck joined #nim |
11:36:07 | * | desophos quit (Read error: Connection reset by peer) |
11:36:59 | * | yglukhov joined #nim |
11:37:05 | * | yglukhov quit (Remote host closed the connection) |
11:37:58 | * | yglukhov joined #nim |
11:49:31 | * | elrood joined #nim |
12:00:23 | * | brechtm quit (Remote host closed the connection) |
12:01:57 | * | Snircle joined #nim |
12:05:58 | * | brechtm joined #nim |
12:08:22 | * | dmi00 joined #nim |
12:09:06 | * | brechtm_ joined #nim |
12:12:06 | * | brechtm quit (Ping timeout: 246 seconds) |
12:12:37 | * | enthus1ast joined #nim |
12:14:08 | * | athie quit (Quit: No Ping reply in 180 seconds.) |
12:15:16 | * | SirCmpwn quit (Ping timeout: 252 seconds) |
12:15:24 | * | athie joined #nim |
12:16:15 | * | SirCmpwn joined #nim |
12:18:44 | * | yglukhov_ joined #nim |
12:21:33 | jh32 | hi |
12:22:08 | * | yglukhov quit (Ping timeout: 245 seconds) |
12:24:11 | Araq | hi |
12:24:39 | * | yglukhov_ quit (Remote host closed the connection) |
12:25:24 | jh32 | my test program causes a considerable amount of allocations via getBigChunk() and from what i see so far it needs to loop a lot there causing performance degradation compared to python |
12:26:15 | * | abeaumont quit (Ping timeout: 252 seconds) |
12:26:29 | jh32 | is this a known issue or should i try to dig deeper into that? |
12:31:04 | jh32 | i see it loop several hundred times in the while loop of getBigChunk() for some allocations |
12:38:26 | * | brechtm_ quit (Remote host closed the connection) |
12:41:17 | jh32 | test program is https://github.com/jfhg/nimdeep |
12:41:40 | * | brechtm joined #nim |
12:44:24 | jh32 | it recreates big matrices in sometimes where in-place operations could be used. it seems that python/numpy is quite optimized for this load on the allocator |
12:47:42 | * | eizua joined #nim |
12:51:20 | tstm | jh32: Aren't you explicitly making copies with makeMatrix there? To have in-place operations, you should probably define in-place-operations? |
12:53:23 | jh32 | linalg provides in-place operations (e.g. addition via +=) and using them in critical place brings performance to the same level as python/numpy |
12:55:38 | jh32 | i just think that in order to make nim/linalg a general platform for scientific computing also the not optimized cases should work without too much performance degradation |
12:57:38 | cheatfate | jh32, what OS you are using for tests? |
12:58:24 | jh32 | dragonfly bsd and linux on raspberry - i don't have a x86 linux system right now |
13:02:23 | cheatfate | jh32, and where you get your problems while loading or while processing? |
13:03:57 | cheatfate | if it happens on loading, then its a problem with algorithm you have choosen, i suggest you to use memFiles.nim |
13:04:20 | jh32 | it's all working fine - just that without modifing the program (using in-place opertations etc) i can't reach the performance of the python/numpy implementation |
13:04:51 | jh32 | loading is not the problem, but thanks for the hint with memFiles - will try that out |
13:06:04 | jh32 | could also be that numpy is doing some fancy tricks somewhere |
13:08:06 | cheatfate | jh32, ok i have take a fast look on your network.nim |
13:09:17 | cheatfate | and it looks like you dont like to use `ref types` |
13:09:37 | cheatfate | so there can be many `copy-on-write` assignments |
13:10:05 | jh32 | we just changed DMatrix64 to a ref type in linalg - that made a big difference |
13:10:49 | cheatfate | so looks like your problem resolved? |
13:11:51 | jh32 | well before that my nim version 3 times slower than numpy - now it take 1.3 times the time of numpy |
13:12:52 | jh32 | and by changing network.nim:97 and 98 to use in-place addition it's even a bit faster than the same thing in python |
13:15:43 | jh32 | but you are right, i will try to use ref types in more places and see if it makes a difference |
13:16:25 | Arrrr | I think `lc[]` creates a new seq every time, am i wrong? |
13:17:13 | jh32 | yes |
13:17:47 | jh32 | aeh - no - you are right :) |
13:19:15 | * | vlad1777d quit (Remote host closed the connection) |
13:19:18 | jh32 | but the list comprehensions in the original python program should also do that |
13:21:01 | Arrrr | Yes, probably nim is not that optimized, but you can squeeze a lot of performance from it |
13:21:37 | Arrrr | For example, maybe python resuses objects |
13:22:00 | jh32 | yes, i think they have some sort of object cache or so |
13:36:44 | Araq | seems like you need to introduce some TR macros |
13:46:57 | * | eizua quit (Remote host closed the connection) |
13:47:38 | * | couven92 joined #nim |
13:50:06 | * | yglukhov joined #nim |
13:55:28 | xet7 | How do I debug jester 404 not found error? |
13:55:45 | xet7 | It does not say what it has not found |
13:58:18 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
13:58:44 | * | [CBR]Unspoken quit (Ping timeout: 250 seconds) |
14:13:03 | * | [CBR]Unspoken joined #nim |
14:35:48 | xet7 | Ok I figured it out myself. |
14:40:31 | FromGitter | <nigredo-tori> Is there a way to check in a template or macro whether we're in a top module scope or not? `compiles` doesn't work, since it requires an expression. |
14:41:30 | Araq | why does it matter? |
14:43:00 | FromGitter | <nigredo-tori> Basically, i need approximately the following: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=582c7074e097df7575bc2a05] |
14:43:53 | FromGitter | <nigredo-tori> It all boils down to the export mark. |
14:44:15 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
14:44:35 | Araq | seems misguided, pass 'doExport: bool' to the template instead? |
14:46:26 | FromGitter | <nigredo-tori> Well, that's one solution. |
14:48:35 | * | nsf quit (Quit: WeeChat 1.6) |
14:48:48 | * | chemist69 quit (Ping timeout: 245 seconds) |
14:51:12 | * | chemist69 joined #nim |
14:51:47 | * | zevlg quit (Remote host closed the connection) |
14:54:06 | FromGitter | <ephja> unit test input permutation generation. fun stuff |
14:54:30 | FromGitter | <nigredo-tori> Here's the context: ⏎ I'm essentially trying to piggyback on scope system for passing some implicit values in compile-time. Think scala's implicits, as a close example. I store defined values in a compile-time `seq`s (one is created for each new scope with definitions). I'd like these lists to be exported to other modules. |
14:59:16 | FromGitter | <nigredo-tori> API user only defines values, seqs are part of implementation. Passing the decision of whether to export a list to API user will needlessly complicate the API... |
15:00:25 | Araq | so don't export it then? |
15:00:51 | Araq | if it works in a local scope it will also work as a toplevel scope, but exporting it is different |
15:01:07 | FromGitter | <nigredo-tori> But exporting is kind of the point... Again, think Scala implicits. |
15:01:36 | FromGitter | <nigredo-tori> Or, well, Haskell typeclass instances. |
15:04:48 | FromGitter | <nigredo-tori> Here's another solution, by the way - always export. This kills any local definitions, though. |
15:08:15 | FromGitter | <nigredo-tori> Ok, I think I'll just add to API a template that will declare such a seq with export marker. Still clunky, but dead simple to implement. |
15:08:28 | FromGitter | <nigredo-tori> Thank you. |
15:09:04 | Araq | I still don't know whether this "when in toplevel export without asking questions" makes sense |
15:09:35 | Araq | seems subtle for the template clients |
15:14:00 | FromGitter | <nigredo-tori> Eh, Haskell does this, so it can't be the end of the world. I've got a couple ideas on how to implement this with more granularity, but those will wait until there's at least one non-hypothetical person who actually needs it. |
15:17:46 | FromGitter | <nigredo-tori> By the way, this won't be "without asking questions". Basically, the API user would have to place something like `exportEverything()` at the top of each module. Where `exportEverything` is a template i spoke about (the one that defines a `seq` with an export marker). Without it nothing gets exported. |
15:43:09 | * | cheatfate quit (Read error: Connection reset by peer) |
15:50:52 | * | Kappy joined #nim |
15:51:40 | * | Kappy left #nim (#nim) |
15:59:10 | * | vlad1777d joined #nim |
16:05:52 | * | Jesin quit (Quit: Leaving) |
16:09:33 | * | Jesin joined #nim |
16:09:48 | * | vlad1777d quit (Remote host closed the connection) |
16:12:22 | * | arnetheduck quit (Ping timeout: 256 seconds) |
16:27:47 | * | enthus1ast quit (Ping timeout: 256 seconds) |
16:33:20 | * | Arrrr quit (Ping timeout: 268 seconds) |
16:35:33 | * | Arrrr joined #nim |
16:56:04 | * | brson joined #nim |
17:30:12 | * | elrood quit (Quit: Leaving) |
17:31:46 | * | Andris_zbx quit (Remote host closed the connection) |
17:36:46 | * | PMunch quit (Remote host closed the connection) |
17:38:53 | * | space-wizard joined #nim |
18:07:55 | * | dhalinar joined #nim |
18:24:19 | * | Trustable quit (Remote host closed the connection) |
18:28:21 | * | pregressive joined #nim |
18:30:12 | * | PMunch joined #nim |
18:30:54 | * | pregressive quit (Remote host closed the connection) |
18:31:30 | * | pregressive joined #nim |
18:36:01 | * | pregressive quit (Ping timeout: 260 seconds) |
18:50:42 | * | nsf joined #nim |
18:56:47 | * | elrood joined #nim |
18:58:27 | * | ibk quit (Quit: Connection closed for inactivity) |
18:58:27 | * | dhalinar quit (Read error: Connection reset by peer) |
19:00:41 | * | libman joined #nim |
19:03:49 | * | pregressive joined #nim |
19:04:07 | * | brechtm quit (Remote host closed the connection) |
19:19:27 | * | krux02 joined #nim |
19:20:14 | * | Pisuke joined #nim |
19:20:45 | krux02 | is there an operator like the division in c++, java, C, scala, go etc? |
19:20:53 | * | MyMind quit (Ping timeout: 245 seconds) |
19:21:07 | dom96 | `div`? |
19:21:11 | dom96 | or `/` ? |
19:21:12 | krux02 | the fact that / returns float on integer parameters is really counterproductive |
19:21:27 | dom96 | div then |
19:22:21 | krux02 | type mismatch: got (float64, float64) |
19:22:52 | krux02 | div only exists for integer types |
19:23:18 | krux02 | and there is no div= |
19:23:27 | krux02 | at least I didn't find it |
19:23:46 | EastByte | you talked about integer division resulting in float |
19:24:46 | Araq | div is integer divide, / is float divide. Like in Modula, Pascal, Ada and all the other languages that have actually be designed rather than hacked into existance. |
19:25:42 | krux02 | I don't think it's hacket, if I like to have an operator that maps into itself |
19:26:23 | Araq | / for ints is more like floor(x / y), it's stupid to use the same operator for vastly different operations |
19:27:14 | krux02 | maybe I am not used enough for it. |
19:27:28 | Arrrr | Is cast[pointer](ObjectRef) safe? |
19:27:55 | Arrrr | I want to hash references |
19:28:00 | krux02 | currently I am writing my own version of glsl in nim, and this `div` and `/` distinction makes my beautiful generic functions ugly |
19:28:22 | * | xet7 quit (Quit: Leaving) |
19:28:31 | Araq | Arrrr: yup |
19:28:57 | Araq | what kind of generic algorithm doesn't care about div vs / ? |
19:29:39 | Araq | I don't think I've ever encountered one, avg and mean are better off producing floats for integer inputs |
19:31:20 | krux02 | it's not the algorithem, it's the fact that I design the vector and matrix operations on how they work in glsl, and there the operators are +-*/, and they always map into the same scalar type as the arguments |
19:32:53 | krux02 | mathPerComponent(`+`,`+`) |
19:32:53 | krux02 | mathPerComponent(`-`,`-`) |
19:32:53 | krux02 | mathPerComponent(`/`,`div`) ## yay, thanks for this weirdo |
19:32:53 | krux02 | mathPerComponent(`*`,`*`) |
19:33:11 | Araq | you don't have to do anything then |
19:33:24 | ldlework | nim is a language for weirdos |
19:33:26 | Araq | just let the generic instantion fail instead |
19:33:36 | ldlework | its like the lojban of programming languages |
19:34:00 | Araq | it's not like / for int vectors should produce something sane :P |
19:34:57 | krux02 | especially normalizing int vectors ) |
19:34:59 | krux02 | ;) |
19:35:39 | Araq | yeah I'm sure that works just fine with floor division... |
19:35:54 | Araq | everything works with floor division who needs fractions |
19:37:00 | Araq | avg(1, 2, 5) == 2 # close enough. |
19:39:45 | krux02 | I think it's important that math operations always return the same type that they get as arguments, and the fact that operations have the same name for their implementations for different types hels to keep algorithms generic |
19:40:07 | krux02 | I am just imagining the avg on fraction, or complex number types |
19:41:01 | krux02 | the I could say that this prototype is true: proc avg[T](arg: openarray[T]): T |
19:41:23 | Araq | you cannot lift the division to higher datatypes because the int division is fundamentally broken |
19:41:39 | Araq | it's like building a house on sand. |
19:42:07 | krux02 | what's so broken with the ind division? |
19:42:42 | krux02 | I mean int division |
19:43:20 | krux02 | I would disagree, that the int division is broken, it's just very special |
19:44:10 | krux02 | and using a special operator `div` just for ints helps a lot to avoid common pitfalls for beginners |
19:46:33 | krux02 | but still, I think this is one of the weird corners of nim, that it has this special `div` operator just for ints |
19:47:50 | Araq | I still think your mathPerComponent is wrong |
19:49:22 | krux02 | maybe for dynamically typed languages as python it makes sense that an operation can change it's type on return, but I think consistency with types is more important |
19:49:26 | * | dmi00 quit (Quit: ~) |
19:49:32 | krux02 | mathPerComponent is just a template |
19:49:50 | krux02 | I also have this one |
19:49:54 | krux02 | template `div`(a,b: SomeReal): SomeReal = a / b |
19:50:14 | Araq | you explicitly map / to 'div' but that's not idiomatic Nim |
19:50:27 | Araq | neither is mapping 'div' to float / |
19:50:41 | Araq | 'div' is 'floor(/)' |
19:50:47 | Araq | there are not aliases |
19:50:55 | Araq | but you treat them as such |
19:51:03 | Araq | *they are |
19:51:11 | * | Araq cannot type tonight |
19:51:24 | krux02 | then what's the divison with that has this property?: proc division[T](a,b: T): T |
19:51:53 | Araq | that's an illusion :P |
19:52:18 | krux02 | that's what my generic algorithms are based on |
19:52:51 | krux02 | or better said templates |
19:52:52 | Araq | the only look generic, they fail for integers. |
19:52:55 | Araq | *they |
19:53:21 | Araq | and not because Nim is weird, but because int div doesn't work for anything math related |
19:53:35 | * | dmi0 joined #nim |
19:57:34 | krux02 | I think that's only your point of view |
19:58:00 | krux02 | floating point numbers also do not have exact results |
19:58:24 | Araq | there is not a single math paper out there that uses / for when floor(x / y) is meant. |
19:58:40 | krux02 | when the integer numbers have very high absolute value, they become okay with their relative error |
19:58:58 | Araq | hardly my point of view when every math paper agrees with me. |
19:59:31 | Araq | div is mostly used when also 'mod' is used |
19:59:50 | Araq | division is entirely different and used for different algorithms |
20:00:07 | Araq | 2 different operations should have 2 different symbols. |
20:00:11 | Araq | I rest my case. |
20:04:29 | krux02 | so you think I should implement the div operator for integer vectors then? |
20:06:39 | * | yglukhov quit (Ping timeout: 260 seconds) |
20:08:51 | * | vlad1777d joined #nim |
20:09:03 | * | nsf quit (Quit: WeeChat 1.6) |
20:12:49 | * | yglukhov joined #nim |
20:16:21 | * | brechtm joined #nim |
20:17:23 | * | yglukhov quit (Ping timeout: 260 seconds) |
20:28:48 | krux02 | Araq: I would like to be able to do this: |
20:28:50 | krux02 | proc `/`(a,b: SomeInteger): SomeInteger = a div b |
20:28:50 | krux02 | proc `/=`(a: var SomeInteger; b: SomeInteger): void = |
20:28:50 | krux02 | a = a div b |
20:28:55 | * | dmi0 quit (Quit: ~) |
20:29:26 | krux02 | for some reason it still looks up the system / instead of my version |
20:29:44 | krux02 | this is independantly of weather you like my use case of it or not |
20:32:22 | krux02 | ok, with `int` it works |
20:32:31 | krux02 | I don't know why |
20:35:40 | * | Arrrr quit (Ping timeout: 260 seconds) |
20:38:51 | krux02 | That's again something I really like about nim. There is something I don't like and I just change it as I want it to be. I don't need to win any arguments on weather it is a good idea or not, I can just do it :D |
20:42:10 | * | shodan45 joined #nim |
20:43:02 | * | yglukhov joined #nim |
20:45:28 | * | brson quit (Ping timeout: 260 seconds) |
20:47:46 | * | yglukhov quit (Ping timeout: 256 seconds) |
20:54:07 | * | brechtm quit (Remote host closed the connection) |
20:55:17 | * | brechtm joined #nim |
20:55:53 | * | pregressive quit (Read error: Connection reset by peer) |
21:00:20 | dom96 | krux02: Sorry, I have to: *whether. |
21:00:35 | * | pregressive joined #nim |
21:00:48 | * | brechtm quit (Remote host closed the connection) |
21:01:30 | krux02 | yea writing |
21:02:02 | dom96 | hrm? |
21:07:07 | * | zaquest quit (Quit: Leaving) |
21:07:33 | * | Trustable joined #nim |
21:09:29 | * | brechtm joined #nim |
21:13:11 | * | nsf joined #nim |
21:18:30 | * | brechtm quit (Remote host closed the connection) |
21:27:14 | * | brechtm joined #nim |
21:27:18 | * | libman quit (Remote host closed the connection) |
21:30:27 | * | yglukhov joined #nim |
21:30:57 | * | brechtm quit (Remote host closed the connection) |
21:31:24 | * | pregressive quit (Read error: Connection reset by peer) |
21:32:05 | * | brechtm joined #nim |
21:32:16 | * | pregressive joined #nim |
21:33:35 | * | pregressive quit (Read error: Connection reset by peer) |
21:34:49 | * | pregressive joined #nim |
21:38:47 | * | mat4 joined #nim |
21:38:56 | * | pregress_ joined #nim |
21:39:02 | * | pregressive quit (Read error: Connection reset by peer) |
21:41:53 | * | brson joined #nim |
21:42:15 | krux02 | sorry for misspelling |
21:56:50 | FromGitter | <ephja> Araq: do you know if this has been reported? https://gist.github.com/ephja/68770bee6625b0450f4a3f8a7b627c44 |
21:59:55 | Araq | nope, unknown bug |
22:00:07 | FromGitter | <ephja> ok |
22:07:07 | * | cheatfate joined #nim |
22:19:08 | * | pregress_ quit (Remote host closed the connection) |
22:19:44 | * | pregressive joined #nim |
22:24:13 | * | pregressive quit (Ping timeout: 256 seconds) |
22:24:44 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:35:41 | * | PMunch quit (Quit: leaving) |
22:36:13 | * | couven92 quit (Read error: Connection reset by peer) |
22:41:22 | krux02 | ambiguous call; both system.$(x: T) and vec.$(v: Vec) |
22:41:32 | krux02 | am I not supposed to override `$` and export it? |
22:45:35 | * | mat4 quit (Quit: Verlassend) |
22:47:41 | Araq | surely you are |
22:48:01 | Araq | but your Vec is just an alias for seq I guess |
22:48:12 | Araq | so the compiler is right and it's ambiguous |
22:49:21 | * | brson quit (Quit: leaving) |
22:49:29 | * | brson joined #nim |
22:50:39 | * | Trustable quit (Remote host closed the connection) |
22:51:06 | * | brechtm quit (Remote host closed the connection) |
22:53:00 | * | elrood quit (Remote host closed the connection) |
22:59:54 | krux02 | Araq: my vec is this: Vec[N : static[int],T] = object( arr: array[N,T] ) |
23:00:18 | krux02 | so my vec is an object, not an alias for anything |
23:00:58 | Araq | strange. report it. |
23:03:59 | * | nsf quit (Quit: WeeChat 1.6) |
23:16:53 | * | couven92 joined #nim |
23:42:19 | * | yglukhov quit (Remote host closed the connection) |
23:43:50 | * | dmi0 joined #nim |
23:52:08 | * | chemist69 quit (Ping timeout: 245 seconds) |
23:56:30 | * | chemist69 joined #nim |