IRC channel logs

2014-02-14.log

back to list of logs

<ArneBab>didi: if you want to work on the manual, this site might be a good read: http://stevelosh.com/blog/2013/09/teach-dont-tell/
<didi>ArneBab: Thanks.
<madsy>Ahh.. lovely. I just got generated all the 1200 opengl enums for my alist
<ArneBab>saul: when emerging lilypond 2.18, it tells me ERROR: Please install required programs: guile-config < 1.9.0 (installed: 2.0.9) (guile-devel, guile-dev or libguile-dev package) or guile1-config (guile1-devel package) libguile (libguile-dev, guile-devel or guile-dev package). GUILE-with-rational-bugfix
***wleslie_ is now known as wleslie
<dsmith-work>ArneBab: Thanks for that teach-dont-tell link
***dsmith-w` is now known as dsmith-work
<adhoc>morning
<adhoc>i'm looking to do some GUI apps
<adhoc>and was looking at FLTK as i've used it about a decade ago
<adhoc>and looking for the guile-fltk binding, have found some but limited info on it
<adhoc>anyone used it recently ?
<adhoc>this is the only recent reference i can find to it; http://www.reddit.com/r/scheme/comments/1c214s/gnu_guile_209_released/
<wleslie>guile has good gtk support
<wleslie>I prefer tk myself, but I've never tried it from guile
<saul>ArneBab, I will look into it this weekend. I haven't installed Lilypond yet, but was basing its Guile 2 support on the dev branches change logs.
<saul>s/branches/branch's/
<mark_weaver>adhoc: I didn't even know guile had bindings to fltk. I haven't heard anyone mention them until now.
<adhoc>mark_weaver: ok ta
<adhoc>wleslie: gkt, is a little bit more than i was willing to chew off
<mark_weaver>as wleslie said, we have good bindings for gtk+-2
<mark_weaver>but if there's a fltk binding, maybe it will just work, or wouldn't take much to get it working, dunno.
<cluck>even if there were no bindings it shouldn't be hard to use fltk with guile's ffi
<adhoc>i just found a tarball of 0.1.2
<adhoc>other searching suggests there was at leas 0.4.0 in the wild
<adhoc>around 1999
<adhoc>-rw-rw-r-- 67999 Jun 28 1999 guile-fltk.0.1.2.tar.gz
<adhoc>from; http://ftp.math.utah.edu/u/ma/hohn/linux/visualization/index
<adhoc>anyhow, i'll have a tinker with that
<adhoc>its just all the reading i've done and use of py+gtk has been too menory heavy for the embedded apps i'm working on
<mark_weaver>one thing I should say though: it's important to use guile-2.0.x. We dropped support for guile-1.8 about 3 years ago.
<adhoc>yeah i'm using 2.0.9
<mark_weaver>cool :)
<adhoc>i think it must be a git/tarball install as debian/wheezy seems to whip 2.0.5
<adhoc>hmm
<mark_weaver>that file is from 1999.
<adhoc>ok so why gtk and not something else, like qt?
<adhoc>yeah
<mark_weaver>gtk is specifically designed to be easy to make bindings for. qt is pretty C++ centric.
<mark_weaver>it could certainly be done, but it would be a lot more work.
<adhoc>oh ok
<didi>Last time I checked, there was no readily available gtk binding to Guile.
<wleslie> http://www.gnu.org/software/guile-gtk/
<ArneBab>saul: thanks!
<ArneBab>cu
<mark_weaver>didi, wleslie: no, that's an old abandoned project.
<wleslie>there's a new gi project?
<mark_weaver> http://www.gnu.org/s/guile-gnome/
<adhoc>the repo shows the last guile-gtk release as 2.1 in dec 2007 ?
<wleslie>wingo was a big gnome geek so such things are readily supported
<mark_weaver>guile-gnome is the one you want. it includes a gtk binding. it's modularized so you don't have to include all the gnome stuff if you don't want.
<didi>Maybe things have changed, but guile-gnome could not be readily run with the last stable version of guile.
<mark_weaver>it fully supports gnome-2 and gtk+-2.
<adhoc>whats the story on gnome3 desktop ?
<mark_weaver>it hasn't yet been upgraded to gnome-3 or gtk+-3.
<adhoc>or more to the point non-gnome window managers ?
<mark_weaver>it doesn't need gnome. you can use just gtk+
<wleslie>gnome isn't a window manager, but you can just use the components you need really
<wleslie>you don't need to be running a full gnome DE to use a gstreamer application, for example
<mark_weaver>guile-gnome contains bindings for several libraries that are important in gnome. you can pick and choose the ones you want to use.
<adhoc>hmm, next dep; g-wrap
<didi>Is it possible to know the arity of a procedure?
<zacts>evening
***wleslie_ is now known as wleslie
<zRecursive>How to break and return from a loop when some condition meet ?
<didi>zRecursive: You can use a continuation.
<mark_weaver>zRecursive: as didi said, continuations are the most general method. if you want something traditional, guile has a 'while' form that supports 'break' within.
<mark_weaver>(it's implemented using continuations)
<nalaginrut>morning guilers~
<mark_weaver>delimited continuations in particular (see 'call-with-prompt' and 'abort-to-prompt')
<mark_weaver>hi nalaginrut!
<b4283>nalaginrut: ah! i was gonna beat you to say it!
<nalaginrut>heya ;-D
<b4283>nalaginrut: too bad my fingers are too slow to type ;)
<nalaginrut>well, it's still winter today huh?
<mark_weaver>didi: in general, a given procedure can support any number of arities, as well as things like keyword arguments, etc, so it's not that simple. out of curiosity, why do you want this?
<didi>mark_weaver: `curry'
<didi>mark_weaver: Not that I need. I was just curious. Partial application is already enough for my needs.
<mark_weaver>didi: well, it's easy to write a macro that lets you define a curried procedure, anyway.
<mark_weaver>there *are* ways of getting the supported arities of a procedure, but they are sort of internal things and subject to change. not a good thing to base your code on.
<zRecursive>thanks all
<mark_weaver>didi: do you know about 'cut'?
<didi>mark_weaver: I do not.
<didi>mark_weaver: SRFI-26?
<mark_weaver>yep
<didi>OK, I'll read it. Thank you.
<mark_weaver>you're welcome!
<didi>Uh, nice.
<didi>mark_weaver: Thank you for the reference.
<mark_weaver>np, happy hacking!
***wleslie_ is now known as wleslie
<foeniks>when I develop a guile module (define-module ....) and I start writing code there, I kind of feel that the verbosity level of compiler/interpreter error messages is way smaller
<mark_weaver>compared with what?
<foeniks>compared to when running the script with $ guile script.scm
<foeniks>maybe I am "perceiving" wrongly
<mark_weaver>how are you loading the module?
<foeniks>with ,L
<foeniks>ah no
<foeniks>with ,load
<mark_weaver>is it compiling the module? if so, you should see messages to that effect the first time you load it since modifying it.
<mark_weaver>,use is really what you should be using, fwiw.
<mark_weaver>a module named (foo bar baz) should go in <DIR>/foo/bar/baz.scm, where <DIR> is a component of %load-path
<mark_weaver>and then use ,use (foo bar baz) to load it. that will also compile it.
<mark_weaver>it's true that error messages aren't nearly as useful for non-compiled code.
<mark_weaver>an easy way to add a directory to %load-path is to set GUILE_LOAD_PATH in your environment before launching guile.
<mark_weaver>or pass -L <DIR> to guile
<foeniks>thats great help, thank you
<mark_weaver>you're welcome!
<foeniks>It seems that ,use is not listed by ,help all or ,help module
<foeniks>would be kind of useful there imho
<mark_weaver>for me, it's shown in both of those places. what version of guile are you using?
<mark_weaver>ah, it's called ,import in the left column, and ',use' is an abbreviation shown in the middle column.
<foeniks>ah
<foeniks>yes
<foeniks>my mistake
<mark_weaver>also see ,reload which is useful if you made changes to the module and then want to reload it without restarting guile.
<foeniks>okay
<foeniks>Is there a namespacing technique in guile? Such as clojure's prefixing with namespace/localname ?
<mark_weaver>guile allows you to rename the symbols that are imported from a given module using an arbitrary renamer procedure. we provide one to add a prefix.
<mark_weaver>see https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html
<mark_weaver>scheme identifiers do not have an namespace/localname syntax in the language, though.
<mark_weaver>guile allows you to reference an arbitrary exported identifier from an arbitrary module (without even importing it) using the syntax (@ <module> <identifier>), e.g. (@ (ice-9 popen) open-input-pipe)
<mark_weaver>if you use @@ instead of @, then you can access non-exported identifiers as well.
<mark_weaver>but personally, I'd recommend avoiding that syntax when you can.
<foeniks>thanks
<civodul>Hello Guilers!
<ArneBab_>moin civodul
<nalaginrut>heya
<nalaginrut>mark_weaver: BTW, how can I get unexport things if I can't use @@ under some situation?
<nalaginrut>for example, I have a list '(mod aaa) as a module path, and I want to get unexported symbols from it
<nalaginrut>I think @@ can't accept quoted list
<mark_weaver>nalaginrut: you can use 'module-ref'.
<nalaginrut>module-ref can get unexported thing?
<nalaginrut>well, the introspection of modules lacks of docs
<mark_weaver>it's all documented. use the index.
<mark_weaver>and yes, it can get an unexported thing.
<nalaginrut>hmm...it's better if it can be showed with ',d'
<mark_weaver>s/thing/binding/
<nalaginrut>alright, thanks ;-)
<mark_weaver>yes, it's true that ,d needs some love.
<mark_weaver>you know about the 'i' keybinding in emacs info mode, yes?
<mark_weaver>well, it's supported in the standalone info reader too, but I never use that :)
<nalaginrut>mark_weaver: is it a geiser feature?
<mark_weaver>I don't know. I just type 'i' in the guile info manual within emacs.
<mark_weaver>i module-ref RET
<nalaginrut>hmm...I can't catch it, type 'i' in Emacs screen?
<nalaginrut>how can I enter guile info manul in Emacs?
<mark_weaver>nalaginrut: do you know how to read texinfo manuals within emacs?
<nalaginrut>no
<mark_weaver>C-h i
<mark_weaver>then select the Guile Reference manual in there.
<mark_weaver>and then: i module-ref RET
<mark_weaver>it will take some learning how to use info mode in emacs, but it's well worth your time.
<mark_weaver>IMO anyway
<nalaginrut>alright, that's great!
*nalaginrut can't claim he 'can' use Emacs anymore..
<nalaginrut>thanks for the hint ;-D
<nalaginrut>so the module-ref and module-set! will ignore whether the symbols are exported?
<mark_weaver>I already said that. please don't waste my time. it's all in the manual.
<mark_weaver>(and you can also just try the experiment)
<b4283>yes, i'm terribly sorry
<b4283>nalaginrut: go to #emacs.tw for chinese emacs disscussion ! :D
<nalaginrut>I'm sorry, but I said so because I can't find the 'unexported description' in the module-ref item
<mark_weaver>you'll need 'resolve-module' also.
<nalaginrut>I know I have to use resolve-module first
<mark_weaver>(module-ref (resolve-module '(foo bar)) 'name)
<nalaginrut>anyway, it's trivial, I can just confirm it by practice
<mark_weaver>exported vs non-exported is a matter of whether you use 'resolve-module' or 'resolve-interface'.
<mark_weaver>anyway, I apologize for snapping at you. I just need sleep.. good night, and happy hacking.
<nalaginrut>OK, I think this is the key info for my question
*mark_weaver --> zzz
<ArneBab_>mark_weaver: good night!
<nalaginrut>mark_weaver: never mind
<nalaginrut>night
<nalaginrut>alas~I really understand a tired hacker's feeling...
<ArneBab_>How can I get the module in which a given binding was defined?
<ArneBab_>I tried procedure-properties, but that does not give the module
<ArneBab_>Essentially I would need the equivalent to (current-filename), but (filename-in-which-this-binding-was-defined)
<ArneBab_>as simple testcase: ,use (srfi srfi-1) (<something> list-tabulate) ⇒ /path/to/srfi/srfi-1.scm
<nalaginrut>ArneBab_: well, there's a way to parse the module name from apropos
<ArneBab_>nalaginrut: can I also get that from code?
<ArneBab_>(somehow it must be possible: apropos can do it…)
<ArneBab_>(apropos "list-tabulate") seems to work
<nalaginrut>you need a way to hold the string rather than print it out
<ArneBab_>yes, and to pass it any atom, not only strings
<jmd>I don't understand why array-set! inside of let seems to do absolutely nothing.
<nalaginrut>ArneBab_: you can get the exact info easily from procedures, with program-module
<nalaginrut>(module-name (program-module any))
<nalaginrut>==> (srfi srfi-1)
<nalaginrut>jmd: can you show the code?
<nalaginrut>ArneBab_: I used such trick in nala-repl, to find out the source of any procedure
<ArneBab_>nalaginrut: in which module can I find that?
<nalaginrut>s/source/source code
<ArneBab_>nice!
<ArneBab_>nalaginrut: I’m writing about my experiences with Guile from the view of a Pythonista, and I’m currently checking for the hackability of Guile
<ArneBab_>that’s why I ask that
<ArneBab_>(in python you just access some magic variables like __dict__ or __locals__()
<nalaginrut>but unfortunately, it not always work. Because some proc are written with C, or macro, so can't catch them
<ArneBab_>I cannot call (program-module ...) → unbound variable
<nalaginrut>ArneBab_: you want to know what things were exported in a certain module?
<ArneBab_>I want to know it the other way round: From which module does this binding originate
<nalaginrut>but neither __dict__ nor __locals__ shows that
<nalaginrut>in python
<ArneBab_>in Python I have namespaces for that
<ArneBab_>and help(something)
<nalaginrut>can you show that what you want to do in python?
<nalaginrut>python code
<nalaginrut>ArneBab_: for program-module, you need (system vm program)
<ArneBab_>ah, ok - thanks!
<ArneBab_>In python I just do `import math; math.__file__` → filename of the module.
<ArneBab_>and then math.log.__module__ → 'math'
<nalaginrut>well, I have loaded bunch of modules in ~/.guile, so I can't tell which are in default module sometimes
<ArneBab_>no probs
<ArneBab_>but this is a perfect usecase for program-module: (program-module program-module) ☺
<nalaginrut>ah~self-reference
<ArneBab_>argl
<ArneBab_>(program-module program-module) ⇒ #f
<ArneBab_>this is surprising…
<ArneBab_>and it gives the same result for program-meta
<jmd>nalaginrut: Oh that's wierd. On this machine it works.
<ArneBab_>ah… Can return ‘#f’ if the compiler could determine that this information was unnecessary.
<nalaginrut>ArneBab_: really? you find it on manual?
<ArneBab_>nalaginrut: yes, just C-s program-module C-s C-s ... in the info
<nalaginrut>so Guile is clever enough to avoid self-reference
<nalaginrut>good boy
<nalaginrut>;-D
<ArneBab_>well…
<ArneBab_>It rather seems that it optimizes that away
<ArneBab_>((program-meta list-tabulate)) ⇒ huge list, including the filename (but not the full path)
<ArneBab_>((program-meta program-module)) ⇒ (() () ((3 7 1 0 #f)) (name . program-module))
<ArneBab_>nalaginrut: https://www.gnu.org/software/guile/manual/html_node/Compiled-Procedures.html
<nalaginrut>well, you don't need meta in this case I think
<nalaginrut>hah, seems the manual got improved a lot these months
<nalaginrut>once I've read the manual carefully, so I program with the old version manual I remembered in my mind
<ArneBab_>:)
<ArneBab_>now I just need to be able to find the absolute path to that…
<nalaginrut>ok, actually, you need to get the file includes the module
<nalaginrut>not the module name
<ArneBab_>yes - to easily find out where to fix code
<ArneBab_>(and then the same for defined variables)
<nalaginrut>ArneBab_: you can get some help from my https://github.com/NalaGinrut/nala-repl/blob/master/nala/src.scm
<ArneBab_>nalaginrut: thanks! (I’ll check it)
<ArneBab_>now
<ArneBab_>ah, %load-path
<nalaginrut>in my case, I have to find all the possible files one by one
<nalaginrut>sorry, not files, but paths
<nalaginrut>anyway, IMO, once the module get compiled, you can't assume its original absolute path
<nalaginrut>so a better solution to get source code of any procedure is to add a special info for that.
<ArneBab_>so this could be ambigous, if the name gets reused?
<nalaginrut>Just like elf for gdb
<ArneBab_>that would be nice, yes
<ArneBab_>actually for any binding
<nalaginrut>ArneBab_: I assumed the modules will load in the %load-path list order, if it'
<ArneBab_>it actually should, I think
<nalaginrut>if it's true, it's ok even if it gets reused
<nalaginrut>anyway, after we have even half baked ELF support, I think it's easier to add source code into object file
<nalaginrut>so we never need to find out a module file anymore
<nalaginrut>it's in the ELF
<ArneBab_>that would be quite useful - does it come with the CPL-change? (register machine)
<nalaginrut>I call it half-baked because our AOT still under construction
*ArneBab_ thought guile already used ELF
<nalaginrut>ArneBab_: IIRC, wingo once said it *is* ELF wrapped go file
<nalaginrut>not a real ELF format
<nalaginrut>hmm...I think it's confused to said so
<ArneBab_>ok
<nalaginrut>it'll be real ELF format after AOT is done, I think
<nalaginrut>but for 'source code' case, I think it's ok to put the source code in
<nalaginrut>no matter AOT
<nalaginrut>dunno, just guessing
<ArneBab_>ok
<nalaginrut>anyway, the source code problem can be solved in the future in a better way
<nalaginrut>ArneBab_: but your need is not about source code ,right?
<ArneBab_>yes
<ArneBab_>it’s just about being able to quickly find where the source is
<ArneBab_>or rather: whether I could use similar hackery as in Python ☺
<nalaginrut>well, IMO, even if Python provides such thing, it's not so nice
<nalaginrut>as I said, once a module get compiled, you can't assume its absolute path
<ArneBab_>it leads to things like “find my game image files relative to the scriptfile”
<nalaginrut>I mean its source file absolute path
<ArneBab_>exactly
<ArneBab_>(that’s what I mean)
<nalaginrut>unless there's a convention for that, or I think it's harmful to be used
<ArneBab_>it hurts on the long term - but it can be very useful for quickly getting up to speed
<ArneBab_>nalaginrut: OT: Guile AOT has mediocre google foo: http://www.youtube.com/watch?v=FPBK7NbxwEQ
<ArneBab_>nalaginrut: I’m explicitely checking whether Guile allows me to shoot myself in the foot like Python ☺
<jmd>ArneBab_: Pythons don't have feet.
<ArneBab_>
<nalaginrut>oh~seems Attack on titans are so popular
<nalaginrut>it's very popular in China
<ArneBab_>it’s really cool - and just got licensed in Germany
<nalaginrut>well, nice joke~
<civodul>folks, how's the potluck hack going? :-)
<civodul>2 days left!
<nalaginrut>civodul: oh, I didn't see an official notice
<ijp>civodul: alas, programmers block
<nalaginrut>although I have something could be showed, but it's too hurry
<nalaginrut>when you want to use a var named 'potluck', you have to declare it in advance hmm...
<civodul>nalaginrut: http://lists.gnu.org/archive/html/guile-user/2014-02/msg00008.html
<civodul>let's hack!
<nalaginrut>civodul: ah~seems I have only Saturday for it ;-D
<nalaginrut>alright, I unsubscribed guile-user by some mistakes when I was changing my mail client
<sankey>i think the "&amp;" html sequence here is wrong?
<sankey> https://www.gnu.org/software/guile/docs/faq/guile-faq.html#How-do-I-create-a-procedure-that-takes-keyword-arguments_003f
<sankey>line 2 of the code
<ijp>heh, I'd completely forgotten about the faq
<nalaginrut>FAQ is staled for many years
<nalaginrut>IMO
<ijp>the example is doubly wrong because we don't have bound? either
<ijp>and you don't need ice-9 optargs
<civodul>sankey: actually this FAQ is well outdated
<civodul>we should prolly remove it
<ArneBab_>civodul: better add a redirection Link to the top
<dsmith-work>Happy Friday, Guilers!!
<civodul>Happy Friday!
<davexunit>happy friday!
<cluck>:)
<stis>evening guilers and, as said before, Happy Friday!
<mark_weaver>ijp: are you around?
<mark_weaver>I have an R6RS question for you.
<mark_weaver>basically, I'm wondering what your thoughts are on what filename to use for (foo :5) in R6RS or (foo 5) in R7RS.
<mark_weaver>I was leaning toward just using the number directly, but I don't know all the relevant issues.
<mark_weaver>I guess I should ask on the ML.
<stis>Hehe, it's a bit difficult to implement numbers according ro iso-prolog implementation
<stis>guile is so blody smart that sin(0) is an integer solution etc.
<stis>I will punt on that.
<mark_weaver>how does that cause problems for iso-prolog?
<mark_weaver>0.0 is also an integer, it's just not an exact integer.
<stis>0.0 is 0 is false
<mark_weaver>ah, so prolog doesn't have a way to distinguish operational equivalence from numerical equivalence.
<stis>yep
<stis>they also tend to compare inexact numer with an eqv and not with explicity range check
<mark_weaver>how does it work in prolog? how does one normally compare numbers? are floats distinguished from exact integers?
<stis>yes they are two different types
<stis>you need explicit type cast to compare them
<stis>on a second though I will wrap the needed function with exact->inexact
<stis>else you may get really hard to find bugs
<mark_weaver>okay
*mark_weaver goes offline for a bit...
<foeniks>can I use macroexpand to expand into scheme and not tree-il
<foeniks>?
<mark_weaver>foeniks: out of curiosity, what were you planning to use this for?
<foeniks>I would like to see to what s-expr my scheme expression is transformed to reason about [[the macro
<mark_weaver>use ,expand at the REPL
<mark_weaver>also see ,optimize
<mark_weaver>what version of guile are you using?
<foeniks>a built from the git HEAD
<mark_weaver>cool
<mark_weaver>please note that the 'master' branch is not yet fully functional, and is not ABI stable, so if you build any libraries against it, you may have to recompile those libraries again from time to time.
<mark_weaver>(well, the only missing functionality I know of is that the debugger is not quite there yet)
<mark_weaver>Depending on your needs, the 'stable-2.0' branch might be preferable for now.
<foeniks>I am bound to a mac at the moment, so building from git is the only thing that really worked
<foeniks>using homebrew
<mark_weaver>The 'stable-2.0' branch is in git too.
<mark_weaver>homebrew has guile-2.0.9, but you need to pass --devel to the brew command.
<foeniks>I think I told it to build from the git master
<foeniks>to get it running
<mark_weaver>several users have reported using guile-2.0.9 in homebrew without problems. if it doesn't work, I'd like to hear more details about why it doesn't work.
<mark_weaver>or what happened.
<mark_weaver>there are also some stability problems on master at the moment.
<foeniks>It might have had to do with me using snow leopard
<foeniks>since xcode etc was not supported for snow leopard anymore which lead to troubles
<foeniks>now that I run maverick I might then try guile-2.0.9 again
<foeniks>for the time being things seem to work quite well
<foeniks>in clojurescript, there were named lambda functions like (fn fn-name [x y z] body)
<foeniks>is there a similar construct in scheme?
<foeniks>I cannot remember seing one, gotta use letrec for this or (when applicable) named let fomrs
<foeniks>but maybe I am mistaken
<ijp>named lambda? no
<ijp>I think there was around r2rs, but it got dropped
<ijp>there is a rec form in srfi 31, which is basically (rec x y) = (letrec ((x y)) x)
<ijp>actually, that srfi is where I learned that there used to be a named lambda form
<foeniks>do you have a preferred paste service here?
<ijp>we prefer that you use one
<ijp>that's about it :)
<foeniks> http://paste.lisp.org/display/141243
<foeniks>thats my simple named lambda function
<foeniks>ahm macro
<foeniks>what is the benefit of `values` over returning a list?
<civodul>it's more efficient (no heap allocation), and the callee can ignore some of the returned values
<ijp>a questionable symmetry
<civodul>ijp: in fact it's just a hack for simplistic compilers :-)
<foeniks>thanks
<foeniks>gotta go
<foeniks>cya