<< 03-09-2018 >>

00:02:00FromGitter<Araq> yes
00:02:07FromGitter<Araq> `let foo = case ...`
00:21:03*Serenitor quit (Quit: Leaving)
00:24:20*noonien quit (Quit: Connection closed for inactivity)
00:35:14*PrimHelios joined #nim
00:35:39PrimHeliosDoes anyone here know anything about ormin?
00:36:35FromGitter<bung87> hi guys, I want port a Minhash library Neo or Arraymancer should I consider first ?
00:40:57*ftsf joined #nim
00:56:32FromGitter<Araq> @PrimHelios I do, but it's late here, see you later.
01:00:16*krux02 quit (Remote host closed the connection)
01:01:08*krux02 joined #nim
01:02:59*krux02 quit (Remote host closed the connection)
01:41:07vivushow do I search a string? looking for keywords
01:50:44*icasdri joined #nim
01:53:35*icasdri quit (Remote host closed the connection)
01:54:01*kungtotte quit (Ping timeout: 246 seconds)
01:54:08*kungtotte joined #nim
02:14:42FromGitter<ephja> vivus: https://nim-lang.org/docs/system.html#find,T,S
02:14:45FromGitter<ephja> https://nim-lang.org/docs/strutils.html#find,string,string,Natural,Natural
02:15:11vivusI saw that 1 from strutils, but it returns an int
02:19:20FromGitter<bung87> then what else expect to return ?
02:22:51*dddddd quit (Remote host closed the connection)
02:26:39FromGitter<ephja> slice?
02:27:38vivusim seeing what a returned int means to understand.
02:27:55vivusDoes nim have something like: if mystring exists: ...
02:28:09vivusin Python, it's: if mystring:
02:29:54leorizeyou mean check if a string is not empty?
02:29:58FromGitter<bung87> well, you first problem in js is .indexOf in python is .find
02:30:40FromGitter<bung87> second question, not clear to me what you're asking
02:36:24*leorize quit (Ping timeout: 252 seconds)
02:49:52*leorize joined #nim
03:11:56FromGitter<bung87> `cdef int32_t INT32_MAX = 4294967295` I see this in a cython file, why this is double and plus 1 to https://github.com/nim-lang/Nim/blob/27b081d1f77604ee47c886e69dbc52f53ea3741f/tinyc/win32/include/stdint.h#L85
03:19:08vivusleorize: yeah, check if the string is not empty
03:19:22leorizeif string != ""
03:19:29leorizeno fancy functions needed
03:19:32vivus*mindblown*
03:26:52leorizebut do note that for older versions of Nim you might need to check for nil as well
03:27:21*endragor joined #nim
03:44:08FromGitter<bung87> (https://files.gitter.im/nim-lang/Nim/9pB3/Screen-Shot-2018-09-03-at-11.43.31-AM.png)
03:46:47FromGitter<bung87> how to avoiding this? it treats as proc should as a function
03:49:08FromGitter<bung87> I meant to call `MurmurHash3_x64_128(str, char_ngram, seeds[s], hashes)`
03:50:38leorizelooks like a codegen bug
03:51:02leorizecan you try with the latest compiler from devel?
03:52:33leorizeit would be great if you can include some example code as well
03:52:33FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8cb00160f9ee7aa4cc51eb]
03:53:03FromGitter<bung87> ok hold on I push it to github
03:55:49FromDiscord<emekoi> can we get macro pragmas?
03:55:59FromGitter<bung87> https://github.com/bung87/minhash/tree/master/src
03:57:13FromGitter<bung87> maybe my cpp wraps wrong
04:02:33*cspar_ joined #nim
04:05:43leorizebung87: the hash takes an untyped pointer, not a cstring
04:06:54leorizebut it shouldn't cause any problem...
04:06:59leorizeI'll take a closer look
04:08:31leorizebung87: change importcpp to importc
04:08:57FromGitter<bung87> you mean here `const void * key` ? I only have a little experience in QT framework, so may have big mistake
04:09:11FromGitter<bung87> ok I try it
04:11:45FromGitter<bung87> you mean just replace `importcpp ` -> `importc ` no further work to do ? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8cb481c2bd5d117a0ebebf]
04:12:08FromGitter<bung87> it will raise symbol not found error
04:12:40leorizeok you still need importcpp, but you need to crack the syntax
04:12:43leorizehttps://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs
04:13:10leorizesince importcpp is mainly used for importing methods, it's default behavior cause the issue you met
04:13:43leorizethe problem is... I don't know how to properly use it for importing normal procs
04:16:18*gangstacat quit (Quit: Ĝis!)
04:17:01FromGitter<bung87> wow ..difficult for me to understand
04:23:02leorizelooks like you can `importcpp: "MurmurHash3_x64_128(@)"`
04:23:24leorizeit will generate the correct code, but it doesn't generate the necessary `externs`
04:25:25vivuswhat is the best way to store data in a file such that I can split the content according to different categories?
04:26:57FromGitter<bung87> it will raise link error I just tried
04:27:36leorizebung87: it raise "Murmur3... is not defined in this scope" for me
04:28:22*suspiciouswombat quit (Ping timeout: 246 seconds)
04:28:51FromGitter<bung87> hmm I see two nim package that wraps c version murmur3 .. maybe I just need to try c version :(
04:29:17leorize:p you can try to reimplement the hash itself in Nim
04:29:29leorizevivus: what do you mean?
04:29:39leorizeor to be precise, what are you trying to do
04:32:04vivusleorize: I am trying to make a human readable file that can store data according to categories. like this: https://www.zerobin.net/?13a5335515237687#cxogxWTIW69TYmgOCt3nf8spiOeZjt7YnwNvH38i5n0=
04:33:56FromGitter<bung87> @leorize I see some go implements seems easy to port but not sure I can really understand it :( I'll try c version first
04:34:13vivusleorize: is there a better way to store that data so I can index/search it?
04:34:33leorizevivus: I can only think of tables right now
04:34:58vivusI want to avoid a DB, as it's overkill
04:35:08FromGitter<bung87> that depends on what kind of data
04:35:22leorizevivus: tables is pretty lightweight
04:35:41leorizeit's a simple hashmap
04:35:41vivuswhat do you mean tables? I thought you were referring to DB tables
04:35:50leorizethe tables module
04:36:52leorizebung87: I don't think it's possible to call ordinary functions in C++ from Nim
04:37:07leorizec2nim can't generate anything useful from your header
04:37:53vivusoh yes this might work. ty
04:39:42FromGitter<bung87> so that's why document only introduce method,namespace,class ?
04:41:13vivusleorize: when I try to run the example on the modules page, it gives me this error: Error: A module cannot import itself
04:41:28leorizedid you name the file tables.nim?
04:42:05FromGitter<bung87> probably
04:42:10vivusyeah 0_o oops
04:43:23leorizebung87: it will work if you use it with {.header: "/path/to/header".}
04:43:27leorizeI've just tried
04:43:49leorizec2nim can only generate useful code when you pass both --cpp and --header
04:44:06FromGitter<bung87> @leorize I change it to c version it just worked
04:45:03leorizeC interface will work for everything :)
04:46:12FromGitter<bung87> thanks ! I will try it next time I'll keep that in mind:)
05:19:44FromDiscord<emekoi> whats the difference between doc and doc2? or are they the same on devel?
05:33:20*nsf joined #nim
05:46:56FromDiscord<emekoi> nvm, i figured it out.
05:47:55FromDiscord<emekoi> should documentation be built doc2 style? because all the stuff in system/atomics isn't in any of the docs.
06:16:19*gogolxdong quit (Quit: Page closed)
06:39:29vivusdoes nim have the Python equivalent of enumerate?
06:42:22FromGitter<narimiran> yes, you just do `for i, element in mySeq:`
06:42:29FromGitter<narimiran> vivus ^
06:43:26vivus@narimiran can I do this like so: for keys, line in lines filename: ?
06:50:02FromGitter<narimiran> it seems that you can't
06:51:05*koppeh quit (Quit: koppeh)
06:51:11*copygirl joined #nim
06:52:19FromGitter<narimiran> my quick workaround (probably there is a better way) is to use `let contents = readFile(filename).splitLines; for i, line in contents: ....` (splitLines is from strutils)
06:53:08FromGitter<narimiran> http://ix.io/1lUw/
06:55:06vivus@narimiran this is using that each line will have something like ... key:value in it?
06:55:12vivus*this is assuming
06:56:04FromGitter<narimiran> no, this is how i usually read contents from a multi-line file
07:01:15*kapil___ joined #nim
07:01:36Araqenumerate needs to be added to sugar.nim
07:05:18FromGitter<codem4ster> Hi all, there are recv procs in net module. I want to read bytes instead of string from a tcp connection. Which one do you suggest? recv with low-level with a pointer version or string version. If latter, is this a good and performant approach to convert string to bytecode?
07:07:07*diogenese5 joined #nim
07:09:51*diogenese5 quit (Remote host closed the connection)
07:10:21FromGitter<codem4ster> I want use recv in thread. Is pointer version leads to unsafe code and leak memory or do smt bad?
07:17:30FromGitter<mratsim> pointers lead to unsafe code, that means you’re on your own. It won’t leak memory if you o not make it leak.
07:18:01FromGitter<mratsim> unsafe doesn’t mean bad, it means that Nim won’t cleanup your mess (or even tell you you are in a mess)
07:19:07FromGitter<mratsim> but tbh, the Nim net module is using string wrongly and should accept `seq[byte]` instead of strings
07:20:00FromDiscord<emekoi> `recv` and `send` in the net module make sure that their socket is open, is there a reason asyncnet doesn't?
07:20:46FromGitter<mratsim> debate about `string` vs `seq[byte]` starts here: https://github.com/nim-lang/Nim/issues/7337#issuecomment-373398341
07:21:38leorize/urlselect
07:21:44leorizeoops, sorry
07:23:03*halirc joined #nim
07:26:13FromGitter<codem4ster> I totally agree with you Mamy. I first tried
07:27:06*cspar joined #nim
07:27:23FromGitter<mratsim> even if you delete on Gitter, your message will still appear on IRC and in irc logs.nim-lang.org @codem4ster ;)
07:28:00*cspar_ quit (Ping timeout: 252 seconds)
07:28:28FromGitter<codem4ster> I totally agree with you @mratsim. I first looked for uint8 and byte types. Its interesting Nim works with strings in socket streams.
07:28:46FromGitter<codem4ster> sorry for the mistake irc channel :P
07:29:11vivusAraq: hope im not disturbing, but maybe you can help me figure out how to get my proc to display the output as shown: https://www.zerobin.net/?4b90a03babbf5784#VZ2/wkoAB4TgwRJ9+IHVVtoG/1aaZrb8AFg3r2ZtL04=
07:30:24FromGitter<mratsim> @vivus, can you use NimYAML instead? https://nimyaml.org/
07:31:23FromGitter<codem4ster> the last question @mratsim. How can I convert [1, 5, 0] to string (I mean bytecode to string) :) I need to use this string in send proc.
07:32:22FromGitter<mratsim> `cast[string](@[byte 1, 5, 0]`
07:32:24vivus@mratsim can the outputted yaml file be converted back to nim structures?
07:32:31FromGitter<mratsim> @vivus yes
07:32:42vivusit looks so complicated though
07:33:03FromGitter<mratsim> @codem4ster not sure if intentional or relying on implementation details but you can cast between string and sequence of uint8/bytes
07:33:21FromGitter<mratsim> @vivus, because NimYAML adds some comment for serialization
07:33:31Araqsorry to say that but YAML is way too complex and it's the kind of complexity that can introduce security problems
07:34:14FromGitter<mratsim> but for config, check both toml and yams @vivus, pick one that you like and you will not have to parse by hand: https://gist.github.com/cdsousa/9c98897595177ed322b24643af4b68ce
07:34:27FromGitter<mratsim> yaml not yams*
07:34:45vivusive been sitting on this for a few hours. I think my brain will need a timeout before jumping into nimyaml :D unless Araq saves the day :D
07:35:41FromGitter<mratsim> Otherwise for serialization that does not need to be human-readable this is nice: https://xomachine.gitlab.io/NESM/
07:36:19FromGitter<codem4ster> @mratsim I'm using the stable version 0.18 it gives SIGSEGV: Illegal storage access. (Attempt to read from nil?) for `caststring (@[byte 1, 5, 0])`
07:36:29*ftsf quit (Read error: Connection reset by peer)
07:36:47FromGitter<mratsim> the @foo need to be assigned to a variable first I think
07:36:57FromGitter<mratsim> otherwise the GC will collect it
07:38:14FromGitter<codem4ster> it says: the cast keyword, which is unsafe and should be used only where you know what you are doing, such as in interfacing with C here; https://nim-by-example.github.io/variables/type_casting_inference/
07:38:47FromGitter<mratsim> alternatively just use copyMem, that will b sure to work whatever the future implementations of string and seq\[byte\]
07:39:18FromGitter<mratsim> I know what I’m doing :P
07:40:06FromGitter<codem4ster> ahaha :D but I'm not, exactly in threads. :P
07:44:15*ven473 quit (Remote host closed the connection)
07:44:32*ven473 joined #nim
07:50:41*PMunch joined #nim
07:51:50FromGitter<alehander42> in NimYAML to just use `load`to convert to nim objects
07:52:04FromGitter<alehander42> they have good examples here https://nimyaml.org/
07:53:47FromGitter<alehander42> yeah, if you just use a resonable subset of yaml, it's unbeatable for me
07:58:36vivusI was hoping to avoid using OOP and objects in general
07:59:28FromGitter<alehander42> what do you mean?
07:59:35FromGitter<alehander42> there is no OOP here
07:59:49vivustype Person = object
07:59:59FromGitter<alehander42> well, that's not OOP
08:00:11FromGitter<alehander42> that's just a struct basically
08:00:15*Vladar joined #nim
08:00:21FromGitter<alehander42> but it's just an example
08:00:29FromGitter<alehander42> if you use only seq-s/builtin types
08:00:34FromGitter<alehander42> you pass them to load
08:00:55vivusfair enough
08:00:58FromGitter<alehander42> e.g. `load(f, int)`
08:01:03FromGitter<alehander42> (at least I think so)
08:02:55*gmpreussner_ quit (Ping timeout: 246 seconds)
08:03:25*gmpreussner joined #nim
08:03:32FromGitter<alehander42> otherwise toml seems hyped these days, but isn't `[[]]` vs `[]` a little bit confusing
08:03:54FromGitter<alehander42> I find it assymetrical (1 indentation for two levels of data)
08:07:53Araqeverything is always confusing. ;-)
08:08:36vivusAraq: is my problem above easy? I kind of feel like I am not getting the logic right, maybe cause im tired :D
08:12:45Araqwhat's your problem?
08:15:04Araqcan you place this around the calls to epochTime()
08:15:04Araq{.push posix: off.}
08:15:04Araq # calls to epochTime() here
08:15:04Araq{.pop.}
08:15:13Araqwhat? lol
08:15:36AraqTIL there is a 'posix: off' switch
08:15:48vivusare you telling me?
08:18:03*SenasOzys quit (Remote host closed the connection)
08:19:20Araqno it was offtopic, I'm reading old bug reports
08:19:30Araqvivus, so ... what's your problem again?
08:19:42vivusAraq: https://www.zerobin.net/?4b90a03babbf5784#VZ2/wkoAB4TgwRJ9+IHVVtoG/1aaZrb8AFg3r2ZtL04=
08:22:17*SenasOzys joined #nim
08:22:18*SenasOzys quit (Remote host closed the connection)
08:22:23Araqyes, that's not clear enough
08:22:39*SenasOzys joined #nim
08:23:26vivusill come back later. need to think about this problem as pseudocode first.
08:23:32vivusty all
08:23:38vivuswill look into nimyaml also
08:23:56*SenasOzys quit (Remote host closed the connection)
08:24:22*SenasOzys joined #nim
08:25:06*Elronnd is now known as s
08:25:29*s is now known as Elronnd
08:25:32FromGitter<alehander42> you just need to use ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8ceffbcff55e56179cf471]
08:27:59*stefanos82 joined #nim
08:27:59FromGitter<alehander42> but I'd also recommend doing something similar and directly parsing it first , e.g. ⏎ `parse(source) -> seq[Category] or Table[string, Category] # not sure which is better for you` ⏎ after that writing all kinds of filter etc functions will be very easy
08:28:26Araqisn't this problem covered by dom's book
08:28:39*dadabidet joined #nim
08:28:50FromGitter<alehander42> of course it depends, if your files are huge you might want to directly iterate them for interactive output i guess
08:28:54vivus@alehander42 you mean I should parse everything from the file into a nim data structure?
08:29:29vivusthe files will be small. at max, a few thousand lines I predict
08:29:30FromGitter<alehander42> well if you do a lot of different operations with it, yeah, if you just filter it a loop is good enough I guess
08:30:03vivusyour pseudocode is awesome btw. ty for giving me another angle to look at it
08:30:51FromGitter<alehander42> i hope it helps
08:32:04Araqhmm 67 bugs left to close for today...
08:32:22Araq"3,933 Closed"
08:37:41*vivus quit (Remote host closed the connection)
08:48:44FromGitter<xmonader> wow
08:54:27*zachcarter quit (Ping timeout: 240 seconds)
08:59:16stefanos82Araq: what -_-
08:59:23stefanos82are you even a human being?!
09:01:03Araqstefanos82, nah, I'm not serious.
09:01:18stefanos82bloody hell, you got me worried for a moment ^_^
09:01:40stefanos82I planned to nicknamed you "The Bug Terminator"
09:01:42Araqon the other hand, what I'm about to implement might close 10 bugs at the same time...
09:03:31*TheLemonMan joined #nim
09:03:52Araqand yeah, I know I made the CIs red :-(
09:04:29TheLemonManTravis is blushing
09:10:39*sz0 joined #nim
09:14:28*couven92 quit (Read error: Connection reset by peer)
09:17:26stefanos82Araq: I have no fear about your expertise around programming, let alone bug fixes and new implementation.
09:17:30stefanos82you will sort things out
09:17:46Araqthat makes two of us
09:20:27FromGitter<admin0day> i am still can't figure out why my csv file can't upload succeed to the website backend when i am added an nginx reverse proxy in front of my backend.
09:21:03*gangstacat joined #nim
09:21:55FromGitter<admin0day> i can saw the nginx hand out the package to the backend.
09:24:14FromGitter<admin0day> upstream prematurely closed connection while reading response header from upstream
09:26:00FromGitter<admin0day> still print out this fault in my nginx's error.log
09:31:28FromGitter<admin0day> here is the code of the upload http://ix.io/1lUG
09:32:00FromGitter<alehander42> has uint changes default sizes in any of the versions?
09:32:20Araqno.
09:33:15FromGitter<alehander42> hm I hit a memory overflow bug because I used sizeof(uint) instead of sizeof(uint16)
09:33:22FromGitter<alehander42> so I guess uint was always uint32
09:33:30FromGitter<alehander42> just wondering why I didn't hit that before
09:35:54FromGitter<mratsim> uint is the size of a pointer
09:36:05FromGitter<mratsim> uint64 on a 64 bit machine
09:47:45FromGitter<alehander42> thanks
09:48:00FromGitter<alehander42> anyway, I am full of the dumbest bugs today
09:48:18FromGitter<alehander42> just filled a log file with 10 gb of data because of a wrong `while`
09:48:41FromGitter<alehander42> gcc really has so start solving the halting problem
09:52:59TheLemonManfuckin travis creates more problems than it solves
09:53:48TheLemonManwelp, there's a missing comma in there heh
09:54:34*captainkraft quit (Ping timeout: 246 seconds)
09:55:10*captainkraft joined #nim
09:59:30AraqTheLemonMan, without the CIs we would be doomed.
10:00:16*norok2 joined #nim
10:02:34norok2hi all again! is there a cheat sheet for quick `nim` syntax?
10:03:24TheLemonMansure thing, I just found that Travis is the one service that has to be restarted more than the others
10:12:33FromGitter<bung87> how to declare a type member could be `uint32` or `int64` ?
10:13:02TheLemonManin a object? use a generic parameter
10:13:07Araqyou use int64 because every uint32 value fits in an int64
10:18:40Araqit's like saying "I need a type that can hold a char and 'A'..'Z'"
10:21:14FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ so I make all out_hashes to `var array[2, int64]` not sure I'm right [https://gitter.im/nim-lang/Nim?at=5b8d0b1a1d3a5711b6d9539b]
10:26:01FromGitter<vivekimsit> Hi, I am new to Nim and this is my first message :)
10:26:44FromGitter<vivekimsit> I want to be a collaborator and learn system programming
10:27:29FromGitter<vivekimsit> how can I get started?
10:28:15Araqfollow my git commits.
10:29:22leorizenorok2: the Manual
10:34:47FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ Do I need two version, or just ues the `minhash_64` one? [https://gitter.im/nim-lang/Nim?at=5b8d0e4711b41f69dbb2d923]
10:35:24FromGitter<bung87> since `self.seeds` declare as `seeds:seq[int64]`
10:48:18*Zeno[m] joined #nim
10:55:27norok2@leorize it seems I have some trouble in finding the equivalent of MATLAB's `start:step:stop` method for generating an array
10:57:30FromGitter<bung87> https://nim-lang.org/docs/system.html#countup.i,T,T,int
10:58:49norok2countup is a generator, it will not give me an array
10:59:33TheLemonMantoSeq(countup(...))
11:01:01FromGitter<vivekimsit> @FromIRC sure
11:01:20norok2Error: undeclared identifier: 'toSeq'
11:02:22TheLemonMancome on, you're not even trying, import sequtils first
11:08:42FromGitter<mratsim> Araq get out of TheLemonMan’s body
11:09:35FromGitter<mratsim> @vivekimsit, I suggest you start with: https://narimiran.github.io/nim-basics/, then find a project that you would enjoy doing and do it in Nim
11:09:44FromGitter<mratsim> pick something that you can wind but is not too trivial
11:10:42FromGitter<mratsim> win not wind
11:13:06*couven92 joined #nim
11:13:46FromGitter<vivekimsit> @mratsim sure, right now I am watching some couple of videos on youtube
11:14:29*Guest46449 is now known as avsej
11:14:52FromGitter<bung87> https://nim-lang.org/documentation.html Tutorials on left side always there
11:15:19FromGitter<mratsim> in my case I wanted to build a scientific ecosystem in Nim and had greater and greater needs, then I become much better at Nim internals while debugging and raised hundreds of bugs
11:20:57Araqhundreds?
11:23:31TheLemonManthousands!
11:24:23*dddddd joined #nim
11:27:20Araqhttps://ci.appveyor.com/project/dom96/nim/build/4573/tests this is interesting to see
11:27:58Araqif we make the compilation phases saner, "only" about 100 tests fail
11:28:42FromGitter<narimiran> @vivekimsit if you follow @mratsim's suggestion, you would be one of the first people reading redesigned Nim basics tutorial :) I've planned to "publish" that, but I forgot
11:29:21FromGitter<narimiran> The content is the same as before, so if you find anything confusing/not working/wrong, please report it.
11:36:38FromGitter<narimiran> looking at today's commits — @Araq is on fire! :)
11:37:08*seni joined #nim
11:37:21*Ovius joined #nim
11:40:49FromGitter<zetashift> you know `type Person = object` is basically a struct why was object keyword chosen and not struct?
11:40:57FromGitter<zetashift> Just curious don't really mind it
11:42:06*Ovius quit (Remote host closed the connection)
11:42:49FromGitter<bung87> they dont have mush diffriences
11:43:05Araqbecause 'struct' is not even a word?
11:43:11*kapil___ quit (Quit: Connection closed for inactivity)
11:43:23Araqthe full English term is 'structure' iirc
11:43:58AraqI don't know why C didn't use the term that was common at that time, 'record'
11:44:39Araqprobably because they were too busy with removing vowels from their alphabet
11:45:13FromGitter<bung87> that would let database thing come to my head...
11:47:50PMunchWell you kept "int"
11:47:57PMunchThose are actually called integers
11:48:22PMunchAnd int is not a word either
11:50:22PMunchTo be honest I think it was just to save on typing. Overall consonants carry more information than vowels in words, so vowels are easier to remove if you want to shorten something. Plus a string of consonants are pretty easy to pronounce, but a string of vowels is a bit harder.
11:51:04*zachcarter joined #nim
11:51:07PMunchfloat is also really a shortening, but having a type "floating_point_number" in C would just be silly :P
11:51:24PMunch"char" is also in Nim, and it's short for character
11:51:37Araqthank you for this lecture.
11:51:49PMunchI'm with zetashift by the way, I don't mind them being called "object"
11:52:23Araqand now please note that 'record' and 'struct' have the same amount of letters
11:53:24PMunchOh yeah, I'm not saying that structure vs. record was a better choice
11:54:09PMunchBut calling it a structure maybe makes a bit more sense since the data is structured that way in memory. A record doesn't really have to imply any underlying storage format
11:54:45PMunchBut that's just how I tend to think about them, Wikipedia seems to disagree with me :P
11:55:19*zachcarter quit (Ping timeout: 246 seconds)
12:03:27*cspar quit (Ping timeout: 252 seconds)
12:06:00FromGitter<alehander42> @mratsim talking about scientific, I started a simple symbolic nim lib in the weekend , i've always wanted to do something related to symbolic comp ⏎ i know I can just write a wrapper around a c one, but writing one from scratch is cooler obviously
12:07:09FromGitter<alehander42> (i saw somebody was looking for sympy in the forum :D probably one should be able to wrap their c engine, but I haven't looked into it)
12:26:10norok2perhaps I am doing something wrong, but I was really expecting this simple code to print some numbers... it compiles, but it hangs indefinitely
12:26:29norok2import sequtils
12:26:31norok2var a = toSeq(0..<10000)
12:26:32norok2proc sum(arr: openArray[SomeNumber]): SomeNumber =
12:26:34norok2 result = 0
12:26:35norok2 for x in arr:
12:26:37norok2 result += x
12:26:38norok2echo sum(a)
12:26:47norok2sorry I made it even simpler
12:26:53norok2import sequtils
12:26:54norok2var a = toSeq(0..10)
12:26:56norok2echo a
12:27:09norok2hangs indefinitely
12:27:20FromGitter<mratsim> @alehander42 cool, there was someone asking for Sympy like in the forum
12:29:37FromGitter<vivekimsit> @narimiran sure
12:30:00norok2@alehander42 but sympy does not have a C engine, it's pure Python, according to their home page: https://www.sympy.org/en/index.html
12:31:00norok2@alehander42 perhaps you could look into Maxima.. granted that it is written in LISP, perhaps with the metaprogramming facilities of Nim it is not too difficult to take inspiration from that
12:31:47FromGitter<alehander42> @mratsim exactly, that reminded me I wanted to do something like that
12:32:17FromGitter<alehander42> @norok2 very strange
12:32:22FromGitter<alehander42> I saw https://github.com/symengine/symengine
12:32:26FromGitter<alehander42> which leads to sympy page
12:32:38FromGitter<alehander42> so I thought they use it somehow
12:33:22FromGitter<alehander42> i see, so it can be a custom backend
12:34:14FromGitter<alehander42> yeah, my plan was to initially build some core functionality, with mostly sympy-like API
12:34:40FromGitter<alehander42> and to think of a better nim dsl for the functionality in the meantime
12:34:56FromGitter<mratsim> I’d love to help but too many project :p
12:35:21FromGitter<alehander42> thanks for the maxima idea, i'll take a look at it later
12:36:07FromGitter<alehander42> @mratsim i'll probably use some of your libs, e.g. stint anyway :D
12:37:56FromGitter<mratsim> why do you need stint for symbolic computation?
12:37:57FromGitter<alehander42> nah, actually one would need arbitrary precision here
12:38:00PMunchnorok2, seems to work fine on the playground
12:38:10*elrood joined #nim
12:38:33FromGitter<mratsim> I have an arbitrary precision integer lib for crypto but it’s ony in my head for the moment
12:38:41PMunchAnd please use a paste service like pastebin or ix.io when sharing code snippets
12:38:42FromGitter<alehander42> no, I might want to support very big numbers, but I forgot stint is only N-bit
12:39:02PMunchThey are easier to copy from and it reduces the noise in the IRC room
12:39:11FromGitter<mratsim> you can use ref Stint\[1384\] if you want ;)
12:39:17FromGitter<mratsim> 16384*
12:39:25FromGitter<alehander42> @mratsim if nimble can download it from your head, i am going to install it
12:39:43FromGitter<mratsim> afraid no
12:40:01FromGitter<alehander42> imagine npm with brain-to-push-package bionic interface
12:40:13FromGitter<alehander42> the future is bright
12:40:44FromGitter<narimiran> norok2: your example works on my end. what is your nim version?
12:40:57norok20.18.0
12:41:26FromGitter<alehander42> yeah, i'll just let people live with `2343589 * 3287423874`
12:41:56FromGitter<narimiran> norok2 i have tried both 0.18.0 and 0.18.1 (devel), and it works
12:42:22PMunchnorok2, try to run nim --version just to be sure
12:42:26FromGitter<narimiran> (the second, simple, example)
12:42:42norok2Nim Compiler Version 0.18.0 [Linux: amd64]
12:42:49PMunchnorok2, and you don't have a local file named sequtils with another implementation of toSeq?
12:43:06norok2not that I am aware of
12:43:12PMunchWhich switches do you use to compile?
12:43:20norok2 nim c -d:release sum.nim
12:43:48norok2sum.nim contains the code
12:44:16norok2lol
12:44:18norok2nvm
12:44:36PMunchWhat was it?
12:44:52norok2there was another bin with that name and was executing that
12:45:03PMunchAh :P
12:45:49*endragor quit (Remote host closed the connection)
12:46:24norok2is there anything similar to %timeit for nim?
12:46:48norok2(ipython magic)
12:47:03PMunchWell on linux you can just use `time ./sum`
12:47:12norok2@narimiran, @PMunch thanks for helping out
12:47:45norok2I was hoping to have something that would run it multiple times, and do some stats on top
12:48:06norok2and perhaps within the code itself
12:48:10PMunchHmm
12:48:24PMunchWell a template should be able to do that
12:48:39*krux02 joined #nim
12:48:51*elrood quit (Quit: Leaving)
12:49:28FromGitter<alehander42> there were several libs for that
12:49:29FromGitter<alehander42> https://github.com/winksaville/nim-benchmark
12:49:45FromGitter<alehander42> but it is not updated, it might need a fix for new nim
12:50:17FromGitter<mratsim> This is the latest and greatest: https://github.com/LemonBoy/criterion.nim
12:50:36FromGitter<alehander42> http://htmlpreview.github.io/?https://github.com/ivankoster/nimbench/blob/master/nimbench.html
12:50:39FromGitter<alehander42> aaah yeah
12:50:47FromGitter<alehander42> that's it, it had a weeeird name
12:50:55FromGitter<alehander42> criterion ^
12:51:19FromGitter<mratsim> Because it’s from Haskell ;)
12:51:35PMunchnorok2, http://ix.io/1lVg/
12:51:38PMunchSomething like that
12:55:42TheLemonManyeah, it follows the great tradition of criterion.{hs,nim,rust} :)
12:55:51*Vladar quit (Remote host closed the connection)
12:59:17Araqit violates Nim's Zen though, "copying a bad name does not make it a good name"
12:59:51PMunchnorok2, and if you want to be able to pass a number of times to run it: http://ix.io/1lVh/
13:00:23krux02Araq: I see an issues list that actually becomes shorter rather than longer
13:01:35AraqPMunch, btw an 'int' is not an integer. it's a caricature of an integer because it can overflow
13:01:51*Vladar joined #nim
13:01:55TheLemonManafter all naming things is the hardest part heh
13:02:02Araqbut Pascal got it worse with 'real' which has nothing to do with real numbers
13:02:43krux02Araq: so that is wher this "SomeReal" came from.
13:02:52PMunchAre you talking about C ints?
13:03:03TheLemonMan'real' reeks of x86's 80-bit fp
13:03:21*MyMind joined #nim
13:03:45krux0280-bit fp is still not a real
13:03:55*Sembei quit (Ping timeout: 250 seconds)
13:04:39FromGitter<tim-st> is there a http server in nim that is not async?
13:04:41Araqand 'string' always felt salacious to me, I should have called it 'text'
13:04:47TheLemonManyeah, the whole world pretends it's never been real :P
13:05:15Araqbut then 'text' would consist of letters, not of stupid octets...
13:05:27TheLemonManstash all those ideas for Nim2
13:05:45AraqI'm not serious.
13:06:25FromGitter<tim-st> what's the downsides of this: https://nim-lang.org/docs/httpserver.html ? Is says it will be deprecated soon
13:06:51krux02I think the worst part of unicode is the ambiguety.
13:07:03Araqasynchttpserver received more security related bugfixes, tim-st
13:07:31FromGitter<tim-st> ok, thanks, can I access a shared string or something using asynchttpserver?
13:08:01krux02you can have an a with ¨ on top or the character ä
13:08:06krux02not the same thing
13:08:23FromGitter<timotheecour> @mratsim thx for suggestion, I changed title in https://github.com/nim-lang/Nim/issues/8432
13:09:32FromGitter<alehander42> text is good indeed, i always struggle to explain what is string to beginners
13:10:16PMunchalehander42, it's a string of characters :)
13:10:43FromGitter<tim-st> when I use async things I always get "not gcsafe" errors
13:10:46Araqor a rope, or a thread, a twine
13:10:57FromGitter<alehander42> @pmunch yeah exactly, why `string` ?
13:11:03FromGitter<alehander42> why not just a list of characters
13:11:03Araqa chain.
13:11:13PMunchA sequence of similar items or events. ‘a string of burglaries’
13:11:15FromGitter<alehander42> a labyrinth ..
13:11:18krux02Araq: I finally understand your naming conventions
13:11:21norok2@alehander42, @mratsim, @PMunch thanks
13:11:23PMunchFrom Oxford dictionary on string
13:11:28PMunchThat's probably what it's from
13:11:48FromGitter<timotheecour> @araq thanks for fixing all those pesky runnableExamples issues! now we can start making more use of runnableExamples finally
13:11:51krux02when I just started to do programming and I needed more names without name collisions, I put different languages in the mix
13:11:51FromGitter<alehander42> yeah, but the point is that people usually use "list" to name a sequence
13:11:54FromGitter<alehander42> in programming
13:12:00krux02identifiers in German and English
13:12:09FromGitter<alehander42> also, e.g. in bulgarian i don't see a clearly equivalent word to string
13:12:53FromGitter<alehander42> and finally, with unicode even a list/string starts to not make fully sense
13:12:59*agree joined #nim
13:13:14krux02alehander42: I learned programming with scheme. For me a list will always be a single linked list. And the Java ArrayList is an oxymoron
13:13:15norok2I think string is closer to an array than to a list
13:13:31FromGitter<alehander42> as it's a superposition of several lists
13:13:36FromGitter<alehander42> ok, arrays
13:13:40FromGitter<alehander42> python broke me for life :D
13:13:47Araq'chain' is the much better term for singly/doubly linked "lists"
13:13:50krux02I think string is a good name, because it doesn't imply that you can index into it.
13:14:13krux02Araq: I agree
13:14:36FromGitter<alehander42> but the only reason it exists is that people make sense of its visual representation
13:14:43norok2chain is still a sensitive word in south US :'D
13:14:44FromGitter<alehander42> which is basically text
13:14:58FromGitter<alehander42> otherwise you just use some kind of a binary format
13:15:21FromGitter<alehander42> the fact that we use text to interoperate with everything is just a side effect :D
13:15:39Araqbut the worst offender is 'vector' for a variable length thing. In math vectors always have a fixed size, you cannot grow them.
13:15:55*agree quit (Remote host closed the connection)
13:16:14Araqnot too mention that the term clashes with the real vectors you might want to use in your program...
13:16:33krux02Araq: put c++ valarrray to the mix
13:17:32Araqwhat's a valarray?
13:17:35krux02if they would just swap the names of valarray and vector, c++ would be a better language
13:17:54krux02you can see it as a vector
13:18:09krux02with operators like +
13:18:17FromGitter<tim-st> is there a reason why the following works and in one line it doesnt?
13:18:28FromGitter<tim-st> ```var s {.threadvar.}: string ⏎ s = ""``` [https://gitter.im/nim-lang/Nim?at=5b8d34a311b41f69dbb3dab7]
13:18:37PMunchWell a chain is always double linked
13:18:42*cspar joined #nim
13:18:50PMunchA single linked chain wouldn't make much sense
13:19:08PMunchAnd having already used Array a linked list kinda makes sense
13:19:15krux02PMunch I would lisagree
13:19:53krux02you can have a cain of hangers
13:20:07krux02and that is "single linked"
13:20:14PMunchHuh?
13:20:16Araqtim-st: yeah, read the error message
13:21:44krux02PMunch, you put a hanger in another hanger. It is asymetric
13:21:57krux02not like double linked which is symmetric
13:22:00PMunchIf you think of the C style "string" which is just a pointer to a character with the implication that other characters "string" along until a NULL byte occurs then the name kinda makes sense
13:22:03krux02and still I would call it a chain
13:22:30PMunchA hanger like a clothes hanger?
13:22:55krux02PMunch, C has full support for 0 terminated strings and strings with explicit size.
13:23:01AraqC doesn't name it 'string' though, it's 'char*'
13:23:12FromGitter<tim-st> When I open a file as `threadvar` does it mean it is opened again in each thread?
13:23:13Araqbut string.h is a header file, so...
13:23:15krux02it is just that 0 terminated strings are more popular. But not when you look and standard library alone
13:23:23PMunchkrux02, yeah I know
13:23:52krux02Araq, and ``strstr``
13:24:03krux02best name ever
13:24:08PMunchI was just just saying that if someone wanted to name the concept of a series of characters pointed to by something a "string" would be a decent word
13:24:16PMunchAs it is really a string of characters
13:24:34Araq'strstr' is my favorite too
13:24:44PMunchWhat's strstr?
13:25:22krux02http://www.cplusplus.com/reference/cstring/strstr/
13:26:30PMunchOh yeah, that thing..
13:26:31Araqa result of serious drug problems
13:26:45PMunchWho thought that was a good name..
13:27:57Araqand now it's FP time. 'map'. WTF? 'fold'? 'foldr'?
13:28:25FromGitter<alehander42> well map seems obvious
13:28:30FromGitter<alehander42> mapping
13:28:40TheLemonManfold is also obvious because it folds a sequence into a single element
13:28:47FromGitter<alehander42> i mean, look at linq, that is crazy
13:28:55krux02well fold is actually a good name.
13:29:01TheLemonManand foldl/foldr tell you the traversal direction
13:29:01FromGitter<alehander42> filter is also good
13:29:16krux02I just don't like foldl foldLeft foldRight.
13:29:21Araqreally? I think it's terrible. 'fold' is 'accumulate'
13:29:21FromGitter<zetashift> I asked why it was named object and it devolved into a whole naming discussion
13:29:42Araqand 'map' ... well a map is something you use to get from point A to point B.
13:29:52krux02when it say foldLeft, I don't know is it from left or towards left
13:30:13Araqor maybe 'fold' is 'collect'
13:30:27FromGitter<alehander42> reduce
13:30:28PMunchWell in the broader sense a map is just something that "maps" one thing to another. In the case of a terrain map it maps the terrain around you onto a piece of paper
13:30:38Araqoh yeah, forgot about 'reduce'.
13:30:52krux02fold isn't a term that was invented by functional programming.
13:30:56FromGitter<Vindaar> @Araq nah, map in the mathematical sense is perfectly fitting
13:30:59FromGitter<alehander42> i think we just have many good names for fold
13:31:12FromGitter<data-man> @alehander42 Thanks for winksaville/nim-benchmark ! Why I don't know it. :) ⏎ ⏎ > but it is not updated, it might need a fix for new nim ⏎ ⏎ First attempt: https://github.com/data-man/nim-benchmark/tree/modern_Nim [https://gitter.im/nim-lang/Nim?at=5b8d37a0c9500b4bab76ebc4]
13:31:12*fredrik92 joined #nim
13:31:16FromGitter<alehander42> collect is not good, it doesn't seem obvious
13:31:37FromGitter<alehander42> @data-man i found it on the forum with google, np
13:31:41AraqVindaar: probably hints at a problem of the English language :P
13:31:56FromGitter<mratsim> We should biject instead of map :P
13:32:09FromGitter<mratsim> and morphism instead of function
13:32:09*couven92 quit (Disconnected by services)
13:32:13Araqyup. 'biject'. perfect.
13:32:20*fredrik92 is now known as couven92
13:32:47krux02collect is already used in functional programming
13:32:56krux02it is not fold, but related
13:33:11FromGitter<alehander42> i tried to use injective in a PR
13:33:16FromGitter<alehander42> and araq hated it :D
13:33:29krux02but biject is also not good, a bijective function is reversable
13:33:36FromGitter<alehander42> i kind agree with him for the particular pr
13:33:38FromGitter<mratsim> collect means “toSeq” in Rust
13:33:41krux02a map normaaly does not have that requirement
13:34:01FromGitter<zetashift> @mratsim holy shit really
13:34:02FromGitter<mratsim> the main thing about bijections is that it preserves cardinality, like map
13:34:11FromGitter<zetashift> toSeq is a lot easier to grasp lmao
13:34:25FromGitter<mratsim> yeah in Rust you put collect after a chain of iterators to build a new container
13:34:27FromGitter<zetashift> I was like "collect into what!?"
13:35:08FromGitter<mratsim> but at least Rust inline iterator chaining works ;)
13:35:18krux02collect in scala is "filter" with pattern matching and map the result
13:36:00FromGitter<mratsim> oh, Haskell has mapAccumlL and mapAccumR btw and it’s different from fold
13:36:12FromGitter<mratsim> It’s more of scanl and scant with map
13:36:25FromGitter<mratsim> scanr
13:36:27krux02scala has a fold operator
13:37:20krux02(myarrar /: Nil) ( _ :: _ )
13:37:39krux02transforms any collection in a single linked list
13:37:43krux02with a fold
13:37:44FromGitter<alehander42> and in sympy collect transforms a polynom to its ugh normal(sorted by power of x) state
13:38:24FromGitter<alehander42> just to add another random meaning
13:38:29krux02alehander42 isn't that rather a normalization step?
13:38:43FromGitter<mratsim> “normal” means too much things as well
13:40:31krux02"normal" means a lot, but "normalize" not
13:40:44*cspar quit (Ping timeout: 272 seconds)
13:40:44Araq"normal" is politically incorrect and has been deprecated.
13:41:34krux02I was very confused when I learned in computer graphics about the vertex normal.
13:41:46AraqUse "special snowflake" instead.
13:42:11krux02I can't is it called normal everywhere
13:42:34krux02it is an orthogonal vector to the surface
13:44:40PMunchHmm, is there a way to borrow everything from the base type when creating a distinct type?
13:46:05PMunchI was looking at this: https://www.reddit.com/r/nim/comments/9c5cf9/noob_confused_with_overloading_functions/ and I came to realize that if you want to be able to work on both your Oranges and Apples as strings but have two different peel procedures you would need to use distinct and then convert back and fro between the type and a string, or borrow everything you think you will need, which wouldn't work for imported modules.
13:46:10FromGitter<arnetheduck> so nim is supposed to be good at dsl's.. why all the sarcasm around domain specific names then?
13:46:12*Ambroisie joined #nim
13:46:14krux02PMunch: when you find good use for distinct type, tell me about it, I didn't
13:46:43krux02arnetheduck: I am not sarcastic about domain specific names.
13:46:50*cspar joined #nim
13:47:22krux02I am just sarcastic about obvious bad namings.
13:47:38PMuncharnetheduck, we were just discussing names we thought were strange
13:47:47krux02like the already mentioned "strstr"
13:48:06krux02I think functional programming is quite good names.
13:48:17krux02C has "distinct" names
13:48:37AraqI think clarity of words is a precondition for clarity of thoughts
13:48:41FromGitter<mratsim> @Pmunch `type Foo = object; data: int` -> everything from int is borrowed -> ??? -> Profit
13:48:44FromGitter<arnetheduck> well, `strstr` follows a pattern in the c library - would it be better to break the pattern?
13:48:53krux02and javascript libraries like to let anything end on js
13:49:06PMunchkrux02, well I used `distinct` in my jsonschema module and nimlsp
13:49:20krux02arnetheduck: the is no pattern in "strstr"
13:49:34PMunchTo indicate a JsonNode that followed a certain schema
13:49:34krux02strfind would be fine
13:49:44FromGitter<arnetheduck> there is - it's the string counterpart for `strchr`
13:49:54krux02and it is also within the imaginary 8 character limit of identifiers
13:49:58PMunchSo I could be sure that it had some values but wouldn't have to create a new object for everything
13:50:36FromGitter<mratsim> @krux02 it was 6 in old Fortran
13:50:42FromGitter<tim-st> this httpserver works really good, it's the only one without memory leaks: https://nim-lang.org/docs/httpserver.html
13:50:45FromGitter<arnetheduck> it's also part of another pattern: all string functions in c start with `str` which denotes the string you're operating on.. the latter half of the name tells you about other arguments
13:50:54*Ambroisie quit (Remote host closed the connection)
13:51:01Araq'strcmp'?
13:51:54FromGitter<arnetheduck> yeah, compare this string with the other.. even that is a hint as to what the return value will be (ie in which order the comparison is done)
13:52:22PMunchmratsim, then you would need to use .data everywhere
13:52:56FromGitter<alehander42> @arnetheduck well even strfindc and strfinds would be better
13:53:02FromGitter<alehander42> and still in the 8 char limi
13:53:16FromGitter<alehander42> obviously in this case we can ask "why strchr"
13:53:20FromGitter<arnetheduck> there is a system - it might not necessarily be a perfect one, and what's really hard is to add a name to an existing system for a new use case you didn't consider at the beginning - then you're faced with two unpalatable choices - break the system or break compatibility by changing the system
13:54:02Araqthe only pattern here is that the thing starts with 'str'. 'strsub' (gimme me the substring) isn't exactly hard to come up
13:54:08FromGitter<alehander42> and often breaking compatibility is better: if C decided to depracate(but still save for compat) strchr and strstr in the 80s, and add equivalents with better names
13:54:14FromGitter<alehander42> it would save probably mandecades
13:54:15krux02I don't care for the reasons as long as we all agree that c naming conventions suck.
13:54:17FromGitter<alehander42> of confusion
13:54:33krux02the only good thing about them is they didn't change for as long as I live
13:55:15FromGitter<tim-st> Is it possible to turn off deprecated warning for a module?
13:55:16*noonien joined #nim
13:55:25FromGitter<arnetheduck> @alehander42 not really.. there's a reason why c is popular and other langs are not (in the sense that it's survived 40 years and still remains the *lingua franca* of compsci) - one thing is that it's stable
13:55:53Araqyeah, we can take a lesson here, don't bikeshed around for a decade just because "it's inconsistent/different from Python/I couldn't be bothered to read the docs"
13:56:26krux02the good thing about C is, it doesn't do shit like "everything is an object"
13:56:42krux02"all functions are virtual"
13:56:49FromGitter<alehander42> @arnetheduck and if one has to explain the actual reasons why the names are like this with such ь detail, you can see how this convention actually sucks
13:56:56krux02"everything is garbage collected"
13:57:53krux02In a lot of ways C is just sane syntax for assembler instructions.
13:58:12FromGitter<alehander42> @arnetheduck i am not saying why didn't they break it, but `strfind` instead of `strstr` is not "breaking", for every "wait strchr .. i expected strstr"guy you'll have 20 "ahhhh strfind .. that makes sense" people
13:58:21Araqoh not that again... my assembler had a way to detect overflows...
13:58:33krux02Araq: sorry
13:58:47FromGitter<mratsim> And carry
13:59:25krux02But that is my perspective on C.
13:59:35FromGitter<alehander42> and c remained a lingua franca thanks to the stability and *despite* the weeird conventions
13:59:35krux02I don't know if what I say is true
13:59:51Araqand when C came along, register allocators were far from perfect and structured programming also had some overhead.
14:00:10krux02But for me it feels tha language was designed to have a better syntax for what assembly programmers were doing anyway, just with assembler syntax.
14:00:15AraqC was considered a high level language.
14:00:39FromGitter<mratsim> Even assembly was considered higher level than hex edit :P
14:00:40krux02But of course that doesn't cover every style of assembler programmers or all the tricks of assembler programmers
14:00:52krux02just what they were used to as good pattern.
14:01:31krux02Araq: Ever heared of HLSL
14:01:36krux02high level shader language?
14:01:56krux02it is basically just C
14:02:23*PrimHelios quit (Quit: Leaving)
14:04:25ldleworkis really much like C?
14:04:29ldleworkHLSL that is
14:04:43Araqreally? so why does it lack 'goto' then?
14:05:03Araqand what does 'float4 Position : POSITION;' mean?
14:10:03krux02float4 Position : POSITION doesn't mean much more than float4 Position
14:10:31krux02and float4 is a simd data type with four 32bit float values
14:20:55*halirc quit (Ping timeout: 246 seconds)
14:23:59*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
14:24:30*pwntus quit (Remote host closed the connection)
14:30:52norok2I got my `nim` executable from `nimble`... where am I supposed to find `nim.cfg`?
14:38:29*PMunch quit (Quit: Leaving)
14:46:29Araqnorok2, usually you get your 'nimble' from 'nim' via 'koch nimble'
14:46:46Araqwell for some definition of "usually"
14:54:37FromDiscord<Armaldio> Hello everyone
14:54:37FromDiscord<Armaldio> Do you know if it's possible to use case of with a regex ?
14:55:13FromGitter<mratsim> use strscan
14:55:25FromGitter<mratsim> https://nim-lang.org/docs/strscans.html
14:55:50FromGitter<mratsim> and do a if:elif chain
14:56:38Araquse the new experimental match macros with a case statement...
15:01:24FromDiscord<Armaldio> match returns a boolean from the doc, right ?
15:01:48FromDiscord<Armaldio> I think i'll go with a simple if elif
15:05:58*dadabidet quit (Remote host closed the connection)
15:17:13FromGitter<alehander42> how can i declare a signature for inline asm emit ?
15:17:20*endragor joined #nim
15:17:28FromGitter<alehander42> nodecl doesn't seem enough
15:21:43yglukhov[m]Araq: hey, should push:experimental work?
15:23:30*cspar quit (Ping timeout: 244 seconds)
15:24:28Araqyglukhov[m], I have a test case for that
15:24:37Araq{.push experimental: "feature".} is the syntax
15:24:38norok2@Araq sorry, I got it messed up, I installed it a long time ago, I am not sure how I actually got it, I just saw it was in some `nimble` directory, anyway I found the solution: it did find my `nim.cfg` in `$HOME/.config`... the FAQ (https://nim-lang.org/faq.html) did help but was not really accurate
15:25:29yglukhov[m]Araq: cool, thanks!
15:25:35*PrimHelios joined #nim
15:35:36*endragor quit (Remote host closed the connection)
15:35:38FromGitter<mratsim> @alehander42 you don’t need to put a decl convention, just use {.emit: “””asm `result`”””.}
15:36:37*zachcarter joined #nim
15:36:43FromGitter<mratsim> or *asm*
15:37:05FromGitter<mratsim> here you go: https://github.com/LemonBoy/criterion.nim/blob/master/src/criterion/cycles.nim#L6-L12
15:40:33*SenasOzys quit (Ping timeout: 244 seconds)
15:42:46*nsf quit (Quit: WeeChat 2.2)
15:44:41*DarkMukke joined #nim
15:45:33*SenasOzys joined #nim
15:47:34*DarkMukke quit (Remote host closed the connection)
15:48:50*cspar joined #nim
15:54:27*PrimHelios quit (Ping timeout: 240 seconds)
16:38:32*Jesin quit (Quit: Leaving)
16:40:28*flyx quit (Quit: ZNC - http://znc.in)
16:56:05yglukhov[m]Araq: i'll look into https://github.com/nim-lang/Nim/issues/8851 if youre not there yet?
16:56:56Araqyeah please
16:57:07AraqI'm working on the docgen.
16:57:24Araqthat's what I wanted to do the whole day long and then I got side-tracked and fixed a billion bugs instead
17:02:20*Trustable joined #nim
17:02:25*Trustable_2 joined #nim
17:02:41*Trustable_2 quit (Remote host closed the connection)
17:02:41*Trustable quit (Remote host closed the connection)
17:03:29*Trustable joined #nim
17:12:16FromGitter<alehander42> @mratsim i also wanted to inline rdtsc .. how surprising :D
17:12:23FromGitter<alehander42> thanks
17:12:37FromGitter<alehander42> yeah i meant `{.inline.}` nice, i didnt know it exists
17:13:48*JStoker quit (Ping timeout: 252 seconds)
17:14:18*JStoker joined #nim
17:20:10FromGitter<bung87> please help me fix the code https://github.com/bung87/minhash/blob/master/src/minhash.nim cant pass third assert
17:23:23*cspar quit (Ping timeout: 245 seconds)
17:24:09*ng01 joined #nim
17:24:55*ng0 quit (Ping timeout: 244 seconds)
17:28:16FromGitter<kayabaNerve> What is it printing?
17:28:21FromGitter<kayabaNerve> What's the data type?
17:28:23FromGitter<kayabaNerve> @bung87
17:28:44FromGitter<bung87> it 's porting from https://github.com/mattilyra/LSH/blob/master/lsh/cMinhash.pyx
17:29:00*ng01 is now known as ng0
17:30:22FromGitter<bung87> the jaccard results in 0..1,all basic type is unsigned int
17:31:47FromGitter<kayabaNerve> It's probably an overflow issue/string/array
17:32:07FromGitter<kayabaNerve> You should get a big num lib
17:32:27FromGitter<kayabaNerve> Or find a way to properly compare the data types
17:34:28FromGitter<bung87> which parts could cause this issue ? I see the number is limited
17:37:13FromGitter<kayabaNerve> 1) .1? As in a decimal? Represented as a fraction via an undesigned int?
17:37:20FromGitter<kayabaNerve> *unsigned
17:37:25FromGitter<kayabaNerve> Back to what is it printing?
17:38:52FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8d71ac58a3797aa3f96c4e]
17:40:37*cspar joined #nim
17:41:54FromGitter<bung87> ok you're right, it should return float but this another problem
17:44:00FromGitter<kayabaNerve> Float to int truncates
17:44:59FromGitter<bung87> still prints `0.0-0.0`
17:46:10FromGitter<bung87> I may have big mistake , I only have a little experiences in compiled language under framework .
17:47:05FromGitter<kayabaNerve> I can do more investigating when I'm not on my phone :p sorry for not being helpful so far.
17:48:04FromGitter<bung87> thanks! you fix a bug .
17:50:12*SenasOzys quit (Quit: Leaving)
18:03:59*xet7 joined #nim
18:13:58*nsf joined #nim
18:15:43*xet7 quit (Quit: Leaving)
18:17:56*xet7 joined #nim
18:58:38*zachcarter quit (Quit: Lost terminal)
18:58:48*zachcarter joined #nim
18:59:42zachcarterI have this example from hyperHTML now working w/ my port - https://viperhtml.js.org/hyperhtml/examples/#!fw=React&example=Hello%2C%20world%20%26%20tick
19:00:42FromGitter<kayabaNerve> @bung87 It seems to be intersection/union.
19:01:04FromGitter<kayabaNerve> I can't get the code to run due to issues on my machine though
19:01:06FromGitter<kayabaNerve> Sorry
19:01:49FromGitter<bung87> how could that be a problem
19:02:43FromGitter<kayabaNerve> No idea. I just know that those two generate the return value for jaccard so you should check what they're doing
19:07:02zachcarterso much refactoring / cleaning up to do on this lib now
19:07:06FromGitter<bung87> I'm not sure the `char_ngram` parts , it may produces in original cMinhash.pyx that I not noticed, or it inside MurmurHash
19:07:28zachcarterbut at least it's working :D tagged template literals are awesome :D - now we have basically two Nim FE web libraries :D
19:10:27*crem quit (*.net *.split)
19:10:28*surma quit (*.net *.split)
19:10:28*r4vi quit (*.net *.split)
19:10:30*LyndsySimon quit (*.net *.split)
19:10:31*enigmeta quit (*.net *.split)
19:10:32*AlexMax quit (*.net *.split)
19:10:52*AlexMax_ joined #nim
19:10:55*crem1 joined #nim
19:10:56*surma_ joined #nim
19:11:36*r4vi joined #nim
19:11:41*enigmeta joined #nim
19:11:45*LyndsySimon joined #nim
19:13:18FromGitter<xmonader> Hi anyone tried Mdbook with Nim lang? I can't get the highlighting to work :S
19:14:38zachcarterfirst time I've heard of mdbook
19:15:16*Trustable quit (Remote host closed the connection)
19:16:21FromGitter<bung87> https://github.com/mattilyra/LSH/blob/3db37cf07eefa3276e7409b12e73f30f596236ae/lsh/cMinhash.pyx#L49-L55 the ngram produces here?
19:18:54*kapil___ joined #nim
19:19:04*Trustable joined #nim
19:19:42FromGitter<xmonader> @zacharycarter really? it's the one the rust book build on and multiple other projects
19:20:04FromGitter<xmonader> I found out the problem, they didn't include `nimrod` support from highlight custom build
19:22:15zachcarterah interesting
19:22:56zachcarterthis tagged template lib is only `9.83KB gzipped (38.33KB uncompressed)`
19:23:01zachcarterafter running through google closure compiler
19:28:19FromGitter<bung87> @kayabaNerve I got an idea , the pyx version function get a char pointer and it produce produce ngrams by move pointer
19:32:21*cspar quit (Ping timeout: 252 seconds)
19:32:29FromGitter<xmonader> OK Nimdays migrated to mdbook ⏎ please check https://xmonader.github.io/nimdays ⏎ I think it's beautiful than softcover and Day 12 is out :) on how to encode/decode data in redis protocol too
19:34:27FromGitter<zetashift> @xmonader on day11 you wrote 'managng' on the first paragraph :D
19:34:37FromGitter<zetashift> I like nimdays a lot btw !
19:35:00FromGitter<xmonader> @zetashift Thanks I'll fix. I'm glad you like it :)
19:55:53*vivus joined #nim
19:57:01zachcarterneed to figure out how to implement - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Class_expressions - next
19:57:13zachcarterI'm guessing macros + emit
20:00:40*AlexMax_ left #nim (#nim)
20:01:16*AlexMax joined #nim
20:12:01*Sentreen joined #nim
20:12:25*skrylar joined #nim
20:12:59*skrylar quit (Client Quit)
20:13:08*skrylar joined #nim
20:26:45*Trustable quit (Remote host closed the connection)
21:09:20vivusis anybody familiar with yaml? Someone mentioned it to me earlier. Trying to see if I can get the right yaml format
21:11:17zachcartervivus: what are you having issues w/ regarding YAML?
21:13:01*stefanos82 quit (Quit: Quitting for now...)
21:13:01vivuszacharycarter: can YAML look like this: https://www.zerobin.net/?01c6c89d30b0c52c#61suUZ+NRDIgXWWxog1zqDeiKgUSbKQx2QKnRHMDwvU= ?
21:13:04*fredrik92 joined #nim
21:14:23*abm joined #nim
21:14:59zachcartervivus: yes you can have lists and associatons in YAML
21:15:21zachcarterI mean - that's not how you'd write the YAML to represent that - but it is definitely representable in YAML
21:15:29vivuszacharycarter: the online yaml validators say that my format is incorrect
21:16:23*couven92 quit (Ping timeout: 244 seconds)
21:16:41zachcarterwell - yes - I don't think you've written your example correctly using yaml
21:17:05zachcartervivus: may wnat to check out - https://learn.getgrav.org/advanced/yaml - or another tutorial on YAML
21:17:09zachcarterto get the basic syntax down
21:17:46vivushmmm, im not sure I want to yak-shave this. if it can't match my current format, i may be fighting against it to do so
21:18:00zachcarterAraq: regarding - https://forum.nim-lang.org/t/3755#23449 - I think there is value to adding ES6 constructs to the JS backend
21:18:07vivuszacharycarter: can my format be represented in a Nim data structure?
21:18:24zachcartervivus: yes - look at the tables module
21:19:19zachcarterfor instance - https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements - relies on ES6 classes - so without ES6 classes, you can't take advantage of custom elements
21:19:39FromGitter<alehander42> @vivus you can simply have ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8da56b58a3797aa3faa912]
21:20:54vivushmmm, I guess that might work too.
21:21:44FromGitter<alehander42> it depends, here I assume your categorie names are unique
21:22:45vivusthey are. each category is meant as a grouping for similar items. fruit, veg, flowers, trees, etc.
21:23:02FromGitter<alehander42> if you can have fruit, after that vegetable, after that fruit, then you might need to just have another field category: similar to name:
21:23:38*nsf quit (Quit: WeeChat 2.2)
21:23:46FromGitter<alehander42> but if order doesn't matter, yeah, then it should be fine like that ^(a dict/table)
21:23:57vivus@alehander42 could you save me 2 hours of time and tell me which example on nimyaml is the closest to the desired output, so that I can customize it
21:24:26vivus(the output you showed)
21:27:59FromGitter<alehander42> so, you want to generate this from nim data structures?
21:28:11FromGitter<alehander42> because otherwise this is the input
21:29:21vivusshould I use the "loading objects from yaml" example and work from there?
21:30:08FromGitter<alehander42> yeah
21:31:49FromGitter<alehander42> well, overally just remember the basis of yaml syntax: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and then you just define a type that maps to your yaml structure [https://gitter.im/nim-lang/Nim?at=5b8da845f86b741b0504ee0c]
21:32:01FromGitter<alehander42> it's similar with json etc
21:32:22seniwhat's the status with interfacing with C++?
21:33:17senicame across this post https://forum.nim-lang.org/t/363 but it's 4 years old
21:33:51zachcarterseni: yes you can bind / interop w/ C++ and Nim
21:34:20zachcarterseni: checkout c2nim and Sorry for necroing this thread - but that web components are close to reaching maturity, I think ES6 constructs are going to be crucial to Nim's JS backend moving forward.
21:34:24zachcarterFor instance - https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements - rely on ES6 classes.
21:34:35zachcarterugh my bad
21:34:47*tribly quit (Quit: WeeChat 2.2)
21:34:49zachcarterhad something on my clipoboard that I didn' tthink was there
21:34:58zachcarterseni: checkout c2nim | https://github.com/genotrance/nimgen
21:35:05*endragor joined #nim
21:35:34vivus@alehander42 and how do I get the category name? I am using that example, which seems almost identical to mine, except I also have category names
21:37:24*tribly joined #nim
21:37:49senizachcarter: thanks
21:37:57*kapil___ quit (Quit: Connection closed for inactivity)
21:38:04zachcarterseni: np
21:38:09*Vladar quit (Remote host closed the connection)
21:39:13*endragor quit (Ping timeout: 245 seconds)
21:40:38FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b8daa5611227d711d0efec5]
21:41:44FromGitter<alehander42> what is the type of your yaml ? it's a table of string(category name) => seqElement (or what you call them). you just need to pass the type to yaml to parse it
21:42:03FromGitter<alehander42> after that you can just iterate through the table or `[]`
21:43:39vivuswhy does Element, name and color all have * next to them?
21:43:47vivusname* color* ?
21:45:26zachcarterthat means they're exported
21:45:45vivusI still dont understand, sorry
21:47:16zachcarterit's an access modifier - it denotes whether the symbol is visible to other modules that import it
21:47:27zachcarterit's like public / private / protected in other programming languages like Java or C++
21:47:46zachcarterif the symbol isn't exported - it won't be available to other modules that import it
21:48:08vivusoh so it means its public
21:48:57zachcarterwell Nim doens't have the concept of public or private or protected - it's either exported or its not
21:49:17vivusbut exported means public right? I need a way to remember it
21:50:33FromGitter<metasyn> @vivus ^ yes, exported == available to other modules ~= "public"
21:51:24zachcartervivus: https://narimiran.github.io/nim-basics/ - might be a good guide to go through
21:51:35zachcarterexplains a lot of basics w/ Nim and is really well written
22:00:01*seni quit (Quit: Leaving)
22:37:43*xet7 quit (Quit: Leaving)
22:40:45Guest21953Hey, a question (probably to dom96 ?), if I stored future in a variable, then... how can I check that it failed (stuff already moved forward). Basically i "spawned" some `while true` loop but now I lost it's status completely
22:46:18*PrimHelios joined #nim
22:54:33*captainkraft quit (Ping timeout: 244 seconds)
23:14:41FromGitter<honewatson> @dom96 does httpbeast support https?
23:21:34zachcarterGuest21953: https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions
23:22:21zachcarterhonewatson: I don't see any reason it wouldn't - you could easily try by using devel nimble and https
23:24:22*pokk11 joined #nim
23:27:15*pokk11 quit (Remote host closed the connection)
23:28:29zachcarterhonewatson: https://gist.github.com/zacharycarter/92c38941845c05b8b0479a6c4cedc11f
23:30:09zachcarterwhoops
23:30:12zachcarterforgot the s lol
23:30:23zachcarterhrm - yeah apparently the request just hangs
23:31:09zachcarterthat's pretty limiting feature...
23:34:59FromGitter<honewatson> thanks zachcarter
23:35:14FromGitter<honewatson> you were right about graphql by the way
23:36:58zachcarterwhat about it?
23:37:22zachcarterhonewatson: https://gist.github.com/zacharycarter/92c38941845c05b8b0479a6c4cedc11f - updated example using actual https :)
23:37:26FromGitter<honewatson> it would be good if Nim had a graphql server
23:37:32zachcarterAh - yes - it would be :)
23:38:27*captainkraft joined #nim
23:38:40zachcarterI imagine it would be alot easier to produce w/ Nim than via Go - Nim's codegen capabilities are much more empowered due to templates | macros
23:39:32zachcarterhonewatson: I got the green light to use Nim at work - so I'm working on the web ecosystem atm - a GraphQL lib is definitely in my sights
23:39:43FromGitter<honewatson> ok thats cool
23:39:51zachcarterI just finished the majority of the port of - https://github.com/WebReflection/hyperHTML - over the weekend
23:40:10FromGitter<honewatson> Let me know when you begin GraphQL
23:40:11zachcarterwhich I think is going to be the next hotness to replace React | Vue | Angular, etc...
23:40:15zachcarterwill do
23:40:18FromGitter<honewatson> I might be able to help
23:41:03zachcarterthat'd be swell! once I get this tagged template literal library cleaned up, published, and documented - I imagine that will be my next endeavour
23:41:10FromGitter<honewatson> Would like to but young family so always committments
23:41:45FromGitter<honewatson> ok that is good regarding hyperHtml
23:41:45zachcarterI can't relate but I can empathize - I have two young nieces and they require all the world's attention whenever they're around :P
23:41:50FromGitter<honewatson> I wanted this in Nim
23:42:19zachcarterwell - I have this example compiling working now - https://viperhtml.js.org/hyperhtml/examples/#!fw=React&example=Hello%2C%20world%20%26%20tick
23:42:38zachcarterI have a lot of refactoring to do - I abused the hell out of toJs and to
23:42:41zachcarterin jsffi
23:42:51zachcarterbut it's working :D and it's doing exactly what hyperHTML does
23:43:03FromGitter<honewatson> nice work
23:43:06zachcarterthank you!
23:44:11zachcarterI'm now working on a macro for ES6 classes for Nim's JS target
23:44:21zachcarteras they're required for custom elements in the webcomponents spec
23:45:04zachcarterall this is going towards the next iteration of the Nim playground - which I plan to write using webcomponents / the library I just ported
23:47:55FromGitter<arnetheduck> anyone else having trouble bootstrapping? ```lib/system.nim(487, 35) Warning: unknown magic 'Exception' might crash the compiler [UnknownMagic] ⏎ lib/system.nim(709, 8) Warning: unknown magic 'NewSeqOfCap' might crash the compiler [UnknownMagic] ⏎ lib/system.nim(1930, 15) Error: invalid pragma: intdefine ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b8dc82b94f8164c17d8b3f9]
23:48:38zachcarterarnetheduck: I will give it a shot
23:49:20FromGitter<arnetheduck> git
23:51:49*PrimHelios quit (Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number)
23:52:31*PrimHelios joined #nim
23:52:42*zachcarter quit (Quit: Lost terminal)
23:52:57*zachcarter joined #nim
23:53:27zachcarterarnetheduck: `git clone https://github.com/nim-lang/Nim.git nimtest && cd nimtest && sh ./build_all.sh` works fine for me
23:54:45zachcarterunless that's not what you meant
23:55:19zachcarterI'm pretty sure build_all.sh boostraps the compiler though