IRC channel logs

2013-07-17.log

back to list of logs

<nalaginrut>morning guilers~
<youlysses>nalaginrut: Evening. o/
<nalaginrut>youlysses: heya
<youlysses>nalaginrut: What's up?
<nalaginrut>youlysses: on my working ;-P
***micro` is now known as Guest71688
<nalaginrut>I love weiholt's crypto modules
*nalaginrut added sha-1 to Artanis for preparing websocket
***DerGuteM1ritz is now known as DerGuteMoritz
<civodul>Hello Guilers!
<stis>morning guilers!
<nalaginrut>how can I use bit area in Guile? I'm handling websocket frame
<nalaginrut>or should I do it with C
<civodul>bit area?
<civodul>bit field?
<civodul>(rnrs bytevectors)?
<nalaginrut>civodul: well, how can I fetch the value in a struct like this, say, { unsigned a: 1; ...}
<nalaginrut>how can I get value of a
<lloda>(logand x 1) ??
<lloda>or (logand x #b00000001) ...
<lloda>where x is the right byte
<lloda>right = proper
<taylanub>nalaginrut: https://github.com/taylanub/scheme-bytestructures/ :)
<taylanub>nalaginrut: If you use it, you'll probably be my first user. BTW I made some drastic changes over short periods, but I think this version will remain stable, unless you have some ideas to make the API simpler and/or more capable.
<taylanub>I'll push some documentation refinements soon though.
<taylanub>nalaginrut: FYI there's also `make-c-struct' in the FFI module, which is similar to my module but simpler (and less general/powerful).
<civodul>yeah, it doesn't handle bitfields
***serhart_ is now known as serhart
<waxysubs`>unfortunately, the details of how bitfields are packed into structs are platform-dependent.
<waxysubs`>section 6.7.2.1 paragraph 10 of C99 talks about this.
<waxysubs`>for AMD64 a.k.a. x86_64, the details are specified in the psABI, section 3.1.2.
<waxysubs`>(this is mark_weaver, typing at his logger :)
<stis>is it possible to write a C stub to probe the actual implementation?
<taylanub>Oh, I didn't notice nalaginrut wanted something with bit-fields. My module doesn't come with anything for that directly, but it could be handled by an additional type; perhaps I should built it into the struct type.
<waxysubs`>yeah, in practice I suspect that would be possible. there aren't that many options to consider.
<civodul>ahah, the stealthy waxysubs`!
<civodul>:-)
<waxysubs`>the main ones are: (1) what kind of normal-sized int (called the "unit") which is allocated to hold bitfields
<waxysubs`>(2) whether the bitfields are packed starting at the low-order bit or the high-order bit.
<waxysubs`>and (3) whether bitfields are allowed to be split between two units.
*civodul notes that libffi doesn't support bit fields either
<civodul>i'd use a C shim to get this right, nalaginrut
<waxysubs`>I suppose libffi is the right place (tm) to add this functionality.
<civodul>yeah
<civodul>but it's tricky, for the reasons you gave
<waxysubs`>but I think stis' idea is a good one. it would probably allow bitfields to be added relatively easily to libffi, without having to research each individual platform.
<waxysubs`>okay, gotta go. happy hacking!
<shanecelis>hello guilers
<davexunit>hello!
<shanecelis>I'm having this problem. I have some data structures in memory, in this case goops instances that I'd like to save, but I could turn them into alists, but they also contain vectors of doubles, and I want to preserve the doubles exactly (I replicability for this research project), so I feel like I need to store these things in binary. Is there a good way to do this?
<civodul>hello!
<civodul>shanecelis: doubles are inexact in nature
<civodul>so "saving exactly" doesn't mean much
<civodul>you could save the external representation, and get it back with the 'read' procedure
<shanecelis>civodul: well, saving the 64 bits such that I can run them again on _this_ machine and get the same results.
<civodul>shanecelis: well that's doable, with (rnrs io ports) & co., but that's not really better
<shanecelis>civodul: If that's no better, then perhaps just reading and writing them as is will be fine.
<civodul>yeah
<civodul>maybe mark_weaver would have something to add on that topic
<davexunit>any guix users here? I want to try out, but replacing the package manager on a system seems a little scary.
*shanecelis smiles.
<shanecelis>davexunit: civodul is your guy.
<civodul>that's me!
<civodul>davexunit: don't be afraid, everything's gonna be alright :-)
<davexunit>I'm just wondering the best way to set something up to try. perhaps a VM. what to use as a base OS?
<civodul>basically it stores its data in different places than what your distro does
<civodul>so it would not interfere
<civodul>at worse, you can just run "rm -rf /nix" and be done with it
<civodul>though of course, why would one want to do that? :-)
<davexunit>cool.
<civodul>davexunit: the base OS doesn't really matter
<davexunit>awesome.
<davexunit>and the packages are installed on a per-user basis?
<civodul>yes
<shanecelis>hell, I'm gonna try it too.
<civodul>there's a global "store", and user "profiles" point to that
<davexunit>so I could say, install the coreutils from the guix repo and nothing would go awry?
<davexunit>I'll have to give this a shot. Guix sounds quite awesome.
<civodul>davexunit: yes, you could do that
<civodul>and you can choose whether or not to have Guix's coreutils in $PATH
<shanecelis>LOL --with-courage... love it.
<civodul>heh :-)
***xaocon|away is now known as xaocon
<davexunit>I will be giving this a try when I'm at my home machine.
<davexunit>thanks for the education, civodul
<shanecelis>civodul: Okay, I think you're right civodul. The string decimal representation of the doubles does seem to be "complete".
<civodul>davexunit: there's also a #guix channel, if needed
<davexunit>thanks
<shanecelis>ahh, (oop goops save), YES!
<shanecelis>I see that I can expose a SCM uniform array to C, but I don't see how I can expose a C array to Scheme without copying. Is there something I'm missing?
<nalaginrut_>maybe pointer->bytevector >
<civodul>shanecelis: beware, (oop goops save) is half-baked
<nalaginrut_>?
<civodul>well, it's under-used
<shanecelis>civodul: good to know.
<civodul>and yes, bytevector->pointer
<shanecelis>Awesome!
<shanecelis>man, this is so cool!
<nalaginrut_>I wonder how can I fetch websocket frame after the connection established, I mean using guile inner server
<shanecelis>Should .go files ever be installed in /usr/local/share/guile?
<shanecelis>I'm trying out guile-redis, which looks cool, but does install its .go files; however, it doesn't seem ilke they're used. guile recompiles them anyhow.
<civodul>shanecelis: to $prefix/share/guile/site/2.0
<civodul>and you need to set $GUILE_LOAD_COMPILED_PATH to point to that dir
<shanecelis>ok, cool.
<youlysses>shanecelis: Shane! I plan on setting a little time this weekend to play-around with emacsy, assuming it's at a point that such a thing is worthwhile (?). Either-way, excited though. :^)
<shanecelis>youlysses: Sweet! I'm trying to get it buildable and demoable for everybody. Grab it from github, and let me know how it goes!
<shanecelis>packaging is tough work.
<davexunit>emacsy is exciting.
<davexunit>I notice that it's not written in .scm files that I expected
<davexunit>because noweb?
<shanecelis>davexunit: I think it could have a good effect on guile libraries.
<mark_weaver>shanecelis: In Guile 2.0.9 (or later), if you 'write' an inexact number and then 'read' it back in, it is guaranteed to be identical to the original. there's only one exception: the payload of NaNs is not preserved.
<mark_weaver>shanecelis: Note however that in earlier versions of Guile, 'write' didn't always print enough digits to guarantee this.
<shanecelis>davexunit: For instance, I was thinking, maybe Emacsy should have a batchmode like Emacs does, and I think it should, but I'm going to guide people towards Emacsy is for the interactive app, but just use guile when you want to non-interactive scripts. This'll encourage people to write more guile modules that everyone can use, not just one Emacsy app.
<shanecelis>mark_weaver: Good to hear! I got bit by that on a different project and have become superstitious. :)
<shanecelis>davexunit: yeah, I'm trying to do it as a literate program, god help me.
<davexunit>shanecelis: yeah I'm not familiar with literate programming so the source files confused me.
<mark_weaver>for that matter, in earlier versions of guile 2.0.x, even the numeric constants in your code (or derived constants from the partial evaluation pass) would lose precision, because the compiler serializes numeric constants using the same code that 'write' uses.
<mark_weaver>but that's all fixed now.
<shanecelis>davexunit: It's a big experiment. We'll see how it goes.
<shanecelis>mark_weaver: awesome.
<shanecelis>civodul: (oop goops save) has betrayed me as you said it would.
<davexunit>shanecelis: what's your emacs workflow like? do you get syntax highlighting and paredit in noweb buffers?
<shanecelis>davexunit: M-x noweb-set-code-mode scheme-mode does work, kind of.
<shanecelis>davexunit: I do get paredit, but the noweb files have both C and scheme code in them, so you have to manually switch the code mode. :( Sometimes however, Emacs trips up on other things and screws up the syntax highlighting.
<tupi>mark_weaver: hello, i have a question about numbers, i recently isntalled 2.0.9 [latest git] and since, floats that come fom guile-sqlite have a lot of decimals, where sqlite3 [console session] have 1 decimal only: here is an example, better for you to understand
<tupi>sqlite> select sum(duration) from kise where who = 'david';
<tupi>sum(duration) = 1741.7
<tupi>
<tupi>scheme@(guile-user)> (db-kise/select-some "who = 'david'" #f "sum(duration)")
<tupi>$2 = (#(1741.7000000000007))
<tupi>sqlite3.scm code returns float with the folowing code:
<tupi> ((2) ; SQLITE_FLOAT
<tupi> (value-double (stmt-pointer stmt) i))
<shanecelis>davexunit: It's not wonderful yet. :(
<davexunit>shanecelis: C and scheme in the same source file?
<davexunit>what does emacsy need to do in C land?
<shanecelis>davexunit: Not much, but a few things of convenience.
<tupi>i have to 'round' these to 1 decimal only, what is the best way to do so ?
<davexunit>shanecelis: I see. thanks for answering my questions. I'm still trying to get a full picture of what emacsy actually does.
<mark_weaver>hmm. well, if you just need to *print* them at one decimal, 'format' can do that for you.
<shanecelis>davexunit: Now that I think about it, there's very little C in Emacsy. I was complaining more about noweb-Emacs integration for some other projects that do have a lot more C.
<mark_weaver>as for rounding the number itself to just one decimal place, that's a bit thorny since they aren't actually stored as decimal internally.
<mark_weaver>give me a minute or two to think on this.
<tupi>mark_weaver: sure. i do use format but it sounded 'expensive'
<davexunit>shanecelis: cool. looking forward to future developments and some sample applications. :)
<davexunit>that emacsy webkit screenshot was really cool.
<mark_weaver>tupi: I suspect this would be sufficient: (define (round-to-tenth x) (/ (round (* 10 x)) 10))
<tupi>ok, thanks
<shanecelis>davexunit: Thanks. Yeah, it feels really good to pull down some huge C beast and attach a few Guile hooks to it and it becomes super programmable.
<tupi>mark_weaver: i was doing this:
<tupi>(define (fp/round-1 float dec-nb)
<tupi> (format #f "~?" (format #f "~~,~AF" dec-nb)
<tupi>
<tupi>(define (fp/round float . dec)
<tupi> (if (null? dec)
<tupi> (string->number (fp/round-1 float 2))
<tupi> (string->number (fp/round-1 float (car dec)))))
<tupi>
<mark_weaver>tupi: having thought about it some more, I'm quite confident that with 2.0.9 or later, the result of 'round-to-tenth' will always be printed with exactly one digit after the decimal point.
<mark_weaver>tupi: with earlier versions, who knows. if you need to guarantee that, maybe 'format' would do the job, but I'm not super familiar with the code.
<tupi>mark_weaver: many thanks, will use that, my solution [temporarily] is far too expensive
<tupi>no, i can impose guile-2.0.9 to future release of kise
<davexunit>shanecelis: from the extremely brief look I took at the source code, I remember seeing a blurb about using delimited continuations for the event loop. I'm also building a framework with an event loop (guile-2d) and I'm curious.
<youlysses>shanecelis: That's queer, AM_EXTRA_RECURSIVE_TARGETS is not found when I'm running the autogen.sh script.
<shanecelis>youlysses: Is it different automake versions?
<shanecelis>youlysses: I'm at automake 1.13.1
<youlysses>shanecelis: Different, from? I'm currently on my Debian Stable box.
<shanecelis>youlysses: I'm on Mac OS X.
<mark_weaver>tupi: glad to help! :)
<mark_weaver>going offline for a bit...
<add^_>hum
<youlysses>It appears the metapackage defaults to 1.11 here.
<shanecelis>youlysses: hmm... good to know where the troubles may lie.
<shanecelis>youlysses: well, I'd say just comment it out and trudge along
<davexunit>shanecelis: upgrade to gnu/linux
<shanecelis>davexunit: :) I will be setting up a linux machine again soon.
<youlysses>shanecelis: I, done. Now... what's "markup"? :^U
<youlysses>That's a pretty generic title.
<shanecelis>youlysses: ah, That's a bit of noweb stuff. Have you installed noweb?
<youlysses>shanecelis: You excited for an upstream guix-based GNU distro? :^)
<youlysses>shanecelis: Yup, no such thing installed with it.
<davexunit>shanecelis: I use OS X at work. not much of a fan, even putting aside my aversion to apple.
<shanecelis>youlysses: Yes, I am. Direct me to the best distro, please.
*taylanub wonders if it would ever be practical to use Guile for the JS engine of a browser.
<davexunit>taylanub: I would love that.
<shanecelis>youlysses: So, civodul make guix package of noweb, but otherwise, you can grab it here: http://www.cs.tufts.edu/%7Enr/noweb/
<shanecelis>s/make/made/
<youlysses>shanecelis: The "best distro" doesn't yet exist in a form that is easily distributable... We might get a bootable image by the end of the year though. *Cough* Cividoul *Cough. :^)
<davexunit>Debian is a great choice.
<youlysses>We need a tipjar type service on Savannah or something, I need to through civodul some change one of these days...
<youlysses>shanecelis: For the time being, some fully FOSS distros are Trisquel, one of the best "prebuilt" experiences out-there and parabola is great assuming you have some time on your hands to configure it. Debian is pretty good choice of you aren't militant about the some of the more-or-less "hard headedness" ideals.
<youlysses>*throw
<davexunit>youlysses: he's using OS X now so I don't think he'll take issue with Debian. :P
<shanecelis>davexunit: :)
<davexunit>Trisquel is cool, but Debian has a lot more going for it, imo. non-free stuff is in its own repo and you can also choose to use linux-libre if you want.
<youlysses>shanecelis: I may have found the problem, libexec, which the current configure.ac is set to, seems to have been renamed as a directory on (Debian and a number of other distros) to just lib.
<shanecelis>youlysses: ah. I think civodul ran into a similar problem.
<shanecelis>youlysses: If I changed this AC_PATH_PROG([markup], markup, no, [$PATH:$noweb_home/libexec/noweb])
<shanecelis>youlysses: to this AC_PATH_PROG([markup], markup, no, [$PATH:$noweb_home/libexec/noweb:$noweb_home/lib/noweb]) would it work?
<davexunit>I thought that the debian kernel was fully free as-of squeeze but I guess not, according to a promotion for linux-libre that said "free your debian"
<youlysses>shanecelis: I would've thought... but it appears not.
<shanecelis>can you share your path to noweb and your path to markup?
<taylanub>Since I switched my browser's default background color, I'm hating on all sites that make their text explicitly black but don't touch the background color.
<taylanub>Oh wait, I think that's the browser's fault, not applying my default foreground color to content. :\\
<youlysses>shanecelis: Noweb is at "/usr/lib/noweb/" and wait, markup is a separate dependency?
<taylanub>OK, it was *my* fault, I set GTK's background, GTK's foreground, the browser's background, but not the browser's foreground! Yay, I have HTML sites light-grey on black by default now.
<taylanub>(Search for "color" in about:config if using XULRunner/Firefox.)
<shanecelis>youlysses: no, markup is part of noweb, it's just not in the same bin directories.
<youlysses>shanecelis: I was going to say, because I can see the bin in here... :^U
<youlysses>taylanub: What, you aren't part of the glorious pre-emacsy-webkit master-race that-is conkeror? :^P
<taylanub>I am indeed using Conkeror, via firefox -app. :P It's pretty much covered under "XULRunner/Firefox" ..
<youlysses>I probably just need to get adblock going in conkeror, and I'd be happy for quite sometime.
<youlysses>It'd be interesting to see how easy it'd be, to write webkit extensions in guile.
<davexunit>our goal: guile everywhere.
<youlysses>davexunit: Ideally, I'd like to more-or-less rewrite Emms as a standalone app with Emacsy talking directly to gstreamer.... :^)
<davexunit>oooohhh
<davexunit>that sounds awesome
<davexunit>and we could provide a more graphical interface too, I would imagine?
*taylanub thinks that using any other GUI than that of Emacs would be a misfeature. :P
<youlysses>taylanub: ++
<add^_>taylanub: ++
<shanecelis>youlysses: Noweb's markup for me is in /opt/local/libexec/noweb/markup
*davexunit accepts defeat
<youlysses>davexunit: I mean, give enough flexibility it could easily be done. That being said, I think it'd definitely default to a keyboard-centric approach.
<davexunit>youlysses: I agree about that.
<youlysses>shanecelis: There's currently nothing in my /opt directory on/in this install.
<shanecelis>youlysses: I'm just providing you a for instance. Where are noweb and markup installed on your machine?
<youlysses>davexunit: My goal is to eventually write a wayland compositor in the key-of stumpwm and make a "Emaculate DE" around it... but that's certainly a *long* term goal... :^)
<davexunit>youlysses: I've had similar thoughts
<davexunit>some people in another channel I hang out in wanted to make something called WizardWM.
<davexunit>personally, I can't make heads or tails of the X protocol and the freedesktop standards around it.
<youlysses>shanecelis: The binary for markup, is in the directory /usr/lib/noweb/.
<taylanub>TIL of literate programming, BTW.
<youlysses>davexunit: Assumingly kind-of like Xiomacs? It's a great-idea (though I'd like the default experience to be less rodent-focused), but trying to work with xorg, specifically with something tied directly to it for something one probably would want to use 5-10+ years down the road, does not seem like a worthy investment to me. :^P
<shanecelis>youlysses: And where is the binary for noweb?
<youlysses>shanecelis: Just /usr/bin/noweb
<shanecelis>youlysses: cool. I think what I have will work.
<youlysses>shanecelis: Yah, I'm "helping"? :^)
<shanecelis>youlysses: Yes, indeed!
<youlysses>:^D