***u_l-lap is now known as unknown_lamer
<cky>Yes, I finally have a build of Guile on OS X (10.10 Yosemite), building with Xcode 6.1's clang, that passes the test suite. <cky>If you build it with default options, it will blow up in srfi-18.test. <cky>I should submit a patch on the mailing list and ask other Xcode users to verify whether the patch works for them. <taylanub>cky: if you want you can remind me tomorrow at around these times and I'll see if I can test it too, with Xcode 6.1 on OS X 10.9. <davexunit>does anyone know of a good way to go about hunting for a memory leak in a guile program? <jmd>davexunit: As I understood it there is no such thing. It has a garbage collector. <davexunit>jmd: memory leaks are still possible in GC'd languages. <jmd>But surely only if the GC is not working ? <davexunit>thing is, I knew about the potential for leakage so I thought I had written my code such that the leak wouldn't happen. <davexunit>I've gotten myself in a situation where the GC cannot free the memory <davexunit>because it is in fact still referenced somewhere, but it's unusable to me. <davexunit>I found the culprit, but I'm not sure why this coroutine seems to be eating 1MB/s and never letting it go. <davexunit>something about this weak key hash table I'm using... <davexunit>I hope this is me being an idiot and not a guile bug *davexunit thinks he found the source of the memory leak. font rendering! gah! <davexunit>my game of 2048 got real slow and I was using a half GB of RAM! <davexunit>and it's because I did a bad thing: not using my existing code for creating textures when rendering text. <davexunit>I wrote a finalizer that will delete GC'd textures from OpenGL's state. <davexunit>but, since I didn't use that existing code, I was creating textures with no finalizer. :( <davexunit>I got over a big hurdle yesterday, if I fix this and there are no other blocker bugs, Sly 0.1 won't be too far away anymore. <paroneayea>I'm having fun considering some crazy refactoring in mediagoblin <davexunit>I'm refactoring without changing public APIs, woo! (not that it matters for an unreleased project) <paroneayea>I'm trying to get rid of our global variable context stuff which pains us so <paroneayea>but... it requires changing things to pass around a context object pretty much everywhere <paroneayea>davexunit: yeah, I don't know enough about monads <davexunit>in scheme, sometimes we use 'parameters', thread-local dynamic variables, for this stuff <paroneayea>davexunit: right, python *kind of* has this, but it isn't really sufficient <davexunit>a monad in python might not be the best idea, but I wanted to say monadgoblin. <paroneayea>it doesn't work once you go down the asyncio/twisted route <paroneayea>because that's non-blocking "async" stuff all happening in a single thread <paroneayea>so a coroutine might suspend, then wake up later <davexunit>I think guile's parameters would continue to work as expected. <davexunit>the dynamic extent of the parameter is captured. <davexunit>but yeah, some way to avoid passing a context object along everywhere is desirable. <davexunit>the only ways I know are parameters and monads. <paroneayea> result = yield from thread_globals.db.session(query="foo") <paroneayea> "I am translating in the right language, and you wanted " + <paroneayea>so two views/controllers.. the first one suspends becuse it's doing a db request <paroneayea>I messed up the gettext thing, the + should happen outside it <paroneayea>while the first one is suspended waiting on the db query response, the english one happens <davexunit>yeah, guile's parameters wouldn't have that issue :) <davexunit>so when that async routine wakes up, the value of the parameter is still what you had set for it. <paroneayea>I would say "hey closures" but actually I don't think there's a nice way to do that with closures in python <paroneayea>maybe you could with decorators, but I'm not so sure <paroneayea>I'd like to learn monads but I really don't know where to begin :( <davexunit>I learned enough to use store monad in guix to write something <paroneayea>davexunit: the thing I think here though is that for most of the code, there's already a ~context object being passed through things <amirouche>paroneayea: why isn't the language attached to the request? <paroneayea>so I use that as a general attachment of different parameters, but if it's not a web request but some other task <paroneayea>I attach everything to a super basic Context object that's just there to get stuff stuck to it <paroneayea>amirouche: but our current code doesn't use that <paroneayea>there's a lot of stuff we did to make the ORM easy to use from everywhere <paroneayea>so all the code everywhere seems to need some updates ;) <paroneayea>lots of things relied on mg_globals, which is "thread safe", but <amirouche>then you should be able to change the current langage when you yield <amirouche>Flask has a similar problem, since "request" is a thread local global. <paroneayea>amirouche: well, we're not using yield yet, since this is more dumb previous generation django-style programming, but I want to move things over to asyncio in the future <paroneayea>the best option is to take advantage of the current asyncio Task object and attach stuff to that <paroneayea>I am writing a program that *is* using asyncio though <paroneayea>it's not released yet... I'm mostly using it to figure this stuff out, but eventually hopefully it'll be a low-level implementation of the federation standard being written by the w3c socialwg <paroneayea>(I've thought of writing a guile version but it's more useful for me to write it in python for learning stuff for mediagoblin reasons) <amirouche>(to change things on yield you will probably need to tweak the eventloop) <ijp>all you need to know about monads is you almost certainly don't need them <ijp>and if you do, you've probably invented tehm already <paroneayea>is start wrapping functions so the context object is invisible as part of a closure <paroneayea>but even if I did that I'd still be passing the context object in as first argument, it just wouldn't be seen in the function <ijp>alandipert: the elisp is probably the most mature. the js and lua are kinda meh. no idea about stis' prolog <alandipert>oh, prolog is exciting. i’m just exploring, toy stuff would be fun to look at too <ijp>occasionally someone talks about python, but I don't know if it went anywhere *davexunit fixed the memory leak <davexunit>(wasn't using finalizers for opengl vertex buffers and vertex arrays) <sg2002>Have a question, in guile 1.8.7, I get that there's no "unquote" function. Was it supposed to be there? Or it's in some lib, that I haven't required? <ijp>unquote isn't a function, it's basically subsyntax of quasiquote <jmd>sg2002: But it does have , I think. <sg2002>jmd: Is there some other syntax for it apart from (unquote ? <sg2002>jmd: Ok, that's weird. My interpreter understands that "," is unquote, but still can't find it. <ijp>sg2002: what are you actually trying? <ijp>because it makes no sense outside of a quasiquote <ijp>in 2.x at the repl it serves a slightly different function for repl commands, which it didn't in 1.8.x <sg2002>ijp: My lilypond script grew to the point it needs some testing framework and since there seems to be no unit test module for guile that old, I'm trying to make it work with org-babel. But when babel is ran through geiser, geiser sends unquote to guile and this of course does not work. <ijp>right, the problem then is that 1.8.x doesn't have repl commands <ijp>so you can't really use geiser for it <sg2002>ijp: Just thinking of a dirty hack to fix this. <sg2002>ijp: I actually use geiser with it. Normally. But through org babel is does not work. <sg2002>ijp: Yeah, especially since geiser explicitly does not support guile < 2.0. <sg2002>amirouche: Ok, quasiquote works in that version, so now I know what to "fix". Thanks. <amirouche>I've been looking around for bugs for 30 minutes... the algorithm was ok... if only I did not mistype things <amirouche>looks like working with hashtables is not the best idea <cky>taylanub: I won't be awake at 11:15 UTC, usually (it's 06:15 Eastern Time), unless I get woken up by my cat. But I'll see what I can do. <taylanub>cky: you can tell me a couple hours earlier (like when you had initially written that line) and I'll see it later :P <cky>taylanub: Okay, I'll ping you before I go to sleep. <civodul>ijp: you were working on a JS compiler back-end, no? <sg2002>Kind of a newbish question - what would be the most idiomatic way to search list for any elements that are not equal to the element specified. Need only the first element. <civodul>(find (cut equal? <> the-thing) lst) <davexunit>(find (negate (cut equal? <> the-thing)) lst) ;; get the first thing that isn't equal <davexunit>(find (negate (lambda (x) (equal? x the-thing))) lst) ;; without cut <ijp>if you were going to get rid of cut, I'd also get rid of negate <ijp>civodul: I just haven't had the time to make any real headway <civodul>i may have to do web stuff again at work <civodul>but HOP is conceptually what i'd like to have <davexunit>how does get the modulo of 2 rational numbers in guile? <davexunit>I can't find a built-in procedure, but I could be missing it. <ijp>hmm, what a weird thing to do <davexunit>I'm trying to write a function that loops over a range. <ijp>cross multiply, take the mod, then divide through? <ijp>(define (mod-rat x y) (/ (modulo (* (numerator x) (denominator y)) (* (denominator x) (numerator y))) (denominator x))) <ijp>I suspect this fails horribly somehow for negatives <ijp>whoops, that code is wrong anyway <davexunit>it's intended for floats, but of course works just fine here <davexunit>(define (fmod x y) (- x (* (floor (/ x y)) y))) <davexunit>fmod is a bad name, but that's what it's called for floats. <ijp>(fwiw, it should have divided by both denominators) <ijp>(and yes, it does fail for negatives) <davexunit>you reminder me of the existence of the numerator and denominator procedures. <ijp>where fail here means not giving a number between 0 and abs(denom)