00:00:26 | * | marmotini_ quit (Ping timeout: 240 seconds) |
00:05:27 | stefantalpalaru | "can be setup" -> "can be set up" |
00:06:42 | * | Hideki_ joined #nim |
00:06:42 | stefantalpalaru | "saavy" -> "savvy" |
00:09:43 | stefantalpalaru | "build.sh" and "build.bat" are in csources. In the top-level Nim dir we have "build_all.sh" and "build_all.bat". |
00:09:52 | shashlick | Neat thanks, ya definitely needs some fluff and color but this is first draft |
00:11:01 | shashlick | Want to make sure the content is correct |
00:15:02 | stefantalpalaru | An OS without an official package manager is a scam. Don't fall for it. |
00:15:48 | leorize | some people dislike a package manager |
00:16:52 | FromDiscord | <exelotl> I just have a junction which I point to whichever nim version I want to use currently lol |
00:26:09 | * | Hideki_ quit (Remote host closed the connection) |
00:28:08 | * | Hideki_ joined #nim |
00:28:52 | * | Hideki_ quit (Remote host closed the connection) |
00:29:05 | * | Hideki_ joined #nim |
00:29:10 | * | Hideki_ quit (Remote host closed the connection) |
00:36:57 | * | luis__ quit (Quit: luis__) |
00:42:47 | * | leorize quit (Quit: WeeChat 2.6) |
00:54:18 | * | dwdv quit (Ping timeout: 258 seconds) |
01:04:22 | * | NimBot joined #nim |
01:05:54 | * | krux02 quit (Remote host closed the connection) |
01:07:43 | * | opal quit (Ping timeout: 240 seconds) |
01:11:48 | * | Hideki_ joined #nim |
01:12:11 | * | opal joined #nim |
01:23:28 | * | kitech1 quit (Ping timeout: 260 seconds) |
01:23:56 | dadada_ | this is worth checking out: whichever nim version I want to use currently lol |
01:24:24 | * | kitech1 joined #nim |
01:24:41 | dadada_ | sorry, copy past error due to mouse misuse by me ... the last part was what exelotl said an hour earlier |
01:24:52 | dadada_ | what I wanted to write was this: |
01:25:05 | dadada_ | this is worth checking out: https://wasmtime.dev/ |
01:25:40 | clyybber | lol |
01:26:23 | * | kitech1 quit (Client Quit) |
01:26:24 | dadada_ | https://www.youtube.com/watch?time_continue=307&v=Qn_4F3foB3Q&feature=emb_logo |
01:26:43 | * | Hideki_ quit (Ping timeout: 260 seconds) |
01:26:59 | dadada_ | there's rust/go/python support, so there shouldn't be a significant reason why there couldn't be nim support for it |
01:27:41 | dadada_ | and it would mean, that modules written with support for wasmtime in any of these languages, can be used in all the languages that support it |
01:27:52 | dadada_ | or have support for it |
01:28:10 | * | kitech1 joined #nim |
01:28:51 | dadada_ | it's basically my dream come true of all proglangs being able to relatively easily share modules(and thus code) with each other |
01:29:55 | * | kitech1 quit (Client Quit) |
01:32:19 | * | dddddd quit (Ping timeout: 260 seconds) |
01:35:59 | * | kitech1 joined #nim |
02:02:29 | * | endragor joined #nim |
02:08:29 | * | chemist69 quit (Ping timeout: 272 seconds) |
02:09:55 | * | chemist69 joined #nim |
02:25:38 | * | theelous3 joined #nim |
02:28:53 | * | marmotini_ joined #nim |
02:33:27 | * | marmotini_ quit (Ping timeout: 260 seconds) |
02:46:01 | * | clyybber quit (Quit: WeeChat 2.7.1) |
02:46:03 | disruptek | LEORIZE |
02:46:07 | disruptek | you have been summoned. |
02:54:38 | leorize[m] | what? |
02:54:48 | disruptek | your syntax highlighting is broken on stream. |
02:56:15 | leorize[m] | lol |
02:56:28 | leorize[m] | wait |
03:00:32 | * | LER0ever joined #nim |
03:15:28 | disruptek | it's no biggie, dude. |
03:15:34 | disruptek | thanks for stopping by. |
03:20:04 | * | muffindrake quit (Ping timeout: 248 seconds) |
03:22:14 | * | muffindrake joined #nim |
03:32:43 | * | dadada_ quit (Ping timeout: 260 seconds) |
03:34:08 | * | dadada joined #nim |
03:34:32 | * | dadada is now known as Guest59306 |
03:39:00 | * | lbart quit (Ping timeout: 265 seconds) |
03:46:03 | * | opal quit (Ping timeout: 240 seconds) |
03:46:51 | * | opal joined #nim |
03:48:12 | * | rockcavera quit (Remote host closed the connection) |
03:58:08 | * | lbart joined #nim |
04:13:46 | * | ikan-keli_ quit (Ping timeout: 240 seconds) |
04:13:56 | * | ikan-keli_ joined #nim |
04:19:46 | * | uvegbot quit (Ping timeout: 240 seconds) |
04:23:22 | * | uvegbot joined #nim |
04:26:41 | rayman22201 | boop |
04:32:55 | * | hax-scramper quit (Ping timeout: 260 seconds) |
04:36:41 | * | Hideki_ joined #nim |
04:36:47 | * | hax-scramper joined #nim |
04:41:14 | * | Hideki_ quit (Ping timeout: 258 seconds) |
04:48:31 | * | nsf joined #nim |
05:04:04 | * | nixfreak quit (Ping timeout: 265 seconds) |
05:16:41 | * | marmotini_ joined #nim |
05:18:12 | * | hax-scramper quit (Read error: Connection reset by peer) |
05:18:30 | * | hax-scramper joined #nim |
05:25:15 | * | hax-scramper quit (Read error: Connection reset by peer) |
05:25:59 | * | hax-scramper joined #nim |
05:26:26 | * | xet7 quit (Excess Flood) |
05:27:08 | * | xet7 joined #nim |
05:38:30 | Zevv | boopBot? |
05:45:21 | disruptek | zevv is a blue function person, too. |
05:45:46 | disruptek | born to blue. |
05:48:16 | Zevv | only my pointers are blue sometimes |
05:49:23 | Zevv | "Ins Blaue hinein" |
05:49:56 | disruptek | who wants to write me a new irc client? |
05:50:24 | disruptek | zevv come talk on the stream. |
05:51:14 | disruptek | zevv, are you sick? |
05:58:30 | * | leorize joined #nim |
06:02:44 | opal | im trying to write myself one |
06:03:00 | disruptek | are you? |
06:03:02 | disruptek | where is it? |
06:12:07 | leorize | !eval echo "~motd is \n~motd" |
06:12:10 | NimBot | ~motd is β΅~motd |
06:24:57 | * | narimiran joined #nim |
06:42:31 | disruptek | ~choosenim |
06:42:32 | disbot | choosenim: 11https://github.com/dom96/choosenim/releases/tag/v0.5.1 -- disruptek |
06:58:20 | disruptek | !code regex |
06:58:22 | disbot | https://github.com/nim-lang/Nim/blob/6900da314ccd8c3f97dbeb340858b870bccadc89/lib/impure/nre.nim -- 11lib/impure/nre.nim 7& 20 more... |
07:01:00 | rayman22201 | It's 2am for you @disruptek! don't you need sleep lol? |
07:02:03 | disruptek | AMAZON |
07:02:25 | disruptek | !code AWS_SECRET |
07:02:26 | disbot | no results π’ |
07:02:36 | disruptek | !code 8675309 |
07:02:37 | disbot | no results π’ |
07:02:45 | disruptek | !code SECRET |
07:02:46 | disbot | https://github.com/nim-lang/Nim/blob/9ea55eccbbc61c6e7429c094b6ced41ce5535aeb/tests/compilerapi/myscript.nim -- 11tests/compilerapi/myscript.nim 7& 5 more... |
07:03:55 | disruptek | rayman22201: for what? |
07:06:21 | * | LER0ever quit (Ping timeout: 265 seconds) |
07:07:35 | * | LER0ever joined #nim |
07:08:52 | * | chemist69 quit (Ping timeout: 252 seconds) |
07:09:57 | * | chemist69 joined #nim |
07:10:11 | * | Guest59306 quit (Ping timeout: 260 seconds) |
07:13:15 | * | hax-scramper quit (Ping timeout: 240 seconds) |
07:14:23 | * | LER0ever quit (Ping timeout: 260 seconds) |
07:15:10 | * | hax-scramper joined #nim |
07:16:18 | * | dwdv joined #nim |
07:17:11 | * | marmotini_ quit (Remote host closed the connection) |
07:18:10 | * | hax-scramper quit (Read error: Connection reset by peer) |
07:18:22 | * | hax-scramper joined #nim |
07:19:33 | * | LER0ever joined #nim |
07:24:47 | * | dadada joined #nim |
07:25:11 | * | dadada is now known as Guest5453 |
07:27:32 | * | hax-scramper quit (Read error: Connection reset by peer) |
07:27:45 | * | hax-scramper joined #nim |
07:27:51 | * | solitudesf joined #nim |
07:33:25 | * | Guest5453 quit (Ping timeout: 265 seconds) |
07:34:32 | * | hax-scramper quit (Read error: Connection reset by peer) |
07:34:45 | * | hax-scramper joined #nim |
07:34:58 | * | dadada_ joined #nim |
07:38:20 | * | solitudesf quit (Ping timeout: 258 seconds) |
07:46:45 | disruptek | ~bentley is https://imgur.com/gallery/yEXiWWG |
07:46:46 | disbot | bentley: 11https://imgur.com/gallery/yEXiWWG |
07:46:46 | disbot | bentley: 11a good boy |
07:48:52 | * | dadada_ quit (Ping timeout: 255 seconds) |
07:50:11 | * | dadada_ joined #nim |
07:54:04 | disruptek | !repo nim |
07:54:06 | disbot | https://github.com/nim-lang/Nim -- 9Nim: 11Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority). 15 8951β 971π΄ 7& 29 more... |
07:54:09 | disruptek | !repos nim |
07:54:11 | disbot | https://github.com/nim-lang/Nim -- 9Nim: 11Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority). 15 8951β 971π΄ |
07:54:11 | disbot | https://github.com/nim-lang/nimble -- 9nimble: 11Package manager for the Nim programming language. 15 648β 120π΄ |
07:54:11 | disbot | https://github.com/dom96/jester -- 9jester: 11A sinatra-like web framework for Nim. 15 907β 94π΄ 7& 27 more... |
07:55:27 | disruptek | !repos nitter |
07:55:28 | disbot | https://github.com/zedeus/nitter -- 9nitter: 11Alternative Twitter front-end 15 747β 22π΄ |
07:57:17 | * | fanta1 joined #nim |
07:58:43 | * | clemens3 quit (Ping timeout: 260 seconds) |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:03:58 | * | PMunch joined #nim |
08:04:01 | * | dadada_ quit (Ping timeout: 258 seconds) |
08:04:58 | * | dadada joined #nim |
08:05:11 | * | gmpreussner joined #nim |
08:05:22 | * | dadada is now known as Guest84828 |
08:11:38 | PMunch | What is the difference between an expr and a stmt in the AST? |
08:14:53 | livcd | does choosenim work like rvm ? it can manage the nim installations ? |
08:15:05 | livcd | eg. you choose devel and it adds the devel to your $PATH ? |
08:15:24 | narimiran | isn't that its main purpose? |
08:17:29 | PMunch | Yup |
08:17:37 | PMunch | That is pretty much all it does :P |
08:17:43 | PMunch | Well, it also updates |
08:18:59 | * | Guest84828 quit (Ping timeout: 272 seconds) |
08:19:58 | * | dadada_ joined #nim |
08:21:54 | shashlick | Choosenim does not fiddle with path, it creates shims that point to the right Nim version |
08:25:58 | * | solitudesf joined #nim |
08:26:32 | * | hax-scramper quit (Read error: Connection reset by peer) |
08:26:45 | * | hax-scramper joined #nim |
08:31:25 | * | hax-scramper quit (Ping timeout: 265 seconds) |
08:33:40 | Araq | PMunch: an expr returns a value, a stmt doesn't |
08:33:43 | * | dadada_ quit (Ping timeout: 260 seconds) |
08:33:56 | PMunch | Aha |
08:35:06 | * | dadada_ joined #nim |
08:37:18 | PMunch | What happens if you create an nnkIfStmt with nnkElifExpr children? |
08:37:24 | PMunch | Or the other way around? |
08:38:10 | * | Hideki_ joined #nim |
08:40:17 | * | hax-scramper joined #nim |
08:41:42 | Araq | who knows :-) |
08:41:51 | PMunch | Hmm, a nnkIfStmt still seems to returns a value.. |
08:42:07 | PMunch | And mixing the different kinds doesn't seem to have any weird effects |
08:42:27 | * | Hideki_ quit (Ping timeout: 240 seconds) |
08:43:00 | * | floppydh joined #nim |
08:48:52 | * | dadada_ quit (Ping timeout: 258 seconds) |
08:50:01 | * | dadada_ joined #nim |
08:50:55 | * | alexander92 joined #nim |
08:51:18 | alexander92 | oh good morning! |
08:51:33 | alexander92 | guys, irc and gitter are not synced again |
08:51:47 | alexander92 | i see different histories on both going a day back |
08:55:17 | * | fanta1 quit (Quit: fanta1) |
09:02:16 | * | luis__ joined #nim |
09:02:17 | * | luis__ quit (Remote host closed the connection) |
09:03:32 | * | marmotini_ joined #nim |
09:03:48 | * | dadada_ quit (Ping timeout: 265 seconds) |
09:04:30 | PMunch | Uhm, am I blind? http://ix.io/2cNA |
09:04:34 | PMunch | That should work right? |
09:04:56 | * | dadada joined #nim |
09:05:20 | * | dadada is now known as Guest75321 |
09:05:34 | * | marmotini_ quit (Read error: Connection reset by peer) |
09:05:38 | * | marmotin_ joined #nim |
09:05:52 | PMunch | Fully qualifying it like so: result = newTree(NimNodeKind.nnkExceptBranch) just leads to Error: cannot generate VM code for nnkExceptBranch |
09:05:57 | * | marmotin_ quit (Remote host closed the connection) |
09:06:25 | * | marmotini_ joined #nim |
09:06:41 | * | marmotini_ quit (Remote host closed the connection) |
09:06:47 | * | marmotini_ joined #nim |
09:12:09 | PMunch | NVM, I'm an idiot.. |
09:12:17 | PMunch | I had a proc named nnkExceptBranch -_- |
09:12:41 | PMunch | That error message could be improved though.. |
09:14:05 | PMunch | Minimal example, should I report this? https://play.nim-lang.org/#ix=2cNG |
09:15:31 | * | marmotini_ quit (Remote host closed the connection) |
09:15:52 | alexander92 | you're not an idiot |
09:15:57 | alexander92 | what are you working on |
09:15:57 | * | marmotini_ joined #nim |
09:19:02 | * | lritter joined #nim |
09:19:16 | * | Guest75321 quit (Ping timeout: 265 seconds) |
09:19:58 | * | dadada_ joined #nim |
09:20:40 | * | marmotini_ quit (Ping timeout: 255 seconds) |
09:21:35 | PMunch | Damn it, GitHub says that my browser is doing something unexpected when I try to submit the issue.. |
09:21:45 | PMunch | I'm working on an improvement to the macros module |
09:22:04 | PMunch | Or rather a new module that should hopefully make macros easier to write :) |
09:25:29 | PMunch | Hmm, apparently my browser was doing something. Submitting from Chromium worked: https://github.com/nim-lang/Nim/issues/13518 |
09:25:31 | disbot | β₯ Improve error message on name collision ; snippet at 12https://play.nim-lang.org/#ix=2cNL |
09:25:56 | * | marmotini_ joined #nim |
09:29:01 | FromDiscord | <Rika> what modules make macros easier to read? |
09:30:09 | PMunch | The one I'm writing now :) |
09:30:20 | PMunch | It does both |
09:31:23 | * | marmotini_ quit (Remote host closed the connection) |
09:31:49 | * | marmotini_ joined #nim |
09:31:52 | * | marmotini_ quit (Remote host closed the connection) |
09:31:59 | * | marmotini_ joined #nim |
09:33:43 | FromDiscord | <Rika> other than yours π |
09:33:55 | * | dadada_ quit (Ping timeout: 260 seconds) |
09:34:38 | PMunch | None that I know of, which is why I'm writing my own :P |
09:34:54 | PMunch | The biggest boost in readability for macros came with "quote do" IMO |
09:34:57 | * | dadada_ joined #nim |
09:36:00 | PMunch | But it's not perfect, still need to create a lot of identifiers outside the quote block most of the time. And it's not capable of building a tree properly |
09:36:17 | PMunch | Well, not building in one piece at a time |
09:37:20 | PMunch | For example you can't do "result.add(quote do: of 100: something)" to add an `of` to a `case` block. |
09:38:09 | FromDiscord | <Rika> also add "template-like ident creation" to your package |
09:38:27 | PMunch | "template-like ident creation"? |
09:38:40 | FromDiscord | <Rika> like \`anIdentNode =` to make a setter proc from a getter proc name |
09:39:03 | FromDiscord | <Rika> i dont remember what it's called one moment |
09:39:23 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#templates-identifier-construction |
09:41:00 | PMunch | Ah yes, that is what I was talking about when I said you still need to create identifiers manually for quote |
09:41:53 | PMunch | I mean the package so far is just easier node creation and modification |
09:42:03 | FromDiscord | <Rika> thats already a win in my book |
09:42:07 | PMunch | Just basic Nim stuff |
09:42:33 | PMunch | But I want to create a more powerful "quote" as well.. Although the original is written with magic, so it might be difficult.. |
09:42:39 | FromDiscord | <Rika> so many `newNimNode` and `add` calls i swear |
09:42:55 | PMunch | Mhm, that's what I'm trying to get rid of |
09:43:21 | FromDiscord | <Rika> is it public now? |
09:44:14 | PMunch | Not quite yet |
09:44:29 | alexander92 | hmm |
09:45:09 | PMunch | Another thing I want to get rid of: impls[0][6][2][1][1].add |
09:45:21 | PMunch | That's an example from my protobuf package.. |
09:45:26 | alexander92 | i attempted to fix the newTree thing like that but its much less general https://github.com/alehander92/breeze |
09:45:34 | alexander92 | very interested to see that |
09:45:36 | * | hax-scramper quit (Read error: Connection reset by peer) |
09:45:59 | alexander92 | PMunch, for [0][6][2] i think pattern matching is reasonable solution |
09:46:08 | * | hax-scramper joined #nim |
09:46:30 | * | hax-scramper quit (Read error: Connection reset by peer) |
09:46:34 | alexander92 | or just reasonable getter names similar to the nkProcDef ones |
09:46:50 | * | hax-scramper joined #nim |
09:47:07 | alexander92 | e.g. i didnt know for a long time that i can do e.g. `.pragma` etc |
09:47:16 | PMunch | alexander92, that's similar to what I'm doing, just without a DSL. |
09:47:17 | alexander92 | `.name` etc |
09:47:42 | PMunch | And yeah for the indexes thing that's basically what I'm doing |
09:47:48 | PMunch | Just writing accessors for pretty much everything |
09:49:01 | * | dadada_ quit (Ping timeout: 255 seconds) |
09:50:02 | * | dadada_ joined #nim |
09:50:43 | PMunch | Just to whet your appetite a bit, this is an example of what it looks like now: http://ix.io/2cNR/nim |
09:51:43 | PMunch | I'm not thrilled about the upper case procedure names to create nodes, but it does kinda match how you create objects, and it avoids colliding with various names in Nim |
09:52:33 | PMunch | And here is the signature for CaseStmt: proc CaseStmt*(cond: NimNode, branches: varargs[NimNode]): NimNode |
09:52:54 | PMunch | As you can see the `cond` and `branches` arguments to that matches the accessor names |
09:53:09 | alexander92 | yeah this makes sense |
09:53:19 | alexander92 | this is a more general problem i think with trees |
09:53:21 | PMunch | (and it checks that the branches are valid NimNode kinds) |
09:53:26 | alexander92 | often its easier to have `children` seq |
09:53:30 | PMunch | Yeah, trees are a pain to work with |
09:53:34 | alexander92 | but to also have names for each one |
09:53:44 | alexander92 | to be able to both use many tree/functional/loop methods on them |
09:53:52 | alexander92 | but also to access them reasonably |
09:53:53 | PMunch | Oh for sure, I understand why NimNodes are designed that way, but they are terrible to work with |
09:54:15 | alexander92 | maybe we can make it for both |
09:54:36 | PMunch | Just look at the code for protobuf, the amount of [0][6][2][1][1] is crazy |
09:54:46 | PMunch | Makes it really hard to read |
09:55:06 | alexander92 | like in general a case object with children seq can have a way to signify name alternatives for many enum cases without changing the layout |
09:55:36 | alexander92 | but maybe just defining getters/setters is enough |
09:56:30 | PMunch | That's pretty much exactly what I'm doing |
09:57:01 | PMunch | Here is an example for the "body" setter: http://ix.io/2cNT/nim |
09:57:32 | PMunch | As you can see depending on the node it will set the correct element, and if it isn't a valid node for "body" it will throw an error |
09:58:59 | * | abm joined #nim |
09:59:44 | FromDiscord | <Rika> ahhhh, how do i use a DELIMITER or a BEGIN END on db_mysql? |
09:59:55 | PMunch | And for example `branches` that returns multiple nodes instead returns a special "Slice" object that implements `[]` and `[]=` to do bound checking and works on the actual node object: http://ix.io/2cNU/nim |
10:02:51 | * | hax-scramper quit (Ping timeout: 260 seconds) |
10:03:02 | * | hax-scramper joined #nim |
10:03:39 | * | dadada_ quit (Ping timeout: 240 seconds) |
10:04:04 | PMunch | I also want to create a "reverse quote" thing. Kinda like what ast_pattern_matching does, just without the special syntax |
10:04:57 | * | dadada joined #nim |
10:05:03 | PMunch | So many times I just want to check if my input is following a certain pattern that I set for it, and then extract certain elements. But exhaustive checking is a pain to write.. |
10:05:21 | * | dadada is now known as Guest71354 |
10:05:24 | PMunch | So many macros are left with some weird undefined behaviour if you do strange things with them |
10:07:03 | * | solitudesf quit (Ping timeout: 260 seconds) |
10:11:59 | * | marmotini_ quit (Remote host closed the connection) |
10:12:26 | * | marmotini_ joined #nim |
10:13:35 | Araq | doesn't match my experience |
10:14:00 | PMunch | Which part? |
10:14:02 | Araq | it's hardly "Undefined behaviour", it's "bad error messages" |
10:14:21 | Araq | which was mitigated by --expandMacro for version 1 |
10:15:32 | PMunch | Well it depends, a DSL where some part isn't properly checked can end up removing code for example |
10:15:52 | Araq | macros have their downsides but so far no other viable design allows us a smallish core language which supports tensordsl, lexer and parser generators, jester, ormin, karax, you-name-it |
10:16:12 | PMunch | So in the DSL it looks like you're adding something, but that node gets dropped by the macro, and the macro doesn't check that there shouldn't be a node there, so it doesn't complain |
10:16:30 | Araq | "dropped"? |
10:16:49 | PMunch | Oh don't get me wrong, I love macros :) I just want to make them a bit easier to create and maintain |
10:16:50 | * | marmotini_ quit (Ping timeout: 240 seconds) |
10:16:55 | Araq | can't remember a macro that dropped anything in practice |
10:17:09 | Araq | I mean |
10:17:19 | Araq | it can drop stuff if that's what it really needs to do |
10:18:09 | Araq | but sure, improve macros, I don't mind :-) |
10:18:37 | Araq | I'm also waiting for dadada's RFC |
10:18:43 | * | Guest71354 quit (Ping timeout: 255 seconds) |
10:18:44 | PMunch | Well, take a macro that reads a procedure and does something to it. It might not check that you haven't put anything in the pragmas field, and it's not copying those over, so now you have a macro that silently removes pragmas by accident |
10:19:02 | PMunch | This will likely be it's own package for now though |
10:19:08 | FromDiscord | <Rika> still struggling with the BEGIN END statements on db_mysql, does anyone mind helping? |
10:19:55 | Araq | PMunch, well yeah, but --expandMacro does show this problem |
10:19:58 | * | dadada_ joined #nim |
10:20:54 | PMunch | Oh yeah, for sure |
10:21:00 | PMunch | But it might still be confusing |
10:21:21 | PMunch | By the way, would it be possible to have --expandMacro print out the macro even when it has an error? |
10:22:11 | PMunch | I tend to throw in the good 'ol `echo result.repr` at the end of my macros anyways because expandMacro doesn't work if it returns an invalid AST |
10:30:37 | * | hax-scramper quit (Read error: Connection reset by peer) |
10:31:03 | * | hax-scramper joined #nim |
10:34:07 | * | dadada_ quit (Ping timeout: 260 seconds) |
10:34:57 | * | dadada_ joined #nim |
10:35:43 | FromDiscord | <exelotl> Oh yeah my project also has macros that assume free reign over the pragmas section |
10:37:06 | FromDiscord | <exelotl> I guess I should just check for existing pragmas and give an error message... But yeah such checking becomes tedious and it's hard to know you haven't forgotten to check something |
10:37:28 | FromDiscord | <exelotl> So yeah I definitely feel you pmunch |
10:38:39 | * | clemens3 joined #nim |
10:39:42 | * | Hideki_ joined #nim |
10:40:20 | alexander92 | PMunch i am not sure why not just improving pattern matching |
10:40:36 | alexander92 | better than having several incompatible matching-like things |
10:43:00 | FromDiscord | <Rika> is there a library for interpreting strings as mathematical equations or something? |
10:43:32 | * | marmotini_ joined #nim |
10:43:46 | * | Hideki_ quit (Ping timeout: 240 seconds) |
10:44:16 | FromDiscord | <Rika> nevermind |
10:47:12 | * | Hideki_ joined #nim |
10:48:26 | * | dadada_ quit (Ping timeout: 240 seconds) |
10:49:58 | * | dadada_ joined #nim |
10:59:58 | * | fanta1 joined #nim |
11:03:43 | * | dadada_ quit (Ping timeout: 255 seconds) |
11:04:59 | * | dadada joined #nim |
11:05:22 | * | dadada is now known as Guest35427 |
11:18:27 | * | Guest35427 quit (Ping timeout: 240 seconds) |
11:19:58 | * | dadada_ joined #nim |
11:25:09 | m4r35n357 | is there an equivalent for floats of ** in Python (I know ^ isn't it!), or do I use eg. x * x for square? Struggling to find definitions in the manual of operators on floats . . . |
11:28:39 | * | marmotini_ quit (Remote host closed the connection) |
11:28:47 | * | marmotini_ joined #nim |
11:31:59 | * | my_dude joined #nim |
11:34:12 | alexander92 | Rika i think there was |
11:34:13 | alexander92 | actually |
11:34:29 | * | tribly quit (Quit: WeeChat 2.7.1) |
11:34:36 | alexander92 | something like parse expr |
11:41:09 | * | tribly joined #nim |
11:44:33 | * | fanta1 quit (Quit: fanta1) |
11:45:49 | FromDiscord | <Rika> alexander92 i already found it |
11:45:57 | FromDiscord | <Rika> and i need them at runtime so xd |
11:46:11 | FromDiscord | <Rika> m4r35n357 what do you mean "floats of **" |
11:47:43 | FromDiscord | <Rika> m4r35n357 there's the pow() function |
11:49:15 | * | Hideki_ quit (Ping timeout: 272 seconds) |
11:52:43 | * | opal quit (Ping timeout: 240 seconds) |
11:55:55 | * | opal joined #nim |
11:59:12 | m4r35n357 | FromDiscord, in Python, x**2 = x * x, in some languages, x^2 = x * x. Does nim have an equivalent of X**2 or X^2 ? HTH explain better . . . |
11:59:22 | alexander92 | eeh ! https://github.com/Yardanico/nim-mathexpr |
11:59:30 | alexander92 | maybe this ? by Yardanico |
12:00:01 | m4r35n357 | I know there is a power function, that is something different again |
12:01:05 | * | krux02 joined #nim |
12:02:58 | FromDiscord | <Rika> alexander92, yes thats the library i found |
12:03:10 | FromDiscord | <Rika> m4r35n357, i fail to see the difference |
12:03:27 | FromDiscord | <Rika> between x.pow 2 and what you describe as x ** 2 |
12:04:08 | FromDiscord | <Rika> or do you want compile-time optimization, because i think GCC handles that already |
12:07:18 | m4r35n357 | FromDiscord, forget it, then, I can't put it any clearer . . . . |
12:07:53 | m4r35n357 | OK pow is a float function, ** and ^ can be integer operations |
12:08:33 | m4r35n357 | shorthand for x * x, see, I can only repeat myself now |
12:09:06 | m4r35n357 | I'll just use x * x . . . |
12:10:25 | m4r35n357 | OK another way, pow(x, a) is a two argument function, sqr(x) is a single argument |
12:10:57 | narimiran | yeah, use x*x and call it a day |
12:11:02 | m4r35n357 | yep |
12:11:12 | m4r35n357 | quicker than all this typing ;) |
12:12:13 | narimiran | m4r35n357: btw, when your python translation is in some semi-ready state, share a code with us :) |
12:12:28 | m4r35n357 | it is ready I think |
12:12:49 | narimiran | m4r35n357: then https://play.nim-lang.org/ is ready for your share :) |
12:13:05 | m4r35n357 | I have a small module doing automatic differentiation recurrences, and a test client |
12:13:23 | m4r35n357 | not all tested, but it si ported from working code in two languages . . . |
12:14:07 | m4r35n357 | The Python and c originals are here: https://github.com/m4r35n357/ODE-Playground |
12:14:17 | m4r35n357 | I'll have a look at the playgroind . . |
12:14:32 | m4r35n357 | that sounded weird ;) |
12:17:26 | m4r35n357 | narimiran, I think I am incompatible with https://play.nim-lang.org/ |
12:18:04 | narimiran | you might not be able to run it, but you can still use it as a code-share site |
12:18:22 | m4r35n357 | My current code is in two files. I tried putting the previous single-file version up, but couldn't see any place to put command line parameters . . . am I missing something? |
12:18:30 | narimiran | (oh, it is not one file, i see now) |
12:18:51 | FromDiscord | <Rika> playground doesnt allow for any input |
12:18:51 | m4r35n357 | https://play.nim-lang.org/#ix=2cOd |
12:19:33 | * | Guest11 joined #nim |
12:19:46 | m4r35n357 | that is the single file version, compile/run with: nim compile --run test.nim 16 10 .01 10 -15.8 -17.48 35.64 10 28 8 3 |
12:19:58 | narimiran | what i immediately see (other than "i come from python and use 4 spaces" :P) is: you can use `float` instead of `float64` if you want, those two are the same |
12:20:14 | m4r35n357 | putting two file version up next, same command line |
12:20:20 | narimiran | `for k in 0..n-1` --> `for k in 0 ..< n` |
12:21:23 | narimiran | btw, do you know about `-d:release`? i don't see it in your command there, and you might want to compare execution speeds at some point |
12:21:46 | m4r35n357 | module: https://play.nim-lang.org/#ix=2cOe |
12:21:53 | FromDiscord | <Rika> ~~i await the day that --gc:arc or orc become default~~ |
12:22:33 | m4r35n357 | client: https://play.nim-lang.org/#ix=2cOf |
12:23:05 | m4r35n357 | narimiran, I have done some preliminary comparisons to c (Python is nowhere!) |
12:23:12 | m4r35n357 | but not in release mode yet |
12:23:20 | m4r35n357 | only just got it all written ;) |
12:24:15 | m4r35n357 | narimiran, yep looks like about a million ways to do the looping ranges ;) not decided yet! |
12:24:43 | narimiran | it is easy to decide `foo .. bar-1` is ugly :D |
12:25:37 | * | marmotini_ quit (Remote host closed the connection) |
12:25:37 | m4r35n357 | ugly but obvious! |
12:26:03 | * | marmotini_ joined #nim |
12:26:09 | Araq | most obvious is ..< esp if you come from Python with it's exclusive ranges |
12:26:14 | Araq | *its |
12:27:09 | m4r35n357 | yep, million ways in Python too ;) |
12:28:06 | m4r35n357 | OK speed test . . . |
12:28:34 | m4r35n357 | time -p ./test 16 10 .01 1000000 -15.8 -17.48 35.64 10 28 8 3 >/tmp/data -- real 5.43 |
12:28:37 | * | Guest11 quit (Remote host closed the connection) |
12:28:39 | m4r35n357 | that was nim |
12:29:00 | FromDiscord | <Rika> how about C? |
12:29:04 | m4r35n357 | time -p ./tsm-lorenz-dbg 16 10 .01 1000000 -15.8 -17.48 35.64 10 28 8 3 >/tmp/data -- c with MPFR |
12:29:15 | FromDiscord | <Rika> where's the time? |
12:29:33 | m4r35n357 | OK pardon that was c with long double precision (80 bits) |
12:29:39 | m4r35n357 | oops |
12:30:03 | m4r35n357 | OK that was 3.87 for c with long double (accelerated) |
12:30:18 | FromDiscord | <Rika> considering nim doesnt have any optimizations i dont think... |
12:30:21 | m4r35n357 | so, 5.43 for nim, 3.87 for c |
12:30:26 | FromDiscord | <Rika> rather, accelerated ops |
12:30:29 | m4r35n357 | so not too shabby for nim |
12:30:30 | narimiran | did you use `-d:release` for nim? |
12:30:36 | m4r35n357 | yes |
12:30:44 | narimiran | if you did, now you try also `-d:release -d:danger` and report back :) |
12:30:47 | * | marmotini_ quit (Ping timeout: 260 seconds) |
12:31:02 | FromDiscord | <Rika> danger is dangerous tho ofc so tread with caution? |
12:31:02 | PMunch | alexander92, well the reason I want to do it differently is just because I remember using ast_pattern_match and while it worked great I just didn't like the way it was set up. Might just be me though.. |
12:31:17 | m4r35n357 | 14.39 for debug mode |
12:31:30 | narimiran | @Rika it is the same amount of "danger" as release build in earlier nim versions |
12:31:34 | FromDiscord | <Rika> debug is really slow really |
12:31:47 | m4r35n357 | the code is a simple and similar as i can make it, so I think it is certainly a fair comparison for my application |
12:31:54 | FromDiscord | <Rika> narimiran, i always thought it was dangerous to the point of "can crash a pc when theres a fault" |
12:32:39 | FromDiscord | <Rika> m4r35n357, try including d:danger to disable some (?) checks on runtime |
12:33:02 | m4r35n357 | FromDiscord, so nim unaccelerated is nearly as fast as c, are you sure? |
12:33:15 | FromDiscord | <Rika> hmm? i didnt claim that? |
12:33:22 | m4r35n357 | danger as well as release |
12:33:48 | FromDiscord | <Rika> how's the time? |
12:33:58 | FromDiscord | <Rika> still ~2x slow? |
12:34:16 | narimiran | 1.4x is not 2x |
12:34:30 | m4r35n357 | nim compile -d:release -d:danger test.nim -- real 5.22 |
12:34:48 | FromDiscord | <Rika> narimiran, i'm bad at estimating sorry |
12:34:52 | m4r35n357 | hardly much quicker than just release |
12:34:53 | narimiran | oh, i expected a bit bigger difference |
12:35:17 | narimiran | m4r35n357: now let me tell you the best optimizing trick in nim |
12:35:33 | * | Cadey is now known as Xena |
12:35:42 | narimiran | it is only two words, and it works miraculously, are you ready? |
12:35:43 | m4r35n357 | OK . . . . |
12:35:43 | * | Xena is now known as Cadance |
12:35:49 | narimiran | "ping @mratsim" |
12:35:50 | * | Cadance is now known as JohnMadden |
12:35:56 | * | JohnMadden is now known as shadowh511 |
12:35:59 | * | shadowh511 is now known as Cadey |
12:36:11 | FromDiscord | <Rika> you just did tho |
12:36:17 | m4r35n357 | is that like Beetlejuice three times? |
12:36:19 | narimiran | yep |
12:36:23 | PMunch | Haha :P |
12:36:41 | narimiran | it is the best optimizer ever, it usually gives my programs at least 2x boost |
12:36:42 | m4r35n357 | well I'll run if I need to and leave you guys to pick up the pieces . . |
12:36:55 | m4r35n357 | ping @mratsim |
12:36:57 | PMunch | You can try the different gc's as well with --gc:<gcname>. For certain jobs some of them are considerably faster than others |
12:37:05 | FromDiscord | <Rika> HAHAHAHA the madman actually did it |
12:37:08 | m4r35n357 | sounds like a FORTRAN routine ;) |
12:37:33 | m4r35n357 | I can leave anytime . . . ;) |
12:39:10 | m4r35n357 | PMunch, I don't do a lot of allocation, my arrays are all preallocated and last the lifetime of the program. So I don't see much work for the GC |
12:39:23 | * | my_dude quit (Quit: ZZZzzzβ¦) |
12:39:58 | FromDiscord | <Rika> you're using sequences so theyre resizable |
12:41:03 | FromDiscord | <Rika> hmm |
12:41:05 | m4r35n357 | FromDiscord, I am only using them to allow me to use variable array parameters. If there is a better way I am all ears! |
12:41:07 | FromDiscord | <Rika> i read the c implementation now |
12:41:42 | narimiran | m4r35n357: FromDiscord is a bot, user you want to mention is: Rika |
12:41:43 | m4r35n357 | FromDiscord, on GitHub? that is MPFR code, |
12:42:02 | FromDiscord | <Rika> yeah, the taylor_smthsmth code |
12:42:10 | FromDiscord | <Rika> and the tsm_lorentz code |
12:42:12 | m4r35n357 | Rika I can push the long double branch of you want |
12:42:40 | FromDiscord | <Rika> size really isnt known on compiletime no? |
12:42:42 | m4r35n357 | Rika pull the double branch |
12:43:01 | m4r35n357 | Rika size is a command line parameter |
12:43:28 | m4r35n357 | the MPFR version can easily handle hundredth-order Taylos series ;) |
12:43:39 | m4r35n357 | Taylor i MEAN |
12:44:25 | FromDiscord | <Rika> hmm, other nim peoplel, you think --gc:arc can handle this in the state it's in right now? |
12:44:37 | narimiran | one way to find out.... ;) |
12:45:12 | FromDiscord | <Rika> okay m4r35n357, so try compiling and using nim's devel branch then add `--gc:arc` to the parameters in compiling |
12:45:31 | FromDiscord | <Rika> --gc:arc needs devel no? |
12:45:37 | narimiran | yep |
12:46:30 | m4r35n357 | Rika I am using a binary tarball for the latest nim, not set up for source building yet |
12:46:41 | FromDiscord | <Rika> uh |
12:46:46 | narimiran | m4r35n357: what does `nim -v` output for you? |
12:46:50 | FromDiscord | <Rika> do you have choosenim? |
12:48:04 | m4r35n357 | Rika /opt/Nim/nim-1.0.6/bin/nim -v -- Nim Compiler Version 1.0.6 [Linux: amd64] -- Compiled at 2020-01-23 |
12:48:06 | * | rockcavera joined #nim |
12:48:17 | narimiran | ah, no `arc` for you |
12:48:54 | m4r35n357 | well I can look into the source build, but it might not be quick . . . . |
12:49:23 | FromDiscord | <Rika> it takes me like a few minutes on a server cpu (only on one core though) |
12:49:32 | m4r35n357 | OK let me see . . . |
12:49:48 | * | endragor quit (Remote host closed the connection) |
12:50:08 | FromDiscord | <Rika> it takes 30 minutes running on github actions lol |
12:52:56 | m4r35n357 | building . . . |
12:53:25 | m4r35n357 | wonder if it builds on ARM . . . |
12:54:34 | FromDiscord | <Rika> oh arm. |
12:54:37 | FromDiscord | <Rika> ._. |
12:54:52 | FromDiscord | <Rika> no clue, thanks for testing π |
12:55:11 | * | tane joined #nim |
12:55:16 | PMunch | m4r35n357, I would really reccomend using choosenim |
12:55:29 | PMunch | Then you could just do "choosenim devel" and it would install it for you |
12:55:49 | PMunch | And when you want to go back just "choosenim stable" |
12:55:54 | alexander92 | building it is very quick still |
12:56:00 | PMunch | And when a new version drops "choosenim update stable" |
12:56:04 | alexander92 | but yeah |
12:57:26 | * | marmotini_ joined #nim |
12:57:46 | m4r35n357 | PMunch, I like to control my own computer where possible ;) I still have the Ubuntu 18.04 nim (0.17.2) |
12:58:21 | PMunch | As do I, but using a tools still leave you in control :) |
12:58:39 | PMunch | Ugh, those should just be removed.. |
12:58:46 | m4r35n357 | all in good time, I am currently building nim and making lunch! |
13:01:42 | m4r35n357 | OK built |
13:02:03 | m4r35n357 | Nim Compiler Version 1.1.1 [Linux: amd64] |
13:02:32 | m4r35n357 | on devel branch |
13:04:26 | * | uvegbot quit (Ping timeout: 240 seconds) |
13:04:40 | FromDiscord | <Rika> that's correct |
13:06:35 | * | m4r35n357 wonders if float80 would be a possibility . . . ? |
13:10:27 | FromDiscord | <Rika> prolly, nim does compile to c after all |
13:13:09 | m4r35n357 | Rika /opt/Nim/Nim/bin/nim compile -d:release -d:danger -gc:arc test.nim -- command line(1, 2) Error: 'on' or 'off' expected, but 'arc' found |
13:13:56 | narimiran | --gc:arc, two of -'s |
13:14:14 | * | a_b_m joined #nim |
13:14:15 | m4r35n357 | ok |
13:14:50 | alexander92 | m4r usually it should be much faster to build if you already has a recent build in the same repo |
13:14:55 | m4r35n357 | real 5.39, as I expected |
13:15:07 | alexander92 | so keep one "development repo" there i guess |
13:15:16 | m4r35n357 | there is probably nothing to collect |
13:15:18 | narimiran | still waiting for mratsim's optimizations ;) |
13:17:14 | FromDiscord | <Rika> hmm interesting so it's not the GC |
13:17:55 | * | abm quit (Ping timeout: 260 seconds) |
13:18:02 | m4r35n357 | Rika are you decsribing a problem? I think nim is in the ballpark all things considered |
13:18:44 | FromDiscord | <Rika> no i'm not |
13:18:55 | * | uvegbot joined #nim |
13:18:56 | FromDiscord | <Rika> i'm thinking of what else would be a bottleneck in your code |
13:19:11 | FromDiscord | <Rika> i really think its just some sort of math optimization or something |
13:20:01 | * | a_b_m quit (Quit: Leaving) |
13:20:36 | m4r35n357 | Rika I don't think there is one, what is it in those figures that worriew you? |
13:20:47 | FromDiscord | <Rika> i dont know honestly |
13:20:56 | PMunch | We're just used to seeing Nim closer to C in speed |
13:21:07 | FromDiscord | <Rika> i was expecting better |
13:21:09 | m4r35n357 | OK |
13:21:09 | FromDiscord | <Rika> yeah |
13:21:12 | PMunch | Especially when the GC is not involved |
13:21:18 | m4r35n357 | I was impressed! |
13:21:32 | FromDiscord | <Rika> it probably is impressive compared to other languages |
13:21:39 | m4r35n357 | I guess it is the compiled c that is the unknown (for me) |
13:21:57 | PMunch | I guess we're just spoilt :P |
13:21:58 | FromDiscord | <Rika> nim has a nimcache that you can look into and see the source c files |
13:22:12 | FromDiscord | <Rika> i dont know where it's stored in linux |
13:22:28 | FromDiscord | <Rika> but its in the user home directory in windows so i presume its also there for linux |
13:22:35 | m4r35n357 | Rika I've looked already, not going there! |
13:22:49 | m4r35n357 | Rikas the nimcache has moved but I can still find it! |
13:22:51 | FromDiscord | <Rika> XD |
13:23:05 | FromDiscord | <Rika> "nope, the code here looks like black magic to me" |
13:23:38 | FromDiscord | <Rika> wait, what if you try this very stupid idea |
13:23:43 | FromDiscord | <Rika> "--gc:none" |
13:23:47 | FromDiscord | <Rika> HAHAHA |
13:24:45 | m4r35n357 | real 5.30 - 1% improvement |
13:25:08 | PMunch | Are you using any particular C flags? |
13:25:31 | PMunch | Or just "gcc test.c -o test" |
13:27:08 | FromDiscord | <Rika> o 3 and lto 9 π |
13:27:10 | m4r35n357 | -03 -DNDEBUG for the (stripped) dynamic and static builds (see build file in project of curious) |
13:31:09 | m4r35n357 | my c is stuffed with asserts, so it is only fair to lose them! |
13:40:42 | m4r35n357 | If you want something to worry about ;) |
13:40:54 | m4r35n357 | time -p ./tsm-lorenz-static 16 10 .01 1000000 -15.8 -17.48 35.64 10 28 8 3 >/tmp/data -- real 2.94 |
13:41:23 | m4r35n357 | the debug build is unoptimized (-O0) |
13:44:44 | m4r35n357 | OK I just noticed the release c is much shorter, I'll dare a quick look . . . |
13:46:36 | FromDiscord | <Rika> heh |
13:46:44 | m4r35n357 | nah, can't work with that ;) |
13:48:47 | m4r35n357 | I wonder, in c all my parameters are pointers (to support array access), but in nim I only used var for things I was actually going to mutate. Maybe copying the other arrays/sequences is responsible? I can put some more vars in and see . . . |
13:51:36 | m4r35n357 | real 5.25 -- small improvement, not really convincing |
13:59:39 | m4r35n357 | If anyone needs cheering up: time -p ./tsm.py lorenz 16 10 .01 1000000 -15.8 -17.48 35.64 10 28 8 3 >/tmp/data -- real 47.09 |
13:59:54 | m4r35n357 | nearly 10 times slower |
14:00:27 | m4r35n357 | and the nim code is shorter |
14:01:20 | Araq | don't use 'var T' for speed please |
14:01:33 | Araq | use it for mutability where required |
14:01:57 | m4r35n357 | Araq, don't panic, it was only for testing ;) |
14:02:13 | m4r35n357 | and it didn't make much difference anyway |
14:02:15 | Araq | the language doesn't work well when you try to outsmart it and the compiler's job is to make idiomatic Nim fast. And we're getting there, slowly. |
14:08:45 | FromDiscord | <clyybber> m4r35n357: Maybe its the echo |
14:08:52 | FromDiscord | <clyybber> I assume you are using printf in C? |
14:09:13 | FromDiscord | <clyybber> You can do `import system/ansi_c` and use `c_printf` instead of echo to test |
14:11:10 | m4r35n357 | clyybber OK I'll try. Incidentally I am writing to a ramdisk so that shouldn't influence the results too much |
14:11:43 | * | clyybber joined #nim |
14:11:53 | narimiran | m4r35n357: are these the expected results for (the single file version) your file http://ix.io/2cOA ? |
14:13:42 | narimiran | because that is what i get when i run with these args: "16 10 .01 10 -15.8 -17.48 35.64 10 28 8 3", and on my machine it takes less than 1ms! |
14:14:01 | m4r35n357 | clyybber can you confirm the import? Error: undeclared identifier: 'printf' |
14:14:04 | FromDiscord | <clyybber> narimiran: I think you are missing a few zeros :p |
14:14:07 | PMunch | m4r35n357, Nim will pass things as pointers if it sees that you aren't mutating them anyways. So you shouldn't worry about using var for speed |
14:14:10 | m4r35n357 | oh, c_+printf |
14:14:15 | FromDiscord | <clyybber> m4r35n357: Yeah : ) |
14:14:53 | m4r35n357 | clyybber Error: type mismatch: got <cint> but expected 'string' |
14:15:16 | narimiran | @clyybber oh, now i see i miss-c/p-ed something |
14:16:34 | narimiran | ok, now i get ~4s |
14:16:45 | narimiran | but if i remove echo on every step, it is 0.3s |
14:18:05 | narimiran | so, m4r35n357, i think we discovered the biggest bottleneck :D |
14:18:54 | m4r35n357 | OK, sounds like progress! |
14:18:57 | * | marmotini_ quit (Remote host closed the connection) |
14:19:20 | m4r35n357 | If I could get this c_printf working I could confirm . .. |
14:19:25 | * | marmotini_ joined #nim |
14:19:43 | narimiran | even if you print every 10th step, it is 0.6s, every 100th and further is 0.3s |
14:19:54 | Araq | with fmt and --gc:arc there should be no need for printf |
14:20:41 | PMunch | What's you problem with printf m4r35n357? |
14:21:19 | narimiran | `echo fmt"{x0} {y0} {z0} {float64(step) * h}"` on every step is still the bottleneck: 4.5s |
14:21:36 | * | nsf quit (Quit: WeeChat 2.7) |
14:21:52 | m4r35n357 | Error: type mismatch: got <cint> but expected 'string' |
14:22:01 | m4r35n357 | so I can't test it myself |
14:22:02 | PMunch | And what code produces that error.. |
14:22:21 | PMunch | I mean that says that your passing a C integer to something that expects a string |
14:22:22 | m4r35n357 | c_printf("%+.12e %+.12e %+.12e %+.6e\n", x, y, z, t); |
14:22:33 | narimiran | every 10th step with `fmt` is 0.6s, as before every 20th is 0.46s, etc. |
14:22:38 | m4r35n357 | must be the formatting . . . ? |
14:23:09 | m4r35n357 | I copied that code from the c version |
14:23:44 | m4r35n357 | but it looks like you can proceed without my help ;) |
14:24:15 | * | marmotini_ quit (Ping timeout: 265 seconds) |
14:24:41 | PMunch | Seems to work fine: https://play.nim-lang.org/#ix=2cOG |
14:24:56 | PMunch | Are you sure you don't have echo c_printf? |
14:25:20 | m4r35n357 | no, just the line I posted here |
14:25:24 | PMunch | c_printf returns a cint, so it might be that you're accidentally passing it to something (or have it as the last statement in a procedure that returns a string) |
14:25:50 | m4r35n357 | I could discard it I suppose ? |
14:26:24 | PMunch | A, t_output returns a string (for some reason) |
14:26:24 | FromDiscord | <clyybber> its {.discardable.} so it implicitly discards |
14:26:30 | m4r35n357 | real 2.56 |
14:26:38 | m4r35n357 | that better? |
14:26:55 | FromDiscord | <clyybber> how much is the C version? |
14:27:00 | PMunch | echo doesn't return anything, so that string will always be "". But with c_printf it tries to implicitly return the cint, which fails because it expects to return a string. |
14:27:33 | PMunch | Hmm, you have multiple places where you declare a return type but without actually returning anything, that might give a little speedup if you remove them |
14:30:07 | PMunch | narimiran, what was you c/p error? I'm also getting 3ms execution time :P |
14:30:14 | m4r35n357 | clyybber debug build: real 3.83, dynamic build non-debug build: real 2.91 |
14:30:31 | narimiran | PMunch: maybe it is not c/p error, but he gave us wrong params the first time ;) |
14:30:31 | * | marmotini_ joined #nim |
14:30:36 | m4r35n357 | I think someone has exceeded the speed of light . . . |
14:30:40 | PMunch | Ah, what are the correct ones? |
14:30:47 | narimiran | PMunch: now i'm running it with "16 10 .01 1000000 -15.8 -17.48 35.64 10 28 8 3" |
14:31:14 | narimiran | that 1 million was 10 ;) |
14:31:21 | m4r35n357 | hey, the only changed parameter is the number of steps, it needs to be high for speed test |
14:31:29 | FromDiscord | <clyybber> narimiran: Told ya :p |
14:31:39 | FromDiscord | <clyybber> pesky zeros |
14:32:17 | m4r35n357 | with 10 you can see the output without scrolling off the page, you would never use it with 10 for anything useful! |
14:33:01 | clyybber | m4r35n357: Now I would remove those return types from the procs |
14:33:08 | clyybber | and make them {.inline.} |
14:33:19 | clyybber | Or even templates |
14:33:27 | m4r35n357 | clyybber I couldn't find out how to not return something, believe me I looked! |
14:33:35 | m4r35n357 | so how's abou7t a hint ;) |
14:33:51 | FromDiscord | <Rika> m4r35n357 just remove the : Type after the () and you have a void proc |
14:33:52 | PMunch | Just don't have a return type? |
14:33:58 | narimiran | you delete everything after `)` and before `=` :D :D |
14:34:08 | clyybber | m4r35n357: proc t_output(x, y, z, y: float64) = ... |
14:34:11 | m4r35n357 | I kept getting errors, tried with/without colons/equals |
14:34:14 | PMunch | http://ix.io/2cOH/nim like so |
14:34:24 | FromDiscord | <Rika> what errors |
14:34:46 | m4r35n357 | OK, pretty sure I tried that, but thanks! |
14:34:58 | PMunch | (using that means you need to remove the "discard" statements from your client as t_output now doesn't return anything) |
14:35:12 | narimiran | PMunch: while at it, is `1.0'f64` needed? |
14:35:12 | PMunch | (not that it ever returned anything other than empty strings though..) |
14:35:19 | m4r35n357 | Rika the sort of errors most people see on theie first day of a language and can't remember ;) |
14:35:36 | narimiran | PMunch: ...escpecially if you do `:%s/float64/float/g` :) |
14:35:37 | PMunch | Uhm, no 1.0 should be a float which should be a float64 on a 64 bit machine |
14:35:40 | m4r35n357 | narimiran, no, I've tried it |
14:35:56 | * | Lord_Nightmare is now known as LordNLptp |
14:35:57 | m4r35n357 | jeez guys I did the hard part ;) |
14:36:03 | * | LordNLptp is now known as LordNAway |
14:36:17 | * | LordNAway is now known as Lord_Nightmare |
14:36:18 | narimiran | m4r35n357: you're new here, you'll learn that we really like stuff like this :D |
14:36:49 | * | Lord_Nightmare is now known as Lord_Nightmare2 |
14:36:57 | * | Lord_Nightmare2 is now known as Lord_Nightmare |
14:37:02 | m4r35n357 | well I am pretty imp[ressed with nim, nearly didn't try it after my experience with Julia! |
14:37:13 | * | solitudesf joined #nim |
14:38:26 | FromDiscord | <Rika> ~~only issue i have with julia is the array index thing tbh~~ |
14:38:46 | m4r35n357 | that taylor library is 60 lines even in Python |
14:39:26 | m4r35n357 | Rika that is a real killer for this work, try to convert taylor.nim to Julia if you want your brain to bleed! |
14:39:56 | FromDiscord | <Rika> no clue on what your issue is with julia |
14:40:06 | m4r35n357 | plus the start-up delays, and the fact that the code thye really use looks nothing like the examples they post to show how simple it all is ;) |
14:40:20 | FromDiscord | <Rika> ohh i see false simplicity lmao |
14:40:50 | FromDiscord | <Rika> ~~nim is true to its word, even when you're doing intermediate shit like macros and such~~ |
14:41:02 | FromDiscord | <Rika> though it's still pretty verbose when you get to writing macros |
14:41:09 | FromDiscord | <clyybber> use breeze |
14:41:16 | m4r35n357 | Rika there is a Julia lobrary called TaylorIntegration.jl, supposedly does pretty much what my lib does, and I cant' even read it! |
14:41:35 | FromDiscord | <Rika> i'd use breeze if i didnt have a massive macro already written |
14:42:13 | m4r35n357 | OK guys AFK for a bit, cheers for the work-out! |
14:42:24 | FromDiscord | <Rika> oh yeah m4r35n357 what should i call you because it's getting tiring copy pasting your name |
14:42:26 | FromDiscord | <Rika> oof |
14:43:30 | m4r35n357 | name's Ian, but the sig says "maresnest" if you quint properly |
14:43:51 | m4r35n357 | I get autocomplete on nicks in XChat . . . ;) |
14:44:51 | PMunch | http://ix.io/2cOJ/nim changed some stuff to templates, made the output only go every 100th time (configurable) and removed some superfluous return types, changed from float64 to float and removed 'f64 (and fixed the indentation). |
14:45:23 | FromDiscord | <Rika> i did read that |
14:45:26 | * | hax-scramper quit (Ping timeout: 240 seconds) |
14:45:33 | FromDiscord | <Rika> but i dont know what your client pings you by |
14:45:33 | narimiran | PMunch: heh, i'm in the middle of doing that.... |
14:45:41 | PMunch | Haha, yeah autocomplete of nicks on IRC is pretty neat :) |
14:45:47 | * | uvegbot quit (Ping timeout: 240 seconds) |
14:45:52 | FromDiscord | <Rika> haha only works on discord mentions |
14:45:53 | * | hax-scramper joined #nim |
14:45:58 | FromDiscord | <Rika> @gitterirc reeeeee |
14:46:18 | narimiran | PMunch, m4r35n357: this is what i currently have: http://ix.io/2cOM |
14:46:42 | narimiran | not sure if `t_sin_cos` and `t_tan_sec2` would be faster this way, without creating a tuple |
14:47:15 | PMunch | Hmm, good question actually |
14:47:15 | m4r35n357 | PMunch, really need to go, but all those lines are needed - the high order integration means you can use reasonable sized steps, and I do! I'll use echo/c_printf as & when I need speed ;) |
14:47:30 | * | uvegbot joined #nim |
14:47:34 | narimiran | m4r35n357: now you need to combine PMunch's ideas with my style fixes and you're ready to go :) |
14:48:08 | PMunch | Maybe slightly, but not much it seems |
14:48:27 | narimiran | PMunch: notice that his other file doesn't use these procs, from what i could tell ;) |
14:48:40 | PMunch | Ah.. |
14:48:49 | PMunch | Oh you need all the output? |
14:48:50 | PMunch | Hmm |
14:49:00 | PMunch | Well in that case it might be hard to optimise any further.. |
14:49:05 | FromDiscord | <clyybber> inline |
14:49:16 | PMunch | Short of building a buffer and then outputting everything at the end |
14:49:20 | PMunch | Which might be faster |
14:49:23 | m4r35n357 | those other functions are used in the c an Python stuff, and to support testing |
14:49:39 | clyybber | PMunch: adding {.inline.} should help |
14:49:43 | narimiran | PMunch: do it (build a buffer). you know you want it! :) |
14:53:28 | PMunch | Oh wow, even the dumbest buffer approach was much faster |
14:53:43 | PMunch | clybber, I'm already mostly using templates.. |
14:54:18 | clyybber | oh |
14:56:58 | PMunch | Is there a way to get the same output as a format string easily in Nim? |
14:57:07 | PMunch | I know I can snprintf, but.. |
14:58:35 | narimiran | PMunch: what do you mean? |
14:58:50 | PMunch | Well I want to use the format string he supplied |
14:59:02 | narimiran | `fmt"{x0} {y0} {z0} {float(step) * h}"`? |
14:59:09 | PMunch | It has constant length, which means I can pre-initialise the buffer to the correct size.. |
14:59:15 | narimiran | oh |
15:04:59 | PMunch | There we go: http://ix.io/2cOQ/nim |
15:05:06 | PMunch | Nice and buffered, and a lot faster |
15:05:49 | narimiran | `cast[cstring](cast[int](cast[ptr char]` you dawg, i heard you liked cast, so i put a cast in your cast |
15:05:52 | PMunch | That requires a call to "initialise_output(steps)" before calling t_output by the way |
15:06:04 | PMunch | Haha, you can't use arithmetic on pointers in Nim :P |
15:06:49 | PMunch | I guess you could remove the inner cast[ptr char] though |
15:06:51 | FromDiscord | <mratsim> @narimiran, what is this >_> does it even end with '\0'? |
15:07:12 | * | floppydh quit (Quit: WeeChat 2.7.1) |
15:07:16 | * | dddddd joined #nim |
15:07:22 | PMunch | Was that aimed at me? |
15:09:22 | * | hax-scramper quit (Read error: Connection reset by peer) |
15:09:52 | * | hax-scramper joined #nim |
15:10:13 | * | hax-scramper quit (Read error: Connection reset by peer) |
15:10:32 | * | hax-scramper joined #nim |
15:14:27 | * | hax-scramper quit (Ping timeout: 240 seconds) |
15:14:54 | * | hax-scramper joined #nim |
15:14:59 | Araq | oh github is broken |
15:15:03 | Araq | yay |
15:15:06 | * | ptdel joined #nim |
15:16:29 | PMunch | There, added some error checking to the buffer code, with minimal speed penalty: http://ix.io/2cOW/nim |
15:16:45 | PMunch | And it turns out that the initialisation should be steps + 2 :P |
15:16:50 | * | Vladar joined #nim |
15:24:47 | PMunch | Oh well, I'm off. Let m4r35n357 know that I optimised his code a bit if I don't get back before he does :) |
15:24:48 | * | PMunch quit (Quit: Leaving) |
15:38:47 | FromDiscord | <Rika> what time function should i use to benchmark a function |
15:39:58 | narimiran | i use `cpuTime` |
15:42:36 | FromDiscord | <Rika> does d:release enable LTO? |
15:43:29 | FromDiscord | <clyybber> noh |
15:43:41 | FromDiscord | <clyybber> nothing enables LTO I think |
15:43:46 | FromDiscord | <clyybber> you have to do it yourself |
15:43:48 | * | Hideki_ joined #nim |
15:44:17 | FromDiscord | <Rika> i see |
15:46:12 | * | Hideki_ quit (Remote host closed the connection) |
16:07:54 | * | Kaivo quit (Quit: WeeChat 2.7.1) |
16:08:50 | * | Kaivo joined #nim |
16:19:52 | leorize | use std/monotimes on devel |
16:20:03 | * | opal quit (Ping timeout: 240 seconds) |
16:20:49 | * | marmotini_ quit (Remote host closed the connection) |
16:21:15 | * | marmotini_ joined #nim |
16:21:34 | * | Hideki_ joined #nim |
16:23:31 | FromDiscord | <Rika> Why on devel? Stable has ir |
16:23:32 | FromDiscord | <Rika> It |
16:24:25 | * | marmotini_ quit (Remote host closed the connection) |
16:24:31 | * | marmotini_ joined #nim |
16:27:09 | FromDiscord | <clyybber> cpuTime should be fine |
16:27:30 | FromDiscord | <clyybber> unless you are benchmarking things that take a lot of time |
16:28:32 | FromDiscord | <clyybber> in fact cpuTime never decreases either |
16:28:52 | * | opal joined #nim |
16:29:46 | FromDiscord | <clyybber> at least not on posix |
16:36:40 | * | Trustable joined #nim |
16:36:40 | * | alexander92 quit (Read error: Connection reset by peer) |
16:40:40 | disruptek | oh, i missed araq's stream. π’ |
16:40:44 | * | Hideki_ quit (Remote host closed the connection) |
16:41:27 | * | Hideki_ joined #nim |
16:43:16 | * | marmotini_ quit (Remote host closed the connection) |
16:43:27 | * | marmotini_ joined #nim |
16:45:43 | * | Hideki_ quit (Ping timeout: 255 seconds) |
16:46:03 | Araq | disruptek, psshst |
16:46:12 | Araq | I clicked the wrong button :P |
16:46:25 | leorize | oh lol |
16:46:58 | disruptek | let's work on this audio at some point. i'm gonna work on mine today. |
16:49:08 | leorize | Araq: so what should I do about Araq/ormin#40? |
16:50:41 | leorize | having a ctx sounds fine to me, but how would it match with the current semantics? |
16:51:07 | Araq | not sure but the state must be exposed somehow |
16:51:25 | Araq | this design problem keeps Ormin from reaching v1 IMO |
16:52:08 | Araq | maybe the only good solution is setContext() |
16:55:12 | leorize | how would that work? |
16:55:58 | leorize | or are you planning to make queries an imported module instead of being included? |
16:57:18 | leorize | if it's included then we can just have a ctx global and a init() proc that should run before any queries are made |
16:59:32 | * | Hideki_ joined #nim |
17:03:39 | * | Hideki_ quit (Ping timeout: 240 seconds) |
17:04:21 | m4r35n357 | narimiran, I've looked at your code, and I'm fairly sure it won't work properly for the sin and tan procs, as only the final value is returned. I believe they have to return a tuple to access the "companion" functions. Does that sound right to you? |
17:04:47 | narimiran | it doesn't :D |
17:05:06 | narimiran | you're not returning anything there |
17:05:46 | narimiran | you're assigning stuff to `s[k]` and `t[k]` |
17:06:31 | narimiran | either that or i'm completely misunderstanding what those procs do |
17:06:37 | * | Cheer quit (Quit: Leaving) |
17:07:08 | m4r35n357 | they do not _need_ to return values, but it makes the client code simpler if they do |
17:07:23 | m4r35n357 | the c programs work this way |
17:07:40 | m4r35n357 | the Python ones just use return values, but that is also sub-optimal, |
17:07:46 | m4r35n357 | there is a case for having both |
17:08:52 | m4r35n357 | I might knock together a client prog that uses sin_cos() . . . |
17:09:10 | m4r35n357 | otherwise what I am saying won't make sense |
17:09:56 | * | marmotini_ quit (Remote host closed the connection) |
17:10:23 | * | marmotini_ joined #nim |
17:11:56 | m4r35n357 | narimiran, BTW, what system are you running, do you have access to gnuplot? because it is much nicer to see the output that way |
17:12:33 | m4r35n357 | time -p ./test 16 10 .01 10000 -15.8 -17.48 35.64 10 28 8 3 >/tmp/data; echo "splot '/tmp/data' with lines" | gnuplot -p |
17:12:36 | m4r35n357 | for example |
17:12:53 | narimiran | but you're current code doesn't return anything from `t_tan_sec2` and `t_sin_cos` |
17:13:08 | * | dadada_ quit (Ping timeout: 260 seconds) |
17:13:11 | narimiran | *current = the one you shared couple of hours ago |
17:13:44 | m4r35n357 | I think that was http://ix.io/2cOH/ |
17:14:03 | m4r35n357 | it returns tuples in for sin_cos and tan_sec2 |
17:14:11 | narimiran | no it does not :D |
17:14:27 | m4r35n357 | well the error messages said it did ;) |
17:14:58 | * | marmotini_ quit (Ping timeout: 255 seconds) |
17:15:00 | m4r35n357 | hence the auto type |
17:15:14 | m4r35n357 | return type |
17:15:29 | rockcavera | Some of the 10 new commits on devel are failing to compile nimsuggest. I tested it on Windows. |
17:16:13 | narimiran | m4r35n357: look the link you just shared: there's no return tuple, no return auto |
17:16:41 | narimiran | and look at the body of those procs - there's nothing you're returning there |
17:16:43 | * | opal quit (Ping timeout: 240 seconds) |
17:17:48 | * | opal joined #nim |
17:18:27 | * | opal quit (Excess Flood) |
17:18:41 | * | opal joined #nim |
17:20:08 | * | dadada joined #nim |
17:20:31 | * | dadada is now known as Guest69991 |
17:20:43 | narimiran | m4r35n357: oh, yeah, here's a message for you from PMunch: "PMunch> Oh well, I'm off. Let m4r35n357 know that I optimised his code a bit if I don't get back before he does :)" |
17:21:11 | narimiran | with this link: http://ix.io/2cOW/nim |
17:23:18 | m4r35n357 | yes, I saw that! |
17:23:39 | m4r35n357 | I'm still trying to work out what templates are for! |
17:23:57 | disruptek | which language are you coming from? |
17:24:59 | m4r35n357 | I know Pascal, Java, Python and a bit of js(!), c and fortran ;) |
17:25:43 | m4r35n357 | I know the phrase "templates" from people talking about generics in c++ . . . |
17:25:44 | * | clemens3 quit (Quit: quit) |
17:25:47 | disruptek | templates are like c macros but much better. still, they fit that same substitution-into-ast role. |
17:25:55 | m4r35n357 | so inline code? |
17:26:04 | disruptek | inline ast, yes. |
17:26:13 | m4r35n357 | I see he inlined the "private" procs |
17:26:36 | * | marmotini_ joined #nim |
17:26:45 | m4r35n357 | OK but AST is not the same as code, so is it some sort of "inline binary"? |
17:27:02 | m4r35n357 | in any case, I'm stuck at "what would I use one for" |
17:27:21 | m4r35n357 | the manual was no help, I think it is written for someone who already know the answer ;) |
17:27:52 | disruptek | you use them for substitution. |
17:27:59 | * | marmotini_ quit (Remote host closed the connection) |
17:28:25 | * | marmotini_ joined #nim |
17:28:59 | disruptek | in c, a macro is a very stupid substitution. |
17:29:04 | m4r35n357 | narimiran, so, is there a way of returning a tuple from a proc? |
17:29:24 | disruptek | in nim, templates are stronger, more robust. |
17:29:51 | disruptek | https://github.com/disruptek/nimph/blob/master/src/nimph/project.nim#L267 |
17:29:56 | m4r35n357 | to me it is just the prov with s/proc/template/ applied |
17:30:01 | m4r35n357 | proc |
17:30:08 | disruptek | see the subsequent iterators. |
17:30:53 | m4r35n357 | that is less clear to me than the manual ;) |
17:31:25 | disruptek | in c, templates are not hygienic. in nim, they are (by default). |
17:31:33 | narimiran | m4r35n357: of course there is, but it will probably be slower than your current stuff |
17:31:46 | Araq | m4r35n357, if in doubt, use a proc |
17:32:27 | m4r35n357 | yeah I need to look into tuples in a bit more detail . . . could be an array mind |
17:32:41 | * | Hideki_ joined #nim |
17:32:46 | * | marmotini_ quit (Ping timeout: 240 seconds) |
17:33:03 | m4r35n357 | tuples were easy in Python, I think that is why I attempted it |
17:33:03 | disruptek | tuples are like python tuples, but optionally named and more object-ish than array-ish. |
17:33:40 | m4r35n357 | yeah I just need to return a tuple or array literal |
17:34:18 | disruptek | if you aren't iterating, there's a good chance you're better-served with an object. |
17:34:49 | m4r35n357 | a lightweight one like a struct or js object? |
17:35:00 | m4r35n357 | OK that is also a candidate |
17:35:04 | disruptek | everything is lightweight in nim by comparison. |
17:35:25 | m4r35n357 | yeah I meant one with just data, no methods ;) |
17:35:27 | Araq | well tuples in Python are immutable, in Nim mutability is an aspect of the symbol kind, not of the type |
17:36:01 | m4r35n357 | they are return values, they only need to be consumed, so np |
17:36:43 | * | opal quit (Ping timeout: 240 seconds) |
17:36:46 | * | Hideki_ quit (Ping timeout: 240 seconds) |
17:36:50 | disruptek | nim doesn't have classes, so... |
17:36:55 | * | solitudesf quit (Ping timeout: 260 seconds) |
17:37:16 | m4r35n357 | so, if I assume that access is straightforward at the client, what is the most concise literal to return, array, tuple or object? |
17:37:26 | disruptek | tuple |
17:37:40 | m4r35n357 | OK so I was on the right lines ;) |
17:38:06 | disruptek | a tuple is a good way to return multiple values. it's not a good device to carry values around. |
17:38:58 | Zevv | Has it been considered to simply do .push stacktrace:off in the various async modules to make async-burdened stack traces more usable? |
17:39:05 | m4r35n357 | yep, produced and consumed, (also the client needs to assign to something!) |
17:39:36 | m4r35n357 | assign, or copy, but not mutate |
17:39:39 | disruptek | consumption? no. |
17:39:47 | leorize | objects in Nim are C structs with visibility settings, unless you use inheritance |
17:39:54 | * | opal joined #nim |
17:40:30 | m4r35n357 | If I can't consume the tuple I will have to call the function multiple times to get all the values won't I? |
17:40:55 | disruptek | this is a question of style and future-proofing. |
17:41:10 | m4r35n357 | pretty sure I can assign an array or object more easily . . . ? |
17:41:30 | leorize | if anything, I've learned to not future-proof my design |
17:41:42 | * | narimiran quit (Ping timeout: 258 seconds) |
17:41:45 | leorize | turns out you need different things when you finally got the problem figured out |
17:42:01 | disruptek | yes, so don't paint yourself into a corner with a tuple. |
17:42:21 | disruptek | if you are tempted to assign it a type name or define it with multiple lines, you probably shouldn't be using a tuple. |
17:42:52 | disruptek | if you know better, obviously you know better. it's a rule of thumb. |
17:43:42 | m4r35n357 | disruptek, is this what you mean by consumption?, no. ? Error: expression 't_sin_cos(sx, cx, x, k)' has no type (or is ambiguous) |
17:44:29 | disruptek | consumption == tuberculosis |
17:49:17 | clyybber | m4r35n357: Read the manual, you can do let (a, b) = someProcThatReturnsATupleWithTwoElements |
17:49:36 | * | NimBot joined #nim |
17:50:01 | clyybber | You can also of course assign it to one variable |
17:50:13 | clyybber | like so: let t = someProcThatReturnsATuple |
17:50:37 | clyybber | and then use t[i] to access the i'th field |
17:50:52 | clyybber | Or if your tuple is named you can do t.nameofthefield |
17:51:18 | m4r35n357 | OK I have just got it working by returning an array literal |
17:51:30 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
17:51:56 | clyybber | m4r35n357: Ok. I don't think you mean literal though |
17:52:05 | clyybber | a literal is something thats literally in the code |
17:52:13 | * | njoseph joined #nim |
17:52:34 | clyybber | like a string literal: "hello" or a int literal: 1 or an array literal: [1, 2, 3] |
17:52:38 | m4r35n357 | I mean something that is constructed in one go, not created and populated |
17:52:52 | m4r35n357 | oh you mean fixed value? |
17:53:12 | * | setenforce joined #nim |
17:53:15 | clyybber | What I gave examples for is called literal |
17:53:21 | m4r35n357 | ok my terminology might be off, you guys must know by now that I'm not a dev ;) |
17:53:36 | clyybber | mathematician? |
17:54:57 | m4r35n357 | nah, ex hardware engineer, software tester |
17:55:27 | clyybber | ah nice |
17:55:40 | m4r35n357 | I'm used to getting stuff going, then understanding how it works, then making it better. No top-down for me ;) |
17:56:57 | leorize | lol, ormin is giving me a "not an error" exception :P |
17:57:59 | clyybber | Error: keyboard not found, not an error. press key to continue |
17:59:28 | m4r35n357 | OK this is weird, I am returning an array using the values from what I thought was a tuple, and consuming it in what looks like a Python tuple, and it works! It actually plots the right trajectory |
18:00:01 | m4r35n357 | but I can't assign directly into that array, nor just return the "tuple", and it won't compile |
18:00:11 | m4r35n357 | still working code is a good start |
18:01:20 | m4r35n357 | https://play.nim-lang.org/#ix=2cPE |
18:02:28 | clyybber | What do you mean directly assign into that array? |
18:02:29 | m4r35n357 | oops think I overwrote the lib . . . |
18:02:38 | m4r35n357 | I'm trying to post ;) |
18:03:15 | m4r35n357 | lib:@ https://play.nim-lang.org/#ix=2cPE |
18:03:48 | m4r35n357 | client: https://play.nim-lang.org/#ix=2cPF |
18:04:36 | clyybber | and where is the problem? |
18:04:52 | m4r35n357 | clyyybber see t_sin_cos in lib |
18:04:56 | clyybber | ok |
18:05:04 | clyybber | you return an array there |
18:05:16 | clyybber | do you want to return a tuple instead? |
18:05:17 | m4r35n357 | clyybber, if you look at https://play.nim-lang.org/#ix=2cPF |
18:05:35 | m4r35n357 | you will see the call puts the valus into what looks like a tuple |
18:05:44 | m4r35n357 | that is how the Python code is put together |
18:06:06 | clyybber | Yeah |
18:06:15 | clyybber | it unpacks them into the array |
18:06:23 | clyybber | *arrays |
18:06:28 | m4r35n357 | but the Python t_sin_cos returns a tuple, but my nim code returns an array created from the tuple values |
18:06:39 | m4r35n357 | butjust returning the tuple doesn't seem to work |
18:07:15 | clyybber | write return (s[k], c[k]) in t_sin_cos |
18:07:24 | m4r35n357 | that tuple -> array - > tuple conversion seems unnecessary |
18:07:35 | m4r35n357 | OK |
18:08:53 | m4r35n357 | that works too |
18:09:26 | m4r35n357 | but I was assuming nim would just return the last value assigned without this extra stage |
18:10:00 | m4r35n357 | ./thomas 9 8 0.1 30000 1 0 0 .19 >/tmp/data; echo "splot '/tmp/data' with lines" | gnuplot -p |
18:10:13 | m4r35n357 | for anyone trying this at home who has gnuplot |
18:10:27 | clyybber | m4r35n357: Nope, that would be crazy |
18:10:35 | clyybber | I mean the last value assigned to thing |
18:10:40 | m4r35n357 | where thomas.nim is the client from https://play.nim-lang.org/#ix=2cPF |
18:11:14 | clyybber | Is it intended btw that t_sin_cos returns the tuple but also modifies the arrays? |
18:11:34 | clyybber | oh, seems it is |
18:11:45 | m4r35n357 | yes, I had to explain that earlier, it is desirable but not essential for the client code |
18:11:52 | clyybber | hmm no |
18:11:55 | clyybber | it doesn't make sense |
18:12:06 | clyybber | you are writing into the array |
18:12:11 | clyybber | and then returning a tuple |
18:12:18 | clyybber | which you write into the arrays again |
18:12:23 | clyybber | so you are writing twice to it |
18:12:29 | clyybber | you should just return the tuple |
18:12:29 | m4r35n357 | I am writing into a tuple then returning an array |
18:12:39 | clyybber | no you are writing into the arrays |
18:12:47 | m4r35n357 | clyybber, at last, that was my original question! |
18:13:06 | clyybber | one minute, I'll fix that |
18:13:10 | m4r35n357 | Error: expression 't_sin_cos(sx, cx, x, k)' has no type (or is ambiguous) |
18:13:21 | * | nsf joined #nim |
18:13:38 | m4r35n357 | that is by far the neatest solution apart from the compilation thing . . |
18:13:58 | clyybber | there you go: https://play.nim-lang.org/#ix=2cPP |
18:14:16 | m4r35n357 | oh! |
18:14:41 | clyybber | oh and remove the var thing from the parameters |
18:14:41 | m4r35n357 | can't believe I got to where I was without being there first ;) |
18:14:44 | clyybber | its not needed anymore |
18:14:52 | clyybber | m4r35n357: heh :) |
18:15:00 | clyybber | also the same goes for t_exp |
18:15:09 | clyybber | you are saying that you return a float |
18:15:18 | clyybber | but you actually write to the array in the parameter |
18:15:22 | m4r35n357 | it is not needed in the use cases I have showed so far |
18:15:26 | clyybber | yeah |
18:15:36 | clyybber | but you should fix it regardless |
18:15:45 | clyybber | just remove the assignemtn |
18:15:58 | clyybber | and make the argument not var anymore |
18:16:06 | m4r35n357 | the Python does not use vars, and it is unnecessarily verbose for the client because of it. |
18:16:49 | * | clemens3 joined #nim |
18:16:54 | clyybber | IMO its better to make the code for the client easy to understand |
18:17:12 | m4r35n357 | clyybber, I shall revisit this issue, in case I am wrong . . |
18:17:30 | * | marmotini_ joined #nim |
18:17:46 | clyybber | so the client having to do `(s[k], t[k]) = something` is better IMO than the client just doing `something(s, t, k)` |
18:17:54 | m4r35n357 | but I've removed stuff like this before then been "reminded" why it was there |
18:17:54 | disruptek | code is write-once-read-many. |
18:17:59 | clyybber | Its also more flexible |
18:18:17 | disruptek | make it so trivial that you'll have no trouble rewriting it later if necessary for optimization. |
18:19:09 | m4r35n357 | when I say client I mean client code, just to avoid misnderstandings ;) |
18:19:49 | clyybber | m4r35n357: Heres how I would do it: https://play.nim-lang.org/#ix=2cPY |
18:19:52 | * | luis__ joined #nim |
18:20:10 | clyybber | The client code will assign the results themselves to where they want them to be |
18:20:17 | * | tane quit (Quit: Leaving) |
18:20:27 | clyybber | maybe they want to echo it or something |
18:20:55 | clyybber | its also just a mathematical function this way |
18:21:06 | clyybber | and you can actually write func instead of proc if you want to |
18:22:20 | clyybber | https://play.nim-lang.org/#ix=2cQ0 |
18:22:27 | clyybber | With func instead of proc |
18:23:20 | m4r35n357 | clyybber, here we go, Python client loop: https://play.nim-lang.org/#ix=2cQ1 |
18:24:27 | clyybber | to port to nim, just add `()` around the first 3 assignments |
18:24:35 | clyybber | m4r35n357: Or is that nim code already? |
18:25:03 | m4r35n357 | clyybber, actually both at once: https://play.nim-lang.org/#ix=2cQ4 |
18:25:17 | m4r35n357 | sorry I kept pasting code into IRC, had to keep deleting it ;) |
18:25:38 | m4r35n357 | clyybber, this is a direct comparison of how I use the code in Python and c |
18:26:07 | clyybber | oh |
18:26:11 | m4r35n357 | clyybber, because it si such a PITA to do var parameters in Python, I just rely on returned values |
18:26:17 | clyybber | yeah the c version cuts corners |
18:26:25 | m4r35n357 | wheras the c can use them inline |
18:26:33 | m4r35n357 | as it updates the vars as it goes |
18:26:43 | clyybber | the python/nim version is easier to understand though |
18:27:07 | m4r35n357 | I just decided that the flexibility was to useful to give up |
18:27:13 | m4r35n357 | so I do both |
18:27:18 | clyybber | cool! |
18:27:29 | m4r35n357 | the c version just used to use the var parameters |
18:28:34 | m4r35n357 | clyybber, anyway, I need to digest what I have learned in this session. Thanks for hanging in there |
18:29:55 | m4r35n357 | clyybber, another factor that I didnt' mention is that the main version uses c with the MPFR arbitrary precision library, and using it is very verbose, saving lines saves sanity! |
18:30:10 | * | Hideki_ joined #nim |
18:30:23 | clyybber | I see |
18:31:00 | m4r35n357 | anyway, I'm going to tidy all this up for now, thanks again! |
18:31:06 | clyybber | np :) |
18:34:13 | lqdev[m] | I'm trying to pass a Table to a proc in a separate dll, but when the proc tries to access that table I get a segfault: http://ix.io/2cQ9 |
18:34:31 | lqdev[m] | the table is stored in an object which is a global |
18:35:33 | lqdev[m] | it happens no matter if I use boehm or not |
18:35:40 | Zevv | can you try with arc? |
18:35:47 | lqdev[m] | no |
18:35:52 | Zevv | oh wait boehm should be fine of course |
18:36:25 | disruptek | use TableRef |
18:36:49 | lqdev[m] | would making the object ref also suffice? |
18:37:31 | disruptek | if that's what you're passing, yes. |
18:38:26 | disruptek | i mean, that's what i'd try. |
18:38:57 | lqdev[m] | let's see, then |
18:43:10 | lqdev[m] | oh wow, if you compile Nim in nvim with ALE it will automatically show you the errors in a quickfix window. nice. |
18:43:22 | lqdev[m] | and it works with make! |
18:44:05 | leorize | you don't even have to use ALE :P |
18:44:26 | leorize | nim.nvim have a compiler plugin for showing errors as well |
18:44:35 | leorize | though neovim's make is no match for ALE |
18:45:01 | lqdev[m] | ah, it's neovim |
18:45:02 | lqdev[m] | nice |
18:45:41 | lqdev[m] | disruptek: making the object ref doesn't seem to work |
18:46:06 | disruptek | this dll is something you wrote? |
18:46:56 | lqdev[m] | yes |
18:46:59 | FromDiscord | <Recruit_main70007> You canβt import objects from dlls right? |
18:47:09 | clyybber | you mean types? |
18:47:16 | clyybber | no, types exist at compile time |
18:47:17 | lqdev[m] | nope, but you can import modules that contain those types. |
18:47:54 | FromDiscord | <Recruit_main70007> I see |
18:48:41 | disruptek | look at hashcommon and see what it's trying to read from. |
18:49:01 | disruptek | is this shashlick's feud plugin system? |
18:49:16 | lqdev[m] | nope |
18:49:46 | lqdev[m] | it's my own https://github.com/liquid600pgm/nadio/blob/master/src/nadio/plugins.nim |
18:50:25 | lqdev[m] | the file is outdated |
18:50:25 | * | Hideki_ quit (Ping timeout: 272 seconds) |
18:50:30 | lqdev[m] | let me commit |
18:51:33 | lqdev[m] | done |
18:54:20 | disruptek | well, it doesn't seem like the problem is in this code. |
18:55:05 | disruptek | neither is your test, i guess. |
18:55:12 | lqdev[m] | it fails in rawGetKnownHCImpl, while checking a `t`'s len |
18:55:20 | lqdev[m] | that `t` is a string in my case |
18:55:29 | disruptek | please use a TableRef just to appease me. |
18:55:31 | lqdev[m] | so I suppose the string is nil or invalid. |
18:57:44 | lqdev[m] | no luck. |
18:58:03 | lqdev[m] | as in, it doesn't work. |
18:58:19 | disruptek | where is the init code? |
19:00:05 | lqdev[m] | init for what? the table? |
19:00:10 | disruptek | you may as well embed your langtable since you're using, y'know, static data at ct. |
19:00:32 | disruptek | where is the plugin init defined? |
19:00:35 | disruptek | the one that crashes? |
19:00:58 | lqdev[m] | here https://github.com/liquid600pgm/nadio/blob/master/plugins/test/test.nim |
19:01:10 | * | xet7 quit (Read error: Connection reset by peer) |
19:01:17 | lqdev[m] | and the lang table isn't static data, new strings can be loaded into it by plugins |
19:01:43 | * | xet7 joined #nim |
19:01:46 | disruptek | do you think you understand the difference between Table and TableRef? |
19:02:15 | lqdev[m] | yes |
19:02:19 | disruptek | okay. |
19:02:28 | lqdev[m] | one lives on the stack, and the other lives on the heap, am I right? |
19:02:32 | disruptek | so it outputs, "hello from plugin" and then crashes? |
19:02:38 | lqdev[m] | yes |
19:03:01 | lqdev[m] | and it crashes on checking whether a key is stored in the table |
19:03:24 | lqdev[m] | ie. `key in tab` |
19:04:00 | disruptek | so you have a Resources object, a global, on the heap, which holds within it a Table, is that right? |
19:04:30 | lqdev[m] | yes |
19:04:56 | shashlick | lqdev u using boehm? |
19:05:05 | disruptek | and you think that makes sense? |
19:06:42 | disruptek | this is the kind of thing where, in theory, it doesn't seem like a problem. in practice, i dunno. i'd be suspicious. |
19:06:44 | lqdev[m] | yes, why wouldn't it make sense? |
19:06:46 | lqdev[m] | shashlick: yes |
19:07:04 | shashlick | Cdecl |
19:07:10 | Zevv | disruptek: what are you hinting at here |
19:07:15 | lqdev[m] | instead of noconv |
19:07:18 | lqdev[m] | ? |
19:07:31 | lqdev[m] | let me try |
19:08:38 | * | luis__ quit (Quit: luis__) |
19:09:08 | * | luis__ joined #nim |
19:09:16 | Zevv | this table is not living on the stack in this case of course, it is just on the heap |
19:09:22 | disruptek | yep. |
19:09:27 | disruptek | but assumptions may be made. |
19:09:42 | Zevv | remember roots and fuckups |
19:10:06 | lqdev[m] | ah, there we go |
19:10:18 | lqdev[m] | seems like I'm a dumbass and I was running `make` and not `make install` |
19:10:34 | lqdev[m] | thus, any changes in my plugin were not reflected |
19:11:11 | disruptek | so we won't know what fixed it? |
19:11:35 | lqdev[m] | probably changing the proc signature |
19:12:03 | Zevv | well, running "make install" fixed it, right? :) |
19:12:11 | lqdev[m] | yes |
19:12:27 | lqdev[m] | because my `install` rule copies the file to Nadio's plugins directory. |
19:12:39 | Zevv | sure, makese sense. I was just answering disruptek's question :) |
19:12:47 | lqdev[m] | ah |
19:13:28 | * | luis__ quit (Client Quit) |
19:13:56 | * | luis__ joined #nim |
19:18:22 | lqdev[m] | anyhow, it works now. thanks for the help |
19:20:12 | disruptek | cool. |
19:26:33 | * | Vladar quit (Quit: Leaving) |
19:44:13 | * | Guest69991 quit (Ping timeout: 265 seconds) |
19:50:05 | * | dadada joined #nim |
19:50:28 | * | dadada is now known as Guest94405 |
19:50:29 | * | luis__ quit (Quit: luis__) |
20:04:02 | * | Guest94405 quit (Ping timeout: 265 seconds) |
20:05:08 | * | dadada_ joined #nim |
20:16:19 | * | sentreen_ quit (Ping timeout: 255 seconds) |
20:18:51 | * | dadada_ quit (Ping timeout: 260 seconds) |
20:19:39 | disruptek | ~stream is https://twitch.tv/disruptek |
20:19:40 | disbot | stream: 11https://twitch.tv/disruptek |
20:19:44 | disruptek | so. |
20:19:57 | * | dadada joined #nim |
20:20:12 | disruptek | just gonna add speech bubble notifications when people talk in mumble. |
20:20:18 | disruptek | so we know who is speaking. |
20:20:22 | * | dadada is now known as Guest59192 |
20:21:26 | * | clyybber quit (Ping timeout: 265 seconds) |
20:21:42 | Zevv | so what is this mumble |
20:21:51 | Zevv | how does one know where to mumble |
20:21:51 | disruptek | it's group voice chat. |
20:22:04 | Zevv | yeah but is it tied to your twitch somehow? |
20:22:11 | disruptek | ~stream is https://twitch.tv/disruptek and mumble://uberalles.mumbl.io/ |
20:22:12 | disbot | stream: 11https://twitch.tv/disruptek and mumble://uberalles.mumbl.io/ |
20:22:13 | disruptek | yes. |
20:22:21 | Zevv | ah right |
20:22:36 | disruptek | you want to talk but... privately? |
20:22:54 | * | clyybber joined #nim |
20:23:22 | * | sagax quit (Ping timeout: 265 seconds) |
20:24:02 | * | sagax joined #nim |
20:27:11 | * | abm joined #nim |
20:29:00 | * | sentreen_ joined #nim |
20:34:17 | * | Guest59192 quit (Ping timeout: 272 seconds) |
20:35:03 | * | dadada_ joined #nim |
20:37:20 | * | nsf quit (Quit: WeeChat 2.7) |
20:39:32 | * | ptdel quit (Ping timeout: 248 seconds) |
20:39:50 | * | ptdel joined #nim |
20:42:35 | * | krux02 quit (Remote host closed the connection) |
20:48:37 | * | Trustable quit (Remote host closed the connection) |
20:58:21 | * | Jesin quit (Quit: Leaving) |
21:00:23 | * | Jesin joined #nim |
21:04:12 | * | narimiran joined #nim |
21:20:20 | * | clyybber quit (Quit: WeeChat 2.7.1) |
21:21:51 | * | filcuc joined #nim |
21:30:43 | * | setenforce quit (Ping timeout: 260 seconds) |
21:35:47 | * | alexander92 joined #nim |
21:46:01 | * | filcuc quit (Ping timeout: 265 seconds) |
21:51:17 | * | filcuc joined #nim |
21:55:05 | * | narimiran quit (Ping timeout: 258 seconds) |
21:55:25 | * | solitudesf joined #nim |
21:58:44 | * | marmotini_ quit (Remote host closed the connection) |
21:59:20 | * | marmotini_ joined #nim |
22:07:17 | * | marmotini_ quit (Ping timeout: 265 seconds) |
22:15:39 | * | clyybber joined #nim |
22:16:35 | * | clyybber quit (Client Quit) |
22:22:24 | * | setenforce joined #nim |
22:23:54 | * | clyybber joined #nim |
22:33:05 | disruptek | what to work on next... |
22:35:14 | disruptek | oh, let's do the bot radio. |
22:38:05 | * | alexander92 quit (Read error: Connection reset by peer) |
22:39:15 | * | solitudesf quit (Ping timeout: 240 seconds) |
22:45:41 | * | letto quit (Ping timeout: 258 seconds) |
22:49:08 | * | marmotini_ joined #nim |
22:49:13 | * | letto joined #nim |
22:53:21 | * | luis__ joined #nim |
23:02:39 | * | a_b_m joined #nim |
23:05:26 | * | filcuc quit (Quit: Konversation terminated!) |
23:06:15 | * | abm quit (Ping timeout: 265 seconds) |
23:08:06 | * | lritter quit (Quit: Leaving) |
23:17:50 | disruptek | ~stream |
23:17:51 | disbot | stream: 11https://twitch.tv/disruptek and mumble://uberalles.mumbl.io/ -- disruptek |
23:24:25 | * | krux02 joined #nim |
23:47:07 | * | clyybber quit (Quit: WeeChat 2.7.1) |
23:52:11 | shashlick | Meh, cannot get into mumble with android |
23:52:33 | disruptek | why not? |
23:52:50 | zedeus | https://f-droid.org/en/packages/com.morlunk.mumbleclient/ |
23:53:24 | disruptek | are you on the stream? |
23:57:00 | * | theelous3 quit (Read error: Connection reset by peer) |
23:57:54 | krux02 | I am watching the stream right now |
23:58:03 | krux02 | is the IRC on the stream? |
23:58:50 | krux02 | ok I see you opening the IRC chat :D |
23:59:18 | krux02 | currently my twitch account information is somewhere lost |