IRC channel logs

2014-06-07.log

back to list of logs

<zxq9>Is there any introductory reference on guile's bytecode since v2?
<taylanub>zxq9: I don't see documenting the bytecode being very useful; if you want to compile a language to the Guile VM, you should be better off compiling to the intermediate language I think?
<zxq9>"intermediate" being guile's scheme?
<taylanub>As far as I understand it, Tree-IL would be the usual choice: (info "(guile) Tree-IL")
<zxq9>Is there an introduction to this? I am not familiar with Tree-IL.
<taylanub>the Info node I linked :)
<taylanub>if you're using Emacs you can open that by entering that into M-:
<zxq9>So far I have written lispy dsl's that reduce to scheme -- which is really easy. I'm just curious about implementation choices.
<zxq9>I don't see a link?
<zxq9>oh, nm.
<zxq9>lol
<taylanub>(if you're using an Emacs IRC client you can also just put the cursor after the closing ")" and hit C-x C-e)
<zxq9>Ah, there is a whole subsection on it in the manual. Never noticed it.
***sneek_ is now known as sneek
<davexunit>hey guilers.
<stis>heya davexunit
<davexunit>I'm having a problem with reduce. reduce iterates from left to right, yes?
<davexunit>(reduce - 0 '(3 1)) is returning -2!
<stis>(use-modules (srfi srfi-1))
<stis>(fold - 0 '(3 1))
<stis>$2 = -2
<stis>(fold-right - 0 '(3 1))
<stis>$3 = 2
<davexunit>weird, huh?
<davexunit>(fold - 0 '(3 1)) returns -2 as well
<davexunit>reduce calls fold, so no surprise.
<stis>fold-right ^^
<davexunit>okay, I'm dumb.
<davexunit>thanks for being a good rubber duck. :)
<stis>quack quack!
<davexunit>wait...
<stis>:)
<davexunit>still confused
<stis>fold-right (- 3 (- 1 0))
<stis>2
<davexunit>why does it have to be right?
<daviid>hello guilers! davexunit are you g-wrap familiar?
<stis>first value from right is 1, hence (- 1 0)
<stis>and so on
<davexunit>daviid: sorry, I'm not.
<stis>so it reduces right to left, fold does left to right
<stis>fold: (- 1 (- 3 0))
<stis>-2
<daviid>davexunit: so guile-2d you wrapped 'manually' ?
<davexunit>daviid: I used the ffi for talking to C libraries.
<davexunit>stis: but with reduce, there should never be 0 in there.
<daviid>but nothing was auto then, reading parsing *.h, building types ...
<daviid>davexunit: just curious sorry
<davexunit>daviid: guile-opengl generates bindings by processing the opengl xml spec
<stis>0 is the init value, you have it above in your reduce example no?
<stis>davexunit^^
<davexunit>stis: 0 is the value returned if the list is empty
<daviid>ok
<davexunit>daviid: that's a good example of auto-generated bindings
<davexunit>I plan to do the same for SDL 2
<davexunit>someone gave me a JSON file with the spec that they generated with llvm or something.
<stis>aha, weird :-)
<davexunit>I just don't get why it's doing (- 1 3) instead of (- 3 1)
<stis>it moves from left to right no?
<davexunit>the equivalent case with fold is (fold - 3 '(1))
<stis>(reduce-right - 0 '(3 1))
<stis>2
<taylanub>reduce is just fold without using the init value (except when given an empty list), thus saving one call to the function. SRFI-1 explains this well I think.
<davexunit>yes, I know that.
<davexunit>(fold - 3 '(1)) is the same as (reduce - 0 '(3 1))
<davexunit>I know it's a different language, but in Ruby: [3,1].reduce(:-) returns 2.
<taylanub>"Note: MIT Scheme and Haskell flip F's arg order for their reduce and fold functions."
<taylanub>uhm, dunno if that's relevant
<davexunit>okay, I finally see it.
<daviid>davexunit: it surely is a good example. are you familiar with the guile-opengl xml spec reader?
<davexunit>daviid: not really, no.
<stis>going left to right is natural to have if you have cons lists, does Ruby have that?
<davexunit>for (fold - 3 '(1)), 3 is knil, and that's returned when the given list is null.
<davexunit>therefore (- 1 3)
<taylanub>going left to right or the other way wrt. how the list is traversed is an orthogonal question to the order of arguments in each function-call, I think?
<civodul>davexunit: BTW, you had work on a Guix package for Guile-OpenGL, no? :-)
<civodul>*worked
<davexunit>civodul: I started it but got blocked
<davexunit>figuring out how to deal with dynamic-link call
<civodul>ah, ok
<civodul>yes, that rings a bell now
<davexunit>I also have a nearly working notmuch package
<davexunit>but I was having trouble with dtach, a program needed by the test suite.
<civodul>okay
<davexunit>I wish I could get both of those done before the next release but I don't think it's going to happen.
<civodul>i can help with Guile-OpenGL if you want
<davexunit>civodul: okay. :) I'll find the basic recipe I had for it, or rewrite it if I no longer have it.
<davexunit>going out to dinner now, though.
<davexunit>ttyl