<< 18-07-2014 >>

00:12:04*mhitza joined #nimrod
00:19:33*brson quit (Ping timeout: 240 seconds)
00:41:57*q66 quit (Quit: Leaving)
00:42:38*askatasuna quit (Ping timeout: 240 seconds)
01:05:26*ics joined #nimrod
01:26:40*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:33:49*nande quit (Read error: Connection reset by peer)
01:35:43*AMorpork joined #nimrod
01:49:53adoniscikwhy is "it" considered undeclared here? result = zip(@x, @y).mapIt(float, it[0] + it[1])
01:50:18adoniscikif I've imported sequtils
01:52:09*nande joined #nimrod
01:59:00def-adoniscik: probably because you have some generic variables around
02:00:42adoniscikx and y are openarrays, and the proc is seq
02:00:52adoniscikwhich of them is the generic, def- ?
02:01:09def-show me the full code and I can tell you
02:05:19mhitzaif I where to look for manual memory management and C interop, what is the best place to start? (google didn't really help)
02:05:26*BlameStross quit (Quit: BlameStross)
02:07:19def-mhitza: for manual memory management you would use the alloc* procs in http://nimrod-lang.org/system.html
02:08:13def-mhitza: for C interop I wrote a few examples on rosetta code:
02:08:15def-http://rosettacode.org/wiki/Call_a_foreign-language_function#Nimrod
02:08:18def-http://rosettacode.org/wiki/Call_a_function_in_a_shared_library#Nimrod
02:08:22def-http://rosettacode.org/wiki/Use_another_language_to_call_a_function#Nimrod
02:08:41def-And for semi-automatic conversion of c-headers: http://nimrod-lang.org/c2nim.html
02:17:35*kshlm quit (Quit: Konversation terminated!)
02:19:57*adoniscik quit (Ping timeout: 250 seconds)
02:23:39*BlameStross joined #nimrod
02:35:48mhitzadef-, thanks I will have a look at those
02:42:30*saml_ joined #nimrod
02:56:24*bjz joined #nimrod
03:00:53def-Yay, bigints finally kind of seem to work, this (correctly) calculates as many digits of pi as you want and takes about 4 times as long as the C GMP version: https://github.com/def-/bigints/blob/master/pidigits.nim
03:11:49saml_that's amazing
03:12:49def-got another speedup, only 3 times as slow as GMP now
03:18:19*adoniscik joined #nimrod
03:41:16flaviudef-: I want to have some fun too! Can you push? I get a OOB
03:42:16flaviuOh, nm
03:51:37def-flaviu: pull again, it's a bit nicer now, without the bigint constants
03:51:40def-and good night
03:52:00def-oh, and here's the C if you want to compare: http://benchmarksgame.alioth.debian.org/u64/program.php?test=pidigits&lang=gcc&id=1
03:56:58*ics joined #nimrod
04:04:21flaviudef-: Still here? Try copy-pasting multiplication from https://github.com/blamestross/nimrod-BigInt/blob/master/bigints.nim
04:04:30flaviuShort, elegant, and moves the bottleneck to newSeq
04:06:05BlameStrossdef-: Be carefull, we might have different endian-ness and chunk-size
04:06:22BlameStrossdef-: And the rest of the code is a bit crap.
04:06:26flaviuDoes endianness matter here?
04:06:31BlameStrosssorta
04:06:35flaviuNo messing around with bytes
04:07:01BlameStrossyeah, but what if my high bits or at the 0 of the seq versus the end of the seq
04:07:22flaviuShr/shl doesn't care about endian from what I've heard
04:09:23BlameStrosss/or/are
04:10:43*xenagi quit (Quit: Leaving)
04:10:46BlameStrossnever assume somebody who has no idea what you they are doing will order and arrange things in a pattern that seems natural to you.
04:11:00BlameStrossI learned that grading undergrad assigments.
04:12:28flaviuHave you seen kcachegrind?
04:12:42flaviuI think I've mentioned it
04:13:28flaviuAnyway, it gives a graphical overview of the output of callgrind, and it can be configured to give you the nimrod source line!
04:18:46flaviuBlameStross: Does shl work in your code?
04:20:01flaviuThings seem to have gotten into an infinate loop, seems not
04:20:09flaviuAnyway, its time for me to sleep
04:20:26*kshlm joined #nimrod
04:20:37*flaviu quit (Quit: Leaving.)
04:24:45VarriountMeep.
04:24:53VarriountHi kshlm
04:45:15adoniscikwhy does this not work? http://pastebin.com/B9wcYS9j
04:48:55fowladoniscik, try float(it[0] + it[1])
04:51:15adoniscikno dice, but echo zip(@[-3.0,4.0,0.0], @[1.0,2.0,3.0]).mapIt(float, it[0] + it[1]) works
04:51:33adoniscikit seems to be the proc signature?
04:52:31fowlwell read the error message
04:52:33fowland share it
04:52:45adoniscikundeclared identifier: 'it'
04:53:08adoniscikreferring to the line 5: result ...
04:56:02fowladoniscik, something is broken
04:56:32adoniscikdo you get the same error?
04:56:34fowlthe example in the documentation for mapit works, this should too
04:56:45fowlyea
04:57:11fowlyou should submit an issue for it
04:57:31adoniscikI can't get it to work with => in future either: http://nimrod-lang.org/future.html
04:57:36adoniscikmaybe you'd like totake a crack at that
05:00:08fowlthe overload inference is not quite right for => yet, to use it with map you have to specify the type like numbers.map((n:int) => $n)
05:00:49fowl(n) => $n wont work here
05:02:42adoniscikecho zip(@[-3.0,4.0,0.0], @[1.0,2.0,3.0]).map do (t: tuple) -> float : t[0] + t[1] also worked
05:04:12*Varriount_ joined #nimrod
05:04:14adoniscikbut not inside the function :(
05:04:28fowladoniscik, make an issue for the mapIt bug please
05:04:37fowlgood night
05:04:44adoniscikI will as soon as I get somethng working! good night
05:05:07adoniscikI can't tell the bugs from my mistakes yet
05:05:19fowli suggest the do syntax (the last one you showed)
05:05:39fowllooks the nicest imo
05:05:46fowlgn
05:05:49adoniscikbyer
05:07:47*Varriount quit (Ping timeout: 264 seconds)
05:08:31*Varriount_ is now known as Varriount
05:08:49Varriountadoniscik: Just an fyi, I'm still here.
05:09:13adoniscikthat's nice, so am I :)
05:11:08adoniscikwell the function definition passes the compiler, but I get a type expected error when I try to invoke it with echo [-3.0,4.0,0.0] + [1.0,2.0,3.0]
05:11:58adoniscikso it doesn't match proc `+`[T] (x, y: openarray[T])?
05:12:15VarriountHm. Possibly. Let me try something.
05:12:49adoniscikhow can I get the signature of a statement?
05:12:56adoniscikif it's possible, of course
05:13:27VarriountWell, you could trying forcing calling the procedure
05:13:54adoniscikwould that be echo `+`([-3.0,4.0,0.0], [1.0,2.0,3.0])?
05:14:19*saml_ quit (Quit: Leaving)
05:14:25adoniscikokay without the `
05:14:28VarriountI think. Or you could just rename the procedure to not be an operator.
05:15:00adoniscikgood idea. Error: type mismatch: got (proc (seq[S], seq[T]): seq[tuple[a: S, b: T]])
05:15:40adoniscikwait a minute, I thought [1,2,3] was an array, not seq?
05:15:46Varriountadoniscik: Could you gist the current version of your code?
05:16:48adoniscikhttp://pastebin.com/fvLLECit
05:18:00adoniscikwhy two generics, S and T? maybe that's it
05:20:31VarriountZip takes two unique sequences, and returns a tuple with an item from those sequences.
05:21:05adoniscikgreat?
05:23:56adoniscikrecall that both echo zip(@[-3.0,4.0,0.0], @[1.0,2.0,3.0]).map do (t: tuple) -> float : t[0] + t[1] and echo zip(@[-3,4,0], @[1,2,3]).mapIt(int, it[0] + it[1]) work
05:24:13adoniscikit's just the function that doesn't, for some reason
05:26:14*Ven joined #nimrod
05:27:47adoniscikarg, a typo: @ in front of zip
05:28:07VarriountI thought that was intentional?
05:28:30adoniscik@zip does something?
05:28:44Varriount*shrug*
05:28:47adoniscikzip already returns a seq
05:29:10adoniscikand I thought @ is the seq operator
05:29:14adoniscikbut I might be mistaken about that
05:29:20VarriountNo, it is.
05:29:51VarriountI was under the erroneous impression that zip was an iterator, and the @ operator was to turn it into a sequence.
05:29:52*Ven quit (Client Quit)
05:30:12adoniscikIf I get this working I'll be interested in the iterated version :)
05:31:27adonisciknow i just get Error: ambiguous call; both system.+(x: float, y: float): float and system.+(x: float, y: float): float match for: (float, float)
05:31:40adoniscikbut these are the same things so what's the problem?!
05:31:51adoniscikthat really looks like a bug
05:33:37adoniscikso I'll let it rest until somebody else takes a look
05:33:51adonisciktwo bugs for one night's good work!
05:34:12Varriountadoniscik: Two? What was the first?
05:35:11Varriountadoniscik: Let me see if I can modify the compiler to shine a bit more light on things...
05:36:08adoniscikthe other was the error: undeclared identifier: 'it', when you replace the proc with result = zip(@x, @y).mapIt(int, it[0] + it[1])
05:36:51adoniscikyet mapIt works without the function, just like the other cases...
05:37:06adonisciksomething gets screwed up in the proc
05:37:11adoniscikthanks
05:37:36Varriountadoniscik: Generics are tricky to compute, since their scoping rules are different from regular procs.
05:42:16Varriountadoniscik: It looks like a bug in semcall.resolveOverloads
05:47:49*dushan42 joined #nimrod
05:51:16adoniscikawesome that you have an idea where the bug is; I'm just a user. Give me a working compiler and I'll write the libraries :)
06:01:17Varriountadoniscik: To be honest, the compiler is quite a complex beast. I'm much more succesful with stdlib errors, since those are usually much, much simpler to fix.
06:02:15VarriountI'm just guessing that's where the bug is, since that's the location in the compiler code the ambiguity error is thrown.
06:11:02Skrylari'm fairly useless in that i don't fix core bugs, i just write nimrod code :F
06:11:17Skrylaractually i was considering bringing over some random number generators
06:32:38*adoniscik quit (Ping timeout: 240 seconds)
06:32:51*kunev quit (Ping timeout: 256 seconds)
06:33:27Skrylarhah. i just thought about how one could abuse the siphash routine i ported to be an RNG
06:33:50Skrylarjust toss the seed through siphash and take bits out of the returned hash, recycle the hash back through siphash
06:33:56Skrylarits already a cryptographic function
06:43:13*Demos quit (Read error: Connection reset by peer)
07:12:22*io2 joined #nimrod
07:20:15*kemet joined #nimrod
07:21:39*kemet quit (Client Quit)
07:23:32*kemet joined #nimrod
07:42:05*Trustable joined #nimrod
07:44:40*nande quit (Remote host closed the connection)
07:45:15*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
07:56:35*ics quit (Ping timeout: 240 seconds)
07:56:56*kemet quit (Remote host closed the connection)
07:59:06*ics joined #nimrod
08:20:33*q66 joined #nimrod
08:20:40*kunev joined #nimrod
08:41:48*adoniscik joined #nimrod
09:06:49*Matthias247 joined #nimrod
09:08:23*Fr4n quit (Ping timeout: 264 seconds)
09:11:44*BitPuffin quit (Ping timeout: 250 seconds)
09:19:00*caribou| joined #nimrod
09:19:47adoniscikwhat is the signature for a proc that accepts two openarrays and returns a seq?
09:21:59*Fr4n joined #nimrod
09:28:17*BitPuffin joined #nimrod
09:28:38*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:32:42*BitPuffin quit (Ping timeout: 245 seconds)
09:50:46*mhitza quit (Remote host closed the connection)
10:04:03def-adoniscik: proc[T](x, y: openarray[T]): seq[T]
10:04:23adoniscikright, what I had. I discovered something interesting
10:05:29adoniscikcheck this out: http://pastebin.com/RTVKaHEE
10:07:01adoniscikthis fails with cannot instantiate: 'T'
10:07:03adoniscikwhy is that?
10:08:26adoniscikand if you remove the parentheses around the arrays it fails with type expected
10:08:49def-well, you can't remove the parantheses
10:09:27adoniscikI can live with that, but not the generics
10:09:32adoniscikor rather, without the generics
10:09:53def- result = zip(@x, @y).map(proc (a: tuple[a, b: T]): T = a[0] + a[1])
10:10:20adoniscikhah
10:11:20adoniscikthanks, def- , now I can sleep well :)
10:11:46def-this also works:
10:11:47def- result = zip(@x, @y).map do (c: tuple[a, b: T]) -> T: c[0] + c[1]
10:11:59def-you're welcome
10:12:14adoniscikyeah weird. why c and not a and b?
10:12:17adoniscikI did not understand that
10:12:25adoniscikI thought c was the function
10:12:31def-hm?
10:12:41def-c is a tuple containing values a and b
10:12:46def-for c[0] you can also write c.a
10:12:50def-for c[1] c.b
10:13:17adoniscikaha, got it. clarity achieved!
10:13:37adoniscikbye for now
10:13:49adoniscikone more thing
10:13:57adoniscikwhy did you need the parentheses for echo again?
10:14:08adoniscikecho 1+2 works, after all
10:14:49def-i guess otherwise it means (echo a) + b
10:15:19def-i don't know, the square brackets might change something there
10:15:34def-I always find it difficult to know when i can write something without brackets and when not
10:15:54adoniscikecho 1+2 does not mean (echo 1)+2 so something else is going on. maybe the brackets, like you said
10:22:55*adoniscik quit (Ping timeout: 256 seconds)
10:29:18*kshlm quit (Ping timeout: 250 seconds)
10:32:59*Matthias247 quit (Read error: Connection reset by peer)
11:26:05*Matthias247 joined #nimrod
11:27:38*jez0990_ quit (Quit: No Ping reply in 180 seconds.)
11:27:54*jez0990 joined #nimrod
11:53:41*Araq_ joined #nimrod
11:55:04Araq_hmm looks like the mapIt bug/language design problem should get some high priority
12:00:44io2offtopic right now, but is anybody working on the website?
12:01:31io2looks like we could be having some nicer layout; the eye needs its part after all
12:05:50*saml_ joined #nimrod
12:08:22Araq_io2: er ... the website is really nice now
12:08:25Araq_what
12:08:31Araq_is wrong with it?
12:09:14io2if you think it is ok, I guess I shouldn't bring about the subject that it is really dull to look at
12:09:25io2I am seeing sites for other languages
12:09:29io2like scala-lang.org
12:09:44io2most stuff is bootstrap based anyway
12:10:06io2which means that there isn't much trouble in skinning them in a visually appealing way, but I digress.
12:16:12Araq_Varriount: can you please go through the list of bugs and close the closure related bugs that work now?
12:33:05*untitaker quit (Ping timeout: 240 seconds)
12:35:04*q66_ joined #nimrod
12:35:58*q66 quit (Ping timeout: 240 seconds)
12:37:19woodgiraffeI have to say that I find these constant religious denotations very offputting, I mean nimrod I can live with, but babel package manager?
12:38:58*saml_ quit (Quit: Leaving)
12:39:21*untitaker joined #nimrod
12:40:18*q66_ quit (Ping timeout: 240 seconds)
12:42:28*q66_ joined #nimrod
12:42:48*q66_ is now known as q66
12:47:14OrionPKlol
12:47:46OrionPKyou just missed the channel's daily call to prayer woodgiraffe
12:48:00woodgiraffeOrionPK: I wouldn't be surprised
12:49:30Araq_well ... if it helps you ... I
12:49:38Araq_am not religious
12:58:47flyxwoodgiraffe: it's just names from some story. the language could as well be named Mithrandir
13:03:00*xenagi joined #nimrod
13:07:48*BitPuffin joined #nimrod
13:14:58woodgiraffeIf you make it a tradition to name your projects from the hebrew bible, you shouldn't be surprised when people expect religious intent - if you're not religious, then I find it strategically clumsy, because you're unnecessarily bringing religious/cultural connotations into the equation.
13:17:24woodgiraffeAnd really, I mean... babel package manager
13:18:33skrolland what's the deal with airline food?
13:19:27woodgiraffeTry calling it mecca package manager and try arguing the same case
13:19:53woodgiraffeAnd then I guess you call your language Muhammad :)
13:22:17flyxwoodgiraffe: you do realize that babel isn't exactly a holy place in the hebrew bible, and nimrod is not exactly a holy man?
13:24:33woodgiraffeflyx: Well, still they're just names from some story right?
13:24:55*darkf quit (Quit: Leaving)
13:26:14flyxyes, and they are not names whose name would be considered heretic by anyone who believes in the bible
13:26:31flyx*usage
13:40:10*leru joined #nimrod
13:50:19*[1]Endy joined #nimrod
13:52:19flyxeven if there was religious intent… it's not like the license tells you that you must believe in any god in order to use it. a language is a tool, it's up to you to decide what to use it for.
13:52:52flyxI don't really see that it could cause any problems
13:53:47OrionPKthere's been talk of renaming the language to "nim" which im heavily in favor of, but not because nimrod is from the bible :P
13:54:31flyxthen for what reasons?
14:00:59Araq_flyx: it sounds better and is not a common english term
14:01:15*Araq_ quit (Quit: ChatZilla 0.9.90.1 [Firefox 29.0/20140421221237])
14:02:00flyxwell, as long as it's not too short for Google to index it… why not
14:03:45woodgiraffeI'd absolutely contribute to the Chimpsky package manager :)
14:16:55*X-Scale quit (Ping timeout: 272 seconds)
14:18:57*BitPuffin quit (Ping timeout: 245 seconds)
14:31:38*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
14:36:20*Mat3 joined #nimrod
14:36:22Mat3hello
14:39:23*BitPuffin joined #nimrod
15:27:23*bjz joined #nimrod
15:30:06*Mat3 quit (Quit: Verlassend)
15:31:45*bjz quit (Client Quit)
15:47:06*Matthias247 quit (Ping timeout: 240 seconds)
15:52:45*Matthias247 joined #nimrod
15:53:17*mwbrown joined #nimrod
15:59:01*cariboo joined #nimrod
16:02:33*caribou| quit (Ping timeout: 255 seconds)
16:06:44*X-Scale joined #nimrod
16:07:18*kunev quit (Ping timeout: 250 seconds)
16:07:29*Jesin quit (Quit: Leaving)
16:07:58*[1]Endy quit (Quit: HydraIRC -> http://www.hydrairc.com <-)
16:08:16*[1]Endy joined #nimrod
16:08:29*saml joined #nimrod
16:16:17*Jehan_ joined #nimrod
16:16:37*Jesin joined #nimrod
16:18:41*flaviu joined #nimrod
16:24:42samlgonna learn nimrod
16:26:26flaviuSomeone once talked about naming it N
16:26:35flaviuSomehow that name isn't taken
16:27:12samlokay i installed nimrod
16:31:01Jehan_flaviu: That was me, and I was making a joke. :)
16:31:16flaviuWell, I'm serious
16:32:19flaviuWe can also snag A
16:32:55Jehan_flaviu: Let me be the first to point out that this would be horrible for search engines. :)
16:33:07flaviuAlang
16:33:19flaviuoh, indian town
16:33:19Jehan_Though it might inflate the Tiobe index.
16:34:10flaviunlang is just some obscure word, it'd work
16:35:37flaviuAnyway, with nimrod, google thinks I'm a conspiracy theorist by the results that show up
16:36:49Jehan_What brought up that debate, anyway? Let me look at the log ...
16:37:00*BitPuffin quit (Quit: See you on the dark side of the moon!)
16:37:51Jehan_Oh, renaming Nimrod to Nim. Hmm. I wouldn't have a problem with it, but don't really care much either way.
16:38:31*BitPuffin joined #nimrod
16:40:48*Demos joined #nimrod
16:41:09*[1]Endy left #nimrod (#nimrod)
16:50:30*Ven joined #nimrod
16:55:40*vendethiel joined #nimrod
17:05:25*ics joined #nimrod
17:06:00*adoniscik joined #nimrod
17:14:41*bjz joined #nimrod
17:16:39*q66 quit (Quit: Leaving)
17:17:01*q66 joined #nimrod
17:24:51*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:25:46*Jehan_ quit (Quit: Leaving)
17:35:13*leru quit (Ping timeout: 246 seconds)
17:36:47*wan joined #nimrod
17:54:43*Matthias247 quit (Read error: Connection reset by peer)
17:56:52Araqdom96!
17:58:38mwbrownflaviu: that nimrod by example website is brilliant btw
17:58:42mwbrownmuch easier to follow
17:59:36flaviuThanks, but I'm going to have to reorganize it significantly, some concepts are spread throughout.
18:19:02*brson joined #nimrod
18:26:43dom96Araq!
18:27:04Araqdom96: I had the idea of the millenium
18:27:30Araqwe rename nimrod to nim and babel to "babe" ;-)
18:28:34*brson quit (Ping timeout: 250 seconds)
18:30:10*silasm joined #nimrod
18:30:37adoniscikor ble, so you get nim ble :)
18:30:46adoniscikbel also works
18:33:01dom96what's wrong with 'babel'?
18:33:26adonisciknothing! is there a way to get sequtils proc like zip to return iterators?
18:33:30flaviudom96: Biblical connotations
18:34:23adoniscikI mean generators
18:34:46adoniscikso the entire data structure is not created
19:19:31*NimBot joined #nimrod
19:21:47*q66 quit (Quit: Leaving)
19:23:07*q66 joined #nimrod
19:27:16*q66 quit (Read error: Connection reset by peer)
19:45:58*ics quit (Ping timeout: 240 seconds)
19:48:00*ics joined #nimrod
19:55:09*xenagi quit (*.net *.split)
19:55:09*betawaffle quit (*.net *.split)
19:55:19*Demos quit (*.net *.split)
19:55:20*Skrylar quit (*.net *.split)
19:55:27*xenagi joined #nimrod
19:55:39*Demos joined #nimrod
19:55:45*Skrylar joined #nimrod
19:56:06*Jesin quit (Ping timeout: 250 seconds)
19:56:29*Johz joined #nimrod
19:56:55*betawaffle joined #nimrod
19:57:34*q66 joined #nimrod
20:05:56*Jesin joined #nimrod
20:20:18*goobles joined #nimrod
20:20:50dom96flaviu: Why is https://github.com/flaviut/nimrod-by-example/issues/14 unexpected behaviour?
20:21:08flaviuBecause the last element output is a 0
20:21:36dom96oh
20:21:54flaviuBTW, did you see the cosmic event or whatever here: https://app.wercker.com/#buildstep/53c974ad8e1c00643000f1c7 ?
20:22:17flaviuIt failed to build for no reason
20:22:45dom96solar radiation?
20:23:00flaviuI dunno, thats my best guess
20:23:03dom96More likely explanation is something else lol
20:23:25flaviuBut look at the diff: https://github.com/flaviut/nimrod-by-example/commit/8a5e62db02d64d0aa65718f9832be84f0b1b98d0
20:23:30flaviuPerfectly harmless
20:23:47*Fx00F joined #nimrod
20:24:20*q66 quit (Quit: Leaving)
20:24:45*q66 joined #nimrod
20:24:48flaviuEven if its unlikely, I choose to believe that since its the most exciting explanation :P
20:24:54dom96flaviu: I think that is the expected iterator behaviour
20:25:07dom96It returns default(T) to signify that it finished
20:25:38flaviuExpected behavior should be crashing
20:25:44dom96Why?
20:26:15flaviuThere isn't any reason you would intentionally use an expired iterator. Fail fast, don't give it a chance to mess more things up
20:26:26dom96There is a reason behind this behaviour.
20:26:32dom96If you have statements after the last yield
20:26:40dom96The iterator has to return something
20:27:30dom96Which is what happens in your code.
20:27:31flaviuMake statements after the last yield illegal then
20:27:38dom96You have an 'inc'
20:28:33flaviuBut why should that be run?
20:28:40dom96side effects
20:29:24dom96It's just one extra iteration anyway
20:29:27dom96It won't kill anyone.
20:29:45dom96wooh. 74. New user total record!
20:30:02flaviuStill not happy, I'm sure there's a better solution.
20:40:48def-flaviu: when i compile nimrod-by-example by hand using nanoc i don't get an error
20:41:17flaviudef-: the error happened randomly, without reason
20:41:24def-yeah, weird
20:41:46flaviuI like to think it was a cosmic ray flipping a bit :D
20:59:54*Ven joined #nimrod
21:03:25*vbtt joined #nimrod
21:04:20vbtthello friends
21:05:08vbttflaviu:going thru the nimrod-by-example in detail now. it's great.
21:05:13vbttlearning some things myself :)
21:05:35vbttbtw, is the 'T' prefix for types still the encouraged convention?
21:06:53dom96I don't think so.
21:06:57dom96But I still use them
21:07:24vbttperhaps nimrod-by-example should use the recommended styles :)
21:08:44vbttflaviu:first example in http://nimrod-by-example.github.io/for_iterators/ shows pairs being used but not items? why not?
21:09:15flaviuvbtt: items is being used, look inside pairs
21:09:46Jehan_vbtt: The T/P prefixes are going to become obsolete at some point.
21:09:47vbttflaviu:you are right :)
21:10:17vbttmaybe comments on the lines invoking the iterators would help (# calls items())
21:10:28flaviuvbtt: Good idea
21:10:30vbttSorry, I meant Jehan_
21:11:19Jehan_My understanding is that what's holding this up (aside from the time to do it) is a planned and still missing "obsolete" pragma (that allows old names to still be used, just with warnings).
21:13:37vbttThe closure iterators example output line #2 doesn't show spaces like I would expect as per the code: http://nimrod-by-example.github.io/for_iterators/
21:13:53flaviuvbtt: Thanks, forgot to edit that
21:14:16flaviuThat's buggy right now btw, I'm waiting for Araq to appear so I can bug him about it
21:14:35vbttwat? closure iterators still don't work :(
21:14:45flaviuNo, it works, just in a weird way
21:15:21vbttwhat's weird?
21:16:04flaviuhttps://github.com/flaviut/nimrod-by-example/issues/14
21:18:02*saml quit (Quit: Leaving)
21:18:36vbttok it's weird
21:19:15Jehan_It may be intended.
21:19:34flaviuIt is intended, but it is also weird and horrible
21:19:40Jehan_This is where I'd really like to have a "repeat … until/do … while" style of loop.
21:19:59*io2 joined #nimrod
21:20:09Jehan_Hmm, nevermind, that wouldn't help in this particular case.
21:20:23flaviuJehan_: That isn't the problem, the problem is that the loop executes one more time than it should
21:20:23vbttwell using 'for' is the most natural with iterators
21:20:38Jehan_flaviu: A loop with an exit in the middle solves it.
21:20:42flaviuAnd gives bogus values on the extra execution, making it super-easy to create bugs
21:21:21vbttthis is why next() raises an exception in Python, when the generator is exhausted.
21:21:49Jehan_flaviu: It looks to me as though it's intended to be used on a call-then-test basis rather than a test-then-call basis.
21:21:50flaviuAn exception like that is exactly what I'd expect
21:22:42VarriountMeep
21:23:32VarriountNimrod has a (draft) style-guide.
21:23:34*shodan45 joined #nimrod
21:23:35flaviuJehan_: regardless, its too easy to cause bugs with it.
21:24:03Varriounthttps://github.com/Araq/Nimrod/wiki/NEP-1
21:24:53Jehan_flaviu: Is that because of a design flaw or because of an expectation/implementation mismatch?
21:24:58flaviu> manual alignment and re-alignment can be quite time consuming
21:24:58flaviuAnd messes up diffs
21:25:50flaviuJehan_: I'd say its both. The design flaw is that the expectation and implementation don't match
21:26:21vbttJehan_:the point is it's easy to have unnoticed/hard-to-find bugs in code because it will compile and run.
21:26:44*X-Scale quit (Ping timeout: 240 seconds)
21:26:46flaviuIdeally, the code that someone totally new comes up with should work flawlessly, people shouldn't have to remember idiosyncrasies of the language
21:26:47Jehan_But where does the expectation come from? Is it just how iterators in, say, Java are done, or because there's something inherently right about the expectation?
21:27:07Jehan_… because of how ...
21:29:14Jehan_I'm asking, I'm not certain myself.
21:29:16vbttJehan_: the pattern test-then-call is very, very common.
21:29:30Jehan_vbtt: Yeah, but not universal.
21:29:35vbttit seems obvious given the available functions (finished, call(), etc.)
21:29:45flaviuJehan_: When something is done the same way in every conceivable language, I think that the expectation is inherently right
21:29:51Jehan_Example: repeat read-line-from-stdin until input-is-valid
21:29:53vbttThe semantics do nothing to warn the user or indicate differently.
21:30:30flaviuAlso, Design Patterns does it like `while !done(): next()`
21:30:38vbttJehan_: there you are testing the input itself to see if it is valid. you don't do x = stdin.read(); if (was_stdin_valid(stdin) {user x;} else {discard x;
21:31:13vbttIn fact, I can't think of an example where you test the source of a value, after you get the value, to see if the value you got should be used or not.
21:31:43*brson joined #nimrod
21:31:48Araqflaviu: there is no easy solution
21:31:50vbttThe point is the useless value should not be returned. Either raise and exception or return a different type (T | Exhausted)
21:32:11Araqer ... again: This is a hard problem
21:32:20flaviuAraq: Sure there is. Require that a close() method be run when expired
21:32:20AraqLua does it this way too fwiw
21:32:21dom96*Something* has to be returned
21:32:25dom96and it shouldn't be an exception
21:32:30Jehan_I'd look at other languages that had iterators before. E.g., Icon, CLU, Sather.
21:32:34dom96You cannot return a different type.
21:32:41VarriountAraq: For once, I'm conscious after work. What issues should I work on?
21:32:46Araqflaviu: what?!
21:32:49vbttdom96:why can't you return a different type?
21:33:02AraqVarriount: go through the list of bugs
21:33:09Araqvbtt: static typing.
21:33:12dom96^^
21:33:30vbttAraq:but we have sum types, aka variants, no?
21:33:49vbttAraq:this would only be used by while loops or explicit invocation. for loops would hide it of course.
21:34:05AraqVarriount: we didn't mark the closure related bugs with a tag so ... more fun for you
21:34:05vbttit requires the caller to ensure that they got a correct value.
21:34:08flaviuAraq: while not finished(myIterator):( myIterator()) close(myIterator)
21:34:09dom96vbtt: Checking for the type would be a lot more tedious.
21:34:25vbttdom96:but you have to check for finished anyway, checking types is more tedious?
21:34:39Araqflaviu: what makes you think that I didn't come up with this solution before the solution that's been implemented now?
21:34:40dom96vbtt: yes
21:35:29flaviuAraq: I hadn't thought of that, but I think the current solution isn't good at all
21:35:35vbttI don't think close is a good idea, btw. it should just run the remainder of the code and exit.
21:35:36flaviuIts too easy to make a mistake
21:35:52vbttto be fair, iterators are used mostly with for loops and no bugs there.
21:36:13vbttwe're talking about explicitly calling and iterator, for each iteration.
21:36:58Araqflaviu: transform a closure iterator into these 3 methods that you just gave. I'm sure you can do it. It's such an easy transformation...
21:37:49VarriountAnyone have objections to this PR? https://github.com/Araq/Nimrod/pull/1372
21:37:53flaviuThe problem is that its hard to explain why an iterator would work so counter-intuitively
21:38:09Araqno it isn't
21:38:23Araqit is transformed into a state machine.
21:38:26Araqso there.
21:38:27vbttreturning the last bogus value is a wart
21:38:30Araqone sentence
21:38:46vbttit should return something distinguishable from a valid value.
21:38:56vbttso the two options imo are - sum types or exceptions.
21:39:05vbttcan variants be used in a case statement?
21:39:10vbtt(can't find an example of that)
21:39:35NimBotAraq/Nimrod devel 5a3c88d Grzegorz Adam Hankiewicz [+0 ±1 -0]: Mentions countLines() may return unexpected values.
21:39:35NimBotAraq/Nimrod devel 7f276fa Grzegorz Adam Hankiewicz [+0 ±1 -0]: Homogenizes docstrings for strutils module.... 4 more lines
21:39:35NimBotAraq/Nimrod devel 81d287f Varriount [+0 ±1 -0]: Merge pull request #1372 from gradha/pr_strutils_docstrings... 2 more lines
21:39:59flaviuvbtt: Only manually, you have to extract the discriminator yourself
21:40:07Araqvbtt: I decided against sum types for performance reasons
21:40:19Araqsame reason for exceptions
21:41:30vbttwould sum types really be that much slower?
21:41:45vbttremember you don't have to call finished() if a sum type is returned.
21:41:48dom96vbtt: You can always wrap your type inside of a variant type.
21:41:51vbttso thas the saving.
21:41:54dom96Problem solved.
21:42:08Araqvbtt: finished is *cheap*
21:42:12vbttdom96: true, maybe nimrod should provide a next() method that iterates safely over an interator
21:42:21flaviuAraq: Why didn't close() work out?
21:42:44vbttflaviu: firstly, how would you know when to call close()?
21:43:06vbttflaviu:it assumes the iterator knows it's about to exit before it actually runs the code till the end.
21:43:08flaviuWhen finished() returns false
21:43:24vbttoh
21:43:33*Johz quit (Ping timeout: 240 seconds)
21:43:34*BitPuffin quit (Ping timeout: 250 seconds)
21:44:01vbttflaviu: the question still is - what happens when you call the iterator and it has no more values? it has to run till the end to determine that it has no more values.
21:44:02Araqwhat's the problem again? that you can't call it manually without consulting the manual? how is this different from Python then?
21:44:20flaviuActually, close isn't even needed!
21:44:41flaviuJust have finished() also have the side effect of finishing off the iterator
21:44:46vbttAraq:the problem is just that it is error prone, and looks ugly.
21:45:17vbttthere were things in Python that were in the manual (except A, B comes to mind) but people still made the mistate over and over and over. It's just hard to remember to do it right.
21:45:29vbttThen they changed the syntax to `except A as b`
21:46:24vbttReturning a bogus value just seems wrong. Can it return two values? (success, value)
21:46:33vbttsame thing as variant, but encoded in the multiple values.
21:46:50Araqit does return 2 values...
21:47:10Araq'success' can be accessed with 'finished' ...
21:48:15VarriountWhat exactly is being discussed here? Methods of checking if an iterator is finished?
21:48:27*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:48:50vbttVarriount:yes, and it's error prone-ness
21:49:02flaviuVarriount: https://github.com/flaviut/nimrod-by-example/issues/14
21:49:24dom96Araq: skype?
21:49:24vbttIf the signature requires me to do `success, value = iter()` then I can't accidentally do 'value = iter()` and go along without realizing it.
21:50:20Jehan_proc iterate[T](it: iterator(): T {.closure.}): tuple[more:bool, value:T] =
21:50:20Jehan_ result.value = it()
21:50:20Jehan_ result.more = not finished(it)
21:50:22*xenagi quit (Quit: Leaving)
21:50:34Varriountvbtt: Yes, but then you have to do (success, value) everywhere.
21:50:43flaviujust get `finished` to deal with all that
21:50:54Varriountdom96: Oo, is this a skype I can join in with?
21:51:15Jehan_Varriount: Well, you'll always need both in practice.
21:51:17vbttVarriount: yes, only when you call the iterator explicitly. Not in for loops.
21:51:23flaviuMake it inline to prevent any inefficiency, two branches will be merged into one
21:52:16VarriountSo the complaint is that an iterator must be called an extra time to mark it as finished?
21:52:26vbttVarriount:what's the issue with doing success, item everywhere?
21:52:28flaviuVarriount: Did you see the bug report?
21:52:39Varriountflaviu: Yes. But it's long.
21:52:55flaviuHere is my countup iterator results: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0
21:53:16vbttNote the last '0'
21:54:33*Fx00F quit (Ping timeout: 240 seconds)
21:54:38vbttAnyway, another option is to add a function next(iter, out x) which returns true or false
21:54:46vbttwhile (next(iter, out x)) {..}
21:54:52vbttmaybe out should be var, not sure about syntax.
21:55:20vbttso next() set's the value in x, and returns true if iterator is still running
21:55:37Varriountvbtt: Wouldn't that only work with iterators that don't take parameters?
21:55:38vbttJust makes it so much easier to use in a while loops.
21:56:01vbttVarriount:yeah i guess
21:56:21vbttget(var x, iter, params..)
21:56:29*Fx00F joined #nimrod
21:59:02vbttbut yeah, not very pretty
21:59:59Araqso write some helper and call it a day
22:00:03Araqbut again
22:00:20VarriountAraq would probably have an aneurism if someone hacked nimrod to use pythons method (eg, use exceptions)
22:00:21Araqthere are very good reasons it is done this way
22:00:51vbttok
22:02:07vbttflaviu:I think the example should be fixed to do (if finished(..) break;) in a while true loop
22:02:16vbtti.e. do the right thing.
22:02:53flaviuvbtt: Yeah, not really happy with that, but ok
22:03:21vbttflaviu:but it should show the right way to use iterators.
22:04:09vbttflaviu:any other solution (exception, different return value) also requires a check after the iterator call or a try/except block anyway.
22:05:20flaviuvbtt: I mean I'm not really happy with the decision to make integer semantics this way
22:05:25flaviu*iterator
22:05:59vbttflaviu:incomplete text here: http://nimrod-by-example.github.io/procvars/
22:06:33flaviuvbtt: Ok, I'll fix it soon
22:07:10vbttflaviu:re iterators, they'll mostly be used with 'for' anyway.
22:07:26vbttyou don't need finished() there, right?
22:08:41flaviuvbtt: What?
22:09:26vbttflaviu:I'm saying in the majority of cases you don't have to worry about low level iterator semantics because you use 'for'
22:09:48Araqvbtt: exactly.
22:10:13flaviuYes, but in the other cases, you do have to be very careful because its very easy to do things the wrong way
22:10:51vbttflaviu: in practice, i rarely use the low level iterator interface in python. I should say 'vast majority' uses 'for'
22:11:13vbttthe manual can point out the 'gotcha' when using the low level semantics.
22:11:27vbttIt's not my preferred choice either, but i can live with it.
22:13:08flaviuI can live with it to, I'm just not happy that I have to accept sub-perfect semantics
22:15:26Araqflaviu: the funny thing is: your "perfect semantics" are unsound
22:15:34vbttflaviu:do you cover tuples in your tutorial?
22:16:00flaviuvbtt: I don't remember, but I don't think I've gotten there yet
22:16:12vbttwould be good to add
22:16:59flaviuAlso, I don't understand why finished can't be implemented as `if finishedCheck: \n if lastNotExecuted: executeLast()\n return true else: return false`
22:17:01vbttAraq:what is unsound about a sum type to represent two possible conditions? Basically a Maybe type?
22:17:11NimBotAraq/Nimrod devel 5a29950 Varriount [+0 ±1 -0]: Update nimrod.ini
22:18:00Araqvbtt: that's not the problem. the problem is that he thinks he can tell when the iterator finished before it finished ;-)
22:18:10vbttflaviu: you can never know if the iterator will end without actually running it?
22:18:59vbttflaviu: you have to run the iterator until you hit a yield or fall off the end of the function, only then you know that you have a value, or are actually done.
22:19:23vbttyou can't foresee that - it's theoretically impossible.
22:19:33flaviuAraq: huh, thats a good point
22:19:58*Matthias247 joined #nimrod
22:21:22vbttbasically you can't have a goingToFinish() function, only alreadyFinished(). Which means the problem of the last return value remains.
22:21:24flaviuhaskell has these things easy :(
22:21:38Araqvbtt: exactly.
22:21:50AraqI tried 2x to do better btw
22:22:47Araqthen I figured it's not possible and noted Lua does it the same way
22:23:09vbttheh, you tried to solve the halting problem? ;)
22:23:18flaviuAraq: What if we get rid of indefinate while loops?
22:23:25flaviuand recursion
22:23:41vbttI think this is equivalent to the halting problem.
22:23:48flaviuvbtt: I think so too
22:24:14flaviuBut the language doesn't have to be turing complete :P
22:24:22vbttwhat fun is that?
22:24:28*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
22:24:34flaviuAnyway, I consider the halting problem a sufficient excuse for ugly semantics
22:25:06Jehan_Araq: That problem is solvable.
22:25:30Jehan_Execute an iterator step upon iterator creation. Store value.
22:25:44Jehan_Upon call, do that again and return previously stored value.
22:25:47vbttSo you're pre-running.
22:25:51flaviuJehan_: This isn't haskell
22:26:01Jehan_vbtt: Yup. Which has its own potential issues, of course.
22:26:03flaviuIts going to cause weird issues
22:26:13vbttDifferent semantics, not always desireable. At least I know nothing runs on iterator creation, I think that's better.
22:26:14Jehan_flaviu: Only if the iterator has side effects.
22:26:46flaviuJehan_: But unfortunately, this isn't haskell, and I don't think its a good idea to have two types of closure iterators
22:26:53Jehan_vbtt: Semantics are the same, aside from side effects (and finished() working differently).
22:27:04Jehan_flaviu: Not sure what Haskell has to do with that, to be honest.
22:27:16flaviuIsn't Haskell supposed to be pure?
22:27:32flaviuwithout any side effects anywhere?
22:27:34vbttJehan_:right, side effects and time taken.
22:27:48Jehan_flaviu: Yeah, but if you have side effects in an iterator that depend on precisely those semantics, your code has problems.
22:27:57vbttso, IMO, not the same semantics. i
22:28:39Jehan_vbtt: Time taken only with respect to when code is executed. Total time taken should be the same (except for a constant factor to deal with the different execution model).
22:29:04vbttJehan_:I can choose to not run an iterator or not resume it (i.e. break)
22:29:24vbttIn practice, you could have db lookups etc in there which will unnecessarily run.
22:29:37Jehan_vbtt: Yes, but you'll be executing it the same number of times in either model.
22:29:48vbttIn pure computations, it's all good (except the time taken) but I don't think it's good in practice to pre-run.
22:30:03vbttJehan_:no, not if I break or decide not to iterate.
22:30:27Jehan_vbtt: Yeah, but only in select situations.
22:30:29vbttI guess it's a different set of tradeoffs.
22:30:40flaviuJehan_: I'm 100% sure thats going to create problems that are harder to explain than the current problems
22:30:41vbttYou can always wrap the current one to make it pre-running.
22:30:44vbttAnd vice versa.
22:30:48Jehan_I do find it fascinating how everybody is defending Araq's implementation choice now against me. :)
22:31:13vbttI didn't know haskell pre-runs the iterators.
22:31:26vbttYou also need a place to store it.
22:31:32vbttCan't go on the stack anymore.
22:31:33flaviuJehan_: Because Araq pointed out that it is even theoretically impossible to solve this problem
22:31:42Jehan_Not sure if you can call it "pre-running" in a lazy language.
22:32:17Jehan_Note also that you could do it lazily in Nimrod, too.
22:32:37Jehan_I.e. if either finished(iter) or iter() is called.
22:32:54Jehan_Obviously, that would be extra overhead.
22:33:28vbttJehan_:not sure what you mean 'lazily'
22:34:04flaviuvbtt: Calculate iter.next() when finished() is called and cache it somewhere
22:34:16Jehan_vbtt: On demand.
22:35:01Jehan_Closure iterators need an environment anyway, so that's where you can store it.
22:35:36Jehan_Anyhow, I think the easiest solution would be to have an iterate() proc that does the test and evaluation in one single step.
22:36:17vbttevaluation, then test :)
22:36:25Jehan_E.g.:
22:36:36Jehan_proc iterate[T](it: iterator(): T {.closure.}): tuple[more:bool, value:T] =
22:36:36Jehan_ result.value = it()
22:36:36Jehan_ result.more = not finished(it)
22:36:36Jehan_proc iterate[T](it: iterator(): T {.closure.}, value: var T): bool =
22:36:36Jehan_ value = it()
22:36:37Jehan_ result = not finished(it)
22:36:52vbttwhy should finished() run the iterator? I think that behavior is unintuitive
22:36:59vbttfinished() should just return the state, not affect it.
22:37:27flaviubecause there is no other way to figure out if it is really finished
22:37:40flaviuStatic analysis won't work because of the halting problem
22:38:12vbttactually there's a simple way to prove static analysis can't work. If (random() > .5) yield else return
22:38:45vbttoh i see what you mean.
22:39:01vbttbut I think it's nice that finished doesn't resume the iterator, but calling it does.
22:39:20vbttnimrod has a side-effects - I want to know when what code runs.
22:40:01flaviuvbtt: If you have the seed to random, you can prove that
22:42:05VarriountHm.. I could try to optimize this piece of code, or I could not go insane...
22:42:32flaviuVarriount: What code?
22:42:51flaviuIf its WinAPI, just walk away :P
22:42:52Varriountflaviu: Second try at file event notification code.
22:43:09flaviuIts good enough, just stress test it a bit
22:43:14VarriountIf you'll recall, to monitor a specific file for events, you have to have a custom filter.
22:44:03Varriountflaviu: Essentially, I'm wondering if I can hand-tail-call-optimize this complicated procedure (and if it's worth it)
22:44:08flaviuI think you've spent enough time on that, optimize it when someone complains
22:44:12vbttmoving on. if i had to write a biggish project (5k-10k lines), using networking, filesystem etc. would you recommend nimrod as production ready or should I wait for 1.0?
22:44:28flaviuI don't know how async networking works
22:44:31vbttI'm concerned about incompatible changes and bugs.
22:44:55Varriountvbtt: How low level are you willing to go, and how many fancy syntax tricks will you be pulling?
22:45:00flaviudom96 or Matthias247 would be the ones to ask about networking
22:45:44vbttVarriount: I want to stay as high level as I can. But not too many fancy syntax tricks.
22:46:01vbttI don't need metaprogramming, I may use some small macros, not sure.
22:46:08vbttwhy?
22:46:23flaviubecause macros tend to be buggy
22:46:24Varriountvbtt: Compilers are 90% corner cases.
22:46:29flaviuless so recently though
22:46:52Varriountvbtt: Using fancy features tend to mean eating more corners.
22:46:59Jehan_vbtt: The Pascal + generics subset of Nimrod is pretty solid. No idea how well the standard library meets your needs (depends on OS and exact application domain).
22:47:45vbttactually async stuff would be nice but I belive that's not stable.
22:47:48Jehan_And what flaviu said about macros being still very much an "under development" thing.
22:48:17vbttinteresting, I thought macros and templates were old, mature features.
22:48:27flaviutemplates yes, macros not so much
22:48:27vbttisn't a lot of nimrod itself using metaprogramming?
22:48:31vbttI see.
22:48:33Jehan_I mostly use the aforementioned Pascal + generics subset and have had very few problems recently.
22:48:36vbttok, I'll stick to templates then.
22:49:06flaviuYou can use macros, but its going to be 50% implementing stuff, 50% debugging the compiler
22:49:30vbttdon't want to do that :p
22:49:31Jehan_Only problem with templates is sometimes when you try to do fancy stuff with type inference.
22:50:06*mwbrown quit (Ping timeout: 240 seconds)
22:50:12vbttI see.
22:50:34vbttthanks guys.
22:50:39Araqhey
22:50:48Araqmacros are pretty stable ... *cough*
22:51:18Araqwell ... most things are regressions because I thought it would be good idea to create a new VM from scratch
22:51:29Jehan_Heh. :)
22:51:41vbttAraq:did the new vm pay off?
22:51:59flaviuvbtt: Its pretty fast if thats what you're looking for
22:52:05Jehan_Araq: The last time I needed a VM in a running program, I was lazy and compiled to Lua. :)
22:52:24flaviuJehan_: There is a half-done Lua backend
22:53:12vbttI think he means the compile time VM.
22:53:20Jehan_vbtt: Yup.
22:53:21vbtta VM that executes nimrod code, is that right?
22:53:29Varriountflaviu: Stop giving advice that will lead to Jehan_ being eaten by rabid gerbils.
22:53:40Araqvbtt: I had reports that compile times went from minutes to seconds
22:53:45Araqfor macro heavy code
22:53:48vbttnice
22:54:04vbttwho cares if it works, as long as it's fast ;)
22:54:13Araqbut I wouldn't do it again ...
22:54:13flaviuVarriount: What gerbils? I don't have any!
22:55:00Araqvbtt: well the old evaluation engine had its bugs too
22:55:09dom96vbtt: You should definitely use the async stuff. Me and Araq just spent some time hunting a bug in it and found it thankfully.
22:55:10Araqbut in retrospect it was surprisingly stable
22:55:46dom96vbtt: It may not be the last bug left but we'll get there.
22:56:00flaviudom96: Great, good to know
22:56:38*Ven joined #nimrod
22:57:49Jehan_For what it's worth, the language I was compiling to Lua was a Datalog dialect … I wonder how many people are familiar with that still.
22:57:57AraqJehan_: well your solution didn't occur to me, but it looks like an awful transformation
22:58:25Jehan_Araq: I had the advantage that I was compiling a pretty simple language.
22:58:29Araqand since we just found yet another bug in the "simple" transformation ...
22:58:44Jehan_Or are you talking about iterators?
22:58:50Araqyes
22:58:53Jehan_Gotcha.
22:59:17*superfunc quit (Ping timeout: 250 seconds)
22:59:27Jehan_As I said, I'd put an `iterate` proc or two in system.nim (or some yet to be written itertools.nim) and tell people to use that.
22:59:29*BitPuffin joined #nimrod
22:59:37flaviuAraq: I haven't made any feature requests in the the last hour, so I'd like to be able to reuse names in variant types
22:59:59flaviuIf they have the same types of course
23:00:31flaviu*10 miniutes
23:01:32Araqer ... pull it out of the case section into the common section?
23:01:52flaviuI want some of the type variants to have that name, but not all
23:02:08flaviu*field
23:02:50Araqok, PRs welcome
23:03:22Araq:P
23:03:49flaviuWell, I guess I can try if thats the only way of getting it
23:04:38Araqit's an interesting problem how to lay out these fields in memory
23:04:47Araqunless you pick the easy solution
23:04:57Araqwhich is to pull them out of the 'case'
23:05:16Araqbut generate a guard for every access like if they are in the case
23:06:37*darkf joined #nimrod
23:06:37AraqML doesn't allow this btw, so it's likely wrong/unsound ;-)
23:07:50flaviuWell, I found a russian TAPL. Very useful
23:08:06flaviuNative PDF at least, not a scan :D
23:10:22Araqthe syntax of typing rules sucks, no wonder people don't read type theory
23:11:28dom96good night
23:11:29Araqso hard to read ... you never know how to parse it ... how hard can it be to use a few more () ?
23:15:49Jehan_I think it's just as with math papers in general that type theory papers tend to be pretty dense and assume a fair amount of knowledge.
23:16:43*Matthias247 quit (Read error: Connection reset by peer)
23:16:50Jehan_It still baffles me how complicated the Haskell people can make a simple concept such as monads in their "guides".
23:20:41AraqJehan_: no, the notation is explained perfectly fine
23:20:57Araqbut it still sucks ;-)
23:21:26AraqIMHO math syntax is mediocre
23:21:27Jehan_"explained perfectly fine" does not mean the same as "readable" and "doesn't assume a lot of prior knowledge".
23:21:50Araqlots of math's notations are superb
23:21:57Jehan_Example: Try to debug a Turing machine.
23:22:05Araqand lots of math's notations are crap
23:22:25Jehan_It's a matter of getting accustomed to it, honestly.
23:22:49Jehan_Math notation generally makes heavy use of overloading, so to speak.
23:23:06flaviuAraq: Can you be more specific?
23:23:50Jehan_But the same is true for most regular languages.
23:24:16Jehan_Eh, with regular languages I mean English, French, and such, not regular languages in the Chomsky hierarchy sense.
23:24:49Jehan_Come to think of it, I just gave a self-referential example of overloading in natural languages. :)
23:25:24Araqflaviu: fractions are very well done, it's easy to see valid and useful transformations
23:25:56Araqcompare it to (x + 1) : 4
23:26:50Araqin general the 2D layout helps
23:27:22flaviuThat is a werider way of putting it, but its easy to translate that to (x+1)/4
23:28:17Araqintegrals are weird with the 'dx' suffix (yes I know about the substitution rules)
23:28:59Fx00Fhow about integrals with the 'dx' prefix?
23:29:20*Trustable quit (Quit: Leaving)
23:29:25Araq'dx' itself is problematic, it could mean d*x
23:29:30Araqspeaking of which
23:29:37Araqthe implicit * sucks
23:29:55flaviuI'm not going to argue about dx's ambiguity, its weird
23:30:01Araqit means cos could also mean c*o*s
23:30:30flaviuIts rendered totally differently: $$\cos$$ $$cos$$
23:30:58flaviuhttp://i.imgur.com/Ww3tpQy.png
23:31:06Fx00Fyou can think of the d as the \ in lambda calculus
23:31:57Araq| for "divides" sucks ...
23:32:06Araq|a| | 4
23:32:08flaviuBut I guess that doesn't matter when hand writing
23:32:48Araqflaviu: everybody writes math by hand
23:33:03Jehan_Araq: As I said, math notation is much like a natural language in that context matters for meaning.
23:33:16adoniscikcan you define generic procs so you can recognize proc(a:T, b:S) as well as proc(b:S, a:T) (commutativity)
23:33:48flaviu$$\text{Not everyone}$$
23:34:13AraqJehan_: yes, but that's a shitty foundation
23:34:26flaviuhttp://i.imgur.com/HIgWRM4.png
23:34:43Jehan_Araq: Well, its a foundation that was created centuries ago.
23:34:46*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
23:34:59Jehan_And you know how hard it can be to break backward compatibility. :)
23:35:36Araqthe problem is that people need to acknowledge that it's a problem
23:35:58Araqand it is IMO
23:36:05Araqit hinders progress
23:36:35Jehan_Araq: Does it?
23:36:39flaviuAraq: About the fancy variants: The compiler could scrample the names, that would work
23:36:56Araqflaviu: no it wouldn't
23:37:05Jehan_You're not going to develop new mathematical theorems without immersing yourself first in math for years, at which point it becomes a minor problem.
23:37:16Araqobj.foo # foo is in 2 branches
23:37:30Jehan_Downtranslating the concepts into normal human-speak is a different story, but that's usually not just a matter of notation.
23:38:14flaviuAraq: You're right. I forgot that variant branch isn't attached to the type
23:38:41flaviuWell, easiest solution is to make my own poor-man's variant with methods to actually check and fetch what is needed
23:39:09AraqJehan_: many people could benefit from more math knowledge but reading math books simply is too hard. And that's not because it's not "english like" enough
23:39:51Araqit's because the syntax is cryptic
23:39:55Araqfor instance
23:40:29Araqmany people translate symbols into the corresponding *sounds* in their heads
23:40:35flaviuJehan_: http://www.amazon.com/s/ref=nb_sb_noss_1?field-keywords=math%20for%20dummies
23:40:55adoniscikdoes nimrod have something equivalent to python's enumerate?
23:40:56Araqthis stops working when you only see greek symbols and don't know them very well
23:41:07def-adoniscik: for i, x in xs:
23:41:17def-adoniscik: or what do you mean?
23:41:19Araqso yes, greek symbols really are harder to read than a-z
23:41:58flaviuAraq: remember how I kept bugging you about a and b in the VM? Math is the same
23:42:23def-adoniscik: pairs(), and it's automatically used when you do "for i, x in ..."
23:42:28adoniscikdef-, let me try !
23:42:40flaviuIts hard to read because of one-letter symbols with meaning, but once you're used to it, you don't see how other people could possibly have issues with it
23:43:11flaviuNot trying to bash on you, just trying to put more perspective here
23:43:21Araqflaviu: I am talking about a vs alpha (can't type it easily here)
23:43:34flaviu$$\alpha$$
23:44:29Araqand alpha is widely known so it's a bad example
23:45:22Jehan_import sequtils
23:45:22Jehan_proc enumerate[T](s: seq[T]): seq[tuple[a: int, b: T]] =
23:45:22Jehan_ zip(toSeq(1..len(s)), s)
23:45:22Jehan_echo enumerate(@["x", "y"])
23:46:02adoniscikif you two openarrays and do something on them what should you return that's the same size since you can't return openarrays?
23:46:04AraqJehan_: pairs does the trick
23:46:11adoniscikif you take...
23:46:16Araqadoniscik: seq
23:46:38adoniscikthanks, Araq. No performance hit over straight arrays?
23:46:46adoniscikor is that not a choice?
23:47:01def-adoniscik: if you know the size create it with newSeq[type](size)
23:47:16def-otherwise adding each element is slower
23:47:36adoniscikthat's the thing; the proc knows the length when it gets them.
23:47:43adonisciknot at compile time
23:47:49Jehan_Araq: Oops, misremembered what enumerate does.
23:47:56flaviuif you know the size and want to use .add, do newSeq[type](size); mySeq.setLen(0)
23:48:28def-flaviu: that should be called newSeqOfCap
23:48:38flaviuDoesn't exist last time I checked
23:48:46Fx00Fdef-: in that case, is it amortized time slower?
23:48:47Araqyeah but system.nim still lacks it
23:48:53def-yes, just saying
23:49:50adoniscikdef-, the proc knows the length of the result and no adds will take place afterward. Is it possible to use array and somehow set the length parameter using generics?
23:50:08def-adoniscik: no
23:50:14Araqadoniscik: yes
23:50:30flaviuadoniscik: Sure, proc foo[I](in: bar): Array[I, whatever]
23:50:31adoniscikproc(x: openarray[T]) : array[foo, T]
23:51:02adoniscikwhere my foo = x.len or something
23:51:08def-ah, i thought you mean when you can get variable size arrays out
23:51:23Araqproc foo[Idx, T](x: array[Idx, T]): array[Idx, T]
23:51:25adoniscikit is variable, because x.len is
23:51:29def-Fx00F: hi again. what makes it slower are the new memory allocations on resize
23:51:42Araqbut not with openArray, adoniscik
23:51:50adoniscikI see, let me try it that way. thanks guys
23:55:11*untitaker quit (Quit: ZNC - http://znc.in)
23:56:21*untitaker joined #nimrod
23:59:07*silasm quit (Quit: leaving)