<< 02-07-2016 >>

00:01:51*bacterius joined #nim
01:11:08*PMunch quit (Quit: leaving)
01:11:33*freezerburnv joined #nim
01:21:15*yglukhov quit (Remote host closed the connection)
01:33:18*chemist69_ joined #nim
01:36:09*chemist69 quit (Ping timeout: 250 seconds)
01:45:00*freezerburnv quit (Ping timeout: 244 seconds)
01:48:12*freezerburnv joined #nim
02:12:07*brson quit (Quit: leaving)
02:17:14*heretobang quit (Read error: Connection reset by peer)
02:57:15*Satyajit quit (Ping timeout: 258 seconds)
02:59:32*couven92 quit (Quit: Bye)
02:59:59*fredrik92 quit (Quit: Shutting down...)
03:03:52*Satyajit joined #nim
03:10:40*kssreeram joined #nim
04:06:47*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
04:16:11*freezerburnv quit (Ping timeout: 240 seconds)
04:23:13*tautologico joined #nim
05:01:56*OnO joined #nim
05:03:07*Lea2 joined #nim
05:03:07*M-Quora1 joined #nim
05:03:42*M-max1 joined #nim
05:04:49*tautologico quit (*.net *.split)
05:04:49*GangstaCat quit (*.net *.split)
05:04:49*Learath2 quit (*.net *.split)
05:04:50*OnO_ quit (*.net *.split)
05:04:51*M-max quit (*.net *.split)
05:04:51*M-Quora quit (*.net *.split)
05:04:52*EastByte quit (*.net *.split)
05:16:10*arnetheduck joined #nim
05:22:12*GangstaCat joined #nim
05:41:24*namnguyen quit (Ping timeout: 250 seconds)
05:41:49*namnguyen joined #nim
05:58:10*nsf quit (Quit: WeeChat 1.5)
06:26:11*kssreeram joined #nim
06:37:38*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
06:55:56*namnguyen quit (Ping timeout: 250 seconds)
07:00:24*akamaus joined #nim
07:08:48*namnguyen joined #nim
07:20:12*namnguyen quit (Ping timeout: 250 seconds)
07:22:03*bacterius quit (Ping timeout: 240 seconds)
07:23:25*bacterius joined #nim
07:32:13*namnguyen joined #nim
07:34:59*fastrom joined #nim
07:37:22*arnetheduck quit (Ping timeout: 244 seconds)
07:51:23*Trustable joined #nim
08:00:40*brechtm joined #nim
08:01:48*chemist69_ quit (Ping timeout: 250 seconds)
08:02:07*chemist69_ joined #nim
08:12:44*Guest43177 is now known as wuehlmaus
08:23:28*namnguyen quit (Ping timeout: 250 seconds)
08:26:18*namnguyen joined #nim
08:27:21*Flox42 quit (Remote host closed the connection)
08:27:21*M-max1 quit (Read error: Connection reset by peer)
08:27:21*M-Quora1 quit (Read error: Connection reset by peer)
08:27:21*M-cpt quit (Write error: Connection reset by peer)
08:31:06*der-landgraf quit (Quit: WeeChat 1.5)
08:32:08*Flox42 joined #nim
08:37:45*yglukhov joined #nim
08:50:01*TheLemonMan joined #nim
08:56:41*brechtm quit (Remote host closed the connection)
09:02:50*brechtm joined #nim
09:04:57*nsf joined #nim
09:15:22*brechtm quit (Remote host closed the connection)
09:21:41*desophos quit (Read error: Connection reset by peer)
09:23:21*brechtm joined #nim
09:24:43*bacterius quit (Quit: Leaving)
09:29:51*Demon_Fox quit (Quit: Leaving)
09:36:37*Matthias247 joined #nim
10:20:35*M-Quora joined #nim
10:20:42*M-max joined #nim
10:26:10*ozra quit (Remote host closed the connection)
10:38:50*yglukhov quit (Remote host closed the connection)
10:41:14*yglukhov joined #nim
10:53:13*brechtm quit (Remote host closed the connection)
11:25:04*heretobang joined #nim
11:30:52*rolha joined #nim
11:32:49*CcxCZ quit (Ping timeout: 250 seconds)
11:36:10*CcxCZ joined #nim
12:03:07*rolha quit (Ping timeout: 258 seconds)
12:10:13*jeffc quit ()
12:21:01*fredrik92 joined #nim
12:32:28ftsfhmm can I alias a variable in nim? eg. <something> foo = bar.baz and then use foo as an alias for bar.baz?
12:39:31dom96ftsf: template foo = bar.baz
12:44:56ftsfdom96, hmm never thought of that
12:45:13ftsfdoesn't seem to have quite the same effect, is there a way to see what code it would generate?
12:45:31dom96might need to add the {.immediate.} pragma in there
12:56:23ftsfmmm doesn't seem to do the trick Error: value of type 'Bar' has to be discarded
12:58:54dom96ftsf: hrm, maybe: template foo: expr {.immediate, dirty.} = bar.baz ?
12:59:32ftsf\o/ that does the trick
12:59:44dom96you might not need those pragmas, experiment with them :)
13:00:14ftsfyeah, doesn't seem to need the pragmas, just the expr
13:00:34dom96cool
13:01:26ftsfnow to understand why that works =)
13:06:47*Senketsu joined #nim
13:28:11*fredrik92 quit (Ping timeout: 244 seconds)
13:33:45vktecIs c2nim a good tool for writing Nim wrappers for C libraries? It doesn't seem very clear to me...
13:33:59vktecs/writing/helping to write/
13:44:35*rolha joined #nim
14:00:05heretobangi woke up soooooooooooo early today (4:30am)
14:00:45heretobangi had breakfast at 4:30 actually... i woke up at 4am
14:01:00heretobangso its lunch time for me and theres nothing to freakin eat
14:04:35*fredrik92 joined #nim
14:06:03*rolha quit (Ping timeout: 240 seconds)
14:06:07*brechtm joined #nim
14:07:23vktecAny ideas as to why this code doesn't work? https://gist.github.com/vktec/f556e67cc7b410460ffec5000397867b
14:17:18federico3how to align unicode chars to print a 2D table? align() is not working
14:18:12*brechtm quit (Remote host closed the connection)
14:21:58vktecfederico3: I'm not quite sure what you mean by "align unicode chars". Could you provide a code example or explain what you're trying to do in more detail?
14:22:43dom96vktec: how are you compiling that?
14:23:28federico3echo align("\u2192", 4) prints " →"
14:24:24vktecdom96: nim c -r nim_c_func.nim
14:25:10dom96vktec: try naming your .c file something else
14:25:45vktecI've already renamed it from nim_c_func.c to nim_c_func_c.c
14:26:08vktecI noticed that it was using the same object file twice before, but this is a different error
14:28:31vktecfederico3: That unicode char takes up 3 bytes, but only displays as one character. Not sure how to fix it, but that's what's causing the issue
14:28:36*brechtm joined #nim
14:29:35vktecfederico3: What are you trying to achieve?
14:29:39dom96vktec: hrm, not sure then, maybe this can help? http://nim-lang.org/docs/backends.html#nim-code-calling-the-backend-c-invocation-example
14:31:21TheLemonManfederico3, you have to use wc(s)width to obtain the effective width
14:34:30vktecdom96: Notice the "undefined reference to`main`"? Turns out it won't compile if I don't have anything that actually does something :D
14:34:32*merowinger joined #nim
14:34:42vktecAdding `echo "Hi"` to the end made it compile
14:35:02dom96vktec: interesting
14:35:07vktecYeah
14:35:19dom96worth a bug report I think
14:35:23vktecYou would've thought Nim would add an empty main() or something
14:35:40vktecdom96: Shall I submit a GH issue?
14:35:44dom96yeah
14:36:10ftsfhmm math.PI seems like a bug, with the non uppercase constants thing
14:42:11vktec0_o Now, when trying to write the simplest possible code to reproduce it, it works absolutely fine
14:42:35vktecBasically all I've changed is the names of the functions now...
14:42:37vktec1 sec
14:42:53vktecNow that is _really_ wierd
14:43:02vktecMy original code now works absolutely fine
14:45:27*rolha joined #nim
14:45:28merowingerfederico: see https://github.com/qqtop/NimCx/blob/master/cx.nim#L1653
14:50:49*merowinger left #nim (#nim)
14:52:16vktecCan I detect the number of required and optional arguments of a proc using a macro?
14:53:34*GangstaCat quit (Quit: Leaving)
14:54:31*ilguappo joined #nim
15:01:31dom96vktec: likely something in the nimcache remained then
15:01:40vktecdom96: Yeah, probably
15:01:44dom96probably because your .c file had the same name
15:02:29vktecMost likely
15:02:41*ilguappo left #nim (#nim)
15:11:03*maus joined #nim
15:12:09*xet7 joined #nim
15:14:15*akamaus quit (Ping timeout: 264 seconds)
15:19:27*namnguyen quit (Ping timeout: 250 seconds)
15:22:28*brechtm quit (Remote host closed the connection)
15:24:56*brechtm joined #nim
15:25:13*elrood joined #nim
15:27:12*Matthias247 quit (Quit: Matthias247)
15:27:48*Matthias247 joined #nim
15:32:19*namnguyen joined #nim
15:32:22*maus quit (Ping timeout: 260 seconds)
15:45:18*gdelazzari joined #nim
15:51:24*gdelazzari quit (Quit: Page closed)
15:59:06*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
16:06:32*brechtm quit (Remote host closed the connection)
16:08:15*brechtm joined #nim
16:13:03*rolha quit (Ping timeout: 264 seconds)
16:16:44*rolha joined #nim
16:21:47*_stowa joined #nim
16:22:42Araqhi _stowa welcome
16:23:07*Matthias247 quit (Quit: Matthias247)
16:23:42*_stowa quit (K-Lined)
16:24:44*brechtm quit (Remote host closed the connection)
16:27:43*brechtm joined #nim
16:28:56*desophos joined #nim
16:41:28*PMunch joined #nim
16:56:59*Matthias247 joined #nim
17:07:25*fredrik92 quit (Quit: Shutting down...)
17:08:06*brechtm quit (Remote host closed the connection)
17:28:33*Satyajit quit (Remote host closed the connection)
17:31:48*Satyajit joined #nim
17:37:43*xet7 quit (Quit: Leaving)
17:38:05*Matthias247 quit (Read error: Connection reset by peer)
17:38:51*desophos quit (Ping timeout: 240 seconds)
17:45:24*blackdolphin joined #nim
17:48:56*arnetheduck joined #nim
17:55:04*GangstaCat joined #nim
17:58:03*arnetheduck quit (Ping timeout: 240 seconds)
18:05:10*jefuss joined #nim
18:22:19*Trustable quit (Remote host closed the connection)
18:23:17zdsWhat nim type maps most closely to Erlang atoms, or clojure keywords - just a minimal unique value with no semantics of its own?
18:25:30*rolha quit (Ping timeout: 272 seconds)
18:29:02PMunchFrom Erlang doc: An atom is a literal, a constant with name.
18:29:13PMunchSo const in Nim I guess
18:31:22PMunchzds ^
18:32:04zdswell, fair enough... I guess I was not referring to that quality of atoms :) So let's say, what maps most closely to ref()s in Erlang :) That is, if at runtime you want to generate some value, and you want it to be minimal in size, and have only one property: identity, so that you can check if A == A and not much else, what would you use?
18:32:43PMunchA distinct int type would work pretty well for that
18:33:20PMunchA bit depending on what you need it for of course. You could even use an int8 if space is truly an issue and you don't have that many to identify
18:34:41PMunchOr did you want to give them names as well?
18:35:01zdsnames are not necessary
18:35:26PMunchI guess you could use a distinct int type. Then write a pretty little macro that would hash whatever name you gave it (compile time of course, as all macros) and output a number
18:36:25zdsYeah, I guess I was just wondering if there was a way to do it without writing the procs myself that are in charge of generating new values
18:36:58zdsie, if I could get away without writing a closure that just starts at 0 and increments it each time its called
18:38:17PMunchJust a sec
18:39:12PMunchhttps://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#closure-iterators
18:39:37PMunchThere, that seems pretty much like the exact thing you're asking for :)
18:42:32PMunchSo basically you do something like this:
18:42:33PMunchpastebin.com/cJTKgsjH
18:42:44PMunchNOTE: I simply wrote that into pastebin, never actually ran it
18:46:41PMunchHmm, I guess you don't really need the proc at all tbh.
18:47:20PMunchpastebin.com/XiaW4nev
18:47:21PMunchThere
18:47:30PMunchThat prints 1, 2 ,3
18:48:42PMunchNote that it will wrap around at int.high if that's of any concern to you :P
18:48:42zdsYep, that seems like the most idiomatic way. Thanks for diving in!
18:49:09PMunchNo problem, still learning Nim myself and digging around to answer questions is a great way to learn :)
18:50:27PMunchNote that you can pass the iterator around. So you can supply it to functions and return it from within a function
18:51:11PMunchNot 100% sure what would happen if you passed it to multiple threads though..
18:51:51PMunchDon't think iterators are inherently thread-safe but if you wrap it in a mutex then you could get consistent numbering between threads.
18:51:57*blackdolphin quit (Quit: Leaving)
19:00:46*rolha joined #nim
19:25:09*jefuss quit (Ping timeout: 250 seconds)
19:40:11PMunchhttp://pastebin.com/MB3XfXTN
19:40:20PMunchCan anyone help me with that?
19:41:09PMunchI'm trying to get the highest set bit of an integer in the fastest possible way.
19:42:43*kssreeram joined #nim
19:51:25*gokr quit (Quit: Leaving.)
19:51:40*gokr joined #nim
19:53:55PMunchScratch that, went for a simple shifting loop instead..
19:54:12PMunchBut, given a sequence of elements. How can I return a reference to one of them?
19:54:36*jefuzz joined #nim
20:00:27*ephja joined #nim
20:25:13*jefuzz quit (Quit: soundcloud.com/wacastle)
20:25:55*jefuzz joined #nim
20:32:30*GangstaCat quit (Quit: Leaving)
20:36:24*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:45:37PMunchHow come uints can't be used for division?
20:53:19dom96Can't they?
20:53:53*Ven joined #nim
20:54:03PMunchApparently not
20:55:50PMunchJust try to declare two uints and divide them
20:56:51PMunchpastebin.com/LtTBtAGu
20:57:18PMunchThat's the error message, apparently only ints, floats, and float32s are divisable..
20:57:37PMunchAnd both got to be the same type, so you can't divide an int by a float
20:57:41PMunchWhich is pretty silly
21:01:48PMunchBut I'm off now
21:01:50*PMunch quit (Quit: leaving)
21:05:19*desophos joined #nim
21:06:09*Matthias247 joined #nim
21:06:13kier_for future reference, / is the floating point division operator. integer division is `div`. not sure why / is implemented for ints
21:12:18*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:33:04*xet7 joined #nim
21:40:11*xet7 quit (Quit: Leaving)
21:43:36ephjais there a fast cross-platform way to get the size of a file?
21:43:54ephjanevermind
21:47:17*gokr quit (Ping timeout: 250 seconds)
21:51:19*xet7 joined #nim
21:58:15ephjadom96: are you aware of the issue where Aporia only captures the compiler output in some cases?
21:58:46dom96nope?
21:59:21dom96is it purely random?
21:59:39ephjayes
22:01:51ephjaI'll report it then. I couldn't find any related issues
22:03:43ephjahm why is the US keyboard layout being used
22:03:48*ephja quit (Read error: Connection reset by peer)
22:06:10*elrood quit (Quit: Leaving)
22:09:11*ephja joined #nim
22:23:27ephjadom96: any idea why output is slow? how would I profile this?
22:26:14ephjaI'll see if ESTP is working
22:57:01*GangstaCat joined #nim
23:11:39*rolha quit (Ping timeout: 258 seconds)
23:34:01*Matthias247 quit (Read error: Connection reset by peer)
23:41:35*afriginelf joined #nim
23:44:09*afrigginelf joined #nim
23:44:42*heretobang quit (Ping timeout: 250 seconds)
23:47:18*afriginelf quit (Ping timeout: 250 seconds)
23:47:44*afriginelf joined #nim
23:49:28*afrigginelf quit (Ping timeout: 250 seconds)
23:57:53*afrigginelf joined #nim
23:58:55*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
23:59:21*bjz joined #nim