IRC channel logs

2016-05-01.log

back to list of logs

<ft>Then again, it would be possible to call a C compiler at compile time in a macro.
<ft>But that seems tedious to write.
<Wojciech_K>Good day!
<Wojciech_K>The lastest guile tarball uses revoked key
<Wojciech_K>for signature
<Wojciech_K>ftp://ftp.gnu.org/pub/gnu/guile/
<jmd>I want to creat the list ("x1" "x2" "x3" .... "xN") What is the quickest way?
<df_>(map (lambda (x) (format #f "x~a" (+ x 1))) (iota n))
<wingo>mew
<linuxuser9000>Hi guys! I checked out guile after reading a post saying its new website is great. Question - could I work through SICP with guile-2.0 ?
<jmd>df_: Thanks
<wingo>linuxuser9000: you can, though there are some pieces of sicp that are not implemented in guile (the 'picture' language)
<jmd>What is scm_c_with_continuation_barrier ?
<df_>I did sicp in guile fwiw
<jmd>There seems to be random calls to it. And it trashes memory which doesn't belong to it, causing segfaults.
<df_>I hacked up a text-based version of the picture language
<wingo>jmd: for all questions "what is FOO" where FOO is a procedure, the answer should be in the manual :)
<wingo>df_: neat :)
<jjk`>hello. is there a way to use normal xpath? (sxpath "//foo") for example?
<wingo>i think so but i keep forgetting how to do it and the docs are terrible
<wingo>hum, seems not :/
<jmd>Is there a general way to trace what the GC is doing? and why things are gettting collected?
<jmd>I need to add an extra flag to a smob created with SCM_NEWSMOB (s_item, item_tag, x); How do I do it?
<jmd>Note to wingo: Yes I have read the ****** manual.
<jmd> http://paste.lisp.org/display/315129
<jmd>Is this ^ a bug in Guile or in libgc ?
<jmd>Or in soemthing else?
<rain1>jmd, feel free to try this out http://lists.gnu.org/archive/html/bug-guile-ncurses/2016-04/msg00001.html
<rain1>if you're still having to do work relating to gc stuff
<jmd>If I'm reading those patches correctly they simply remove the freeb
<jmd>free_ handlers
<janneke>b
<jmd>It seems there are rather a lot of bugs in guile-ncurses :(
<wingo>jmd: why would you ask what the function is, if it is documented in the manual? :)
<wingo>your bug looks like some kind of memory corruption, which then fails during gc
<wingo>but it doesn't mean that guile or gc has a bug.
<wingo>because memory management is a cross-cutting concern, probably the problem is elsewhere.
<wingo>some other c code that your program is using, where the c code has a bug in it. if it's guile-ncurses then probably it's there.
<jmd>That is very likely. But I placed a watchpoint on the offending address to see what was mutating it. As you can see, in this case, guile-ncurses does not feature in the stack trace at all. It seems to be just guile and libgc itself which seems if the bug comes from elsewhere.
<jmd>Regarding your question about that function. Although it is mentioned en-passant in the manual, there does not seem to be an entry in the API reference. Or in the index. At least I couldn't find one.
<rain1>wingo: we're dealing with a badly designed library that does effects inside garbage collection handlers
<jmd>In fact the only reference to it I could find is https://www.gnu.org/software/guile/manual/html_node/Threads.html
<df_>jmd: https://www.gnu.org/software/guile/manual/html_node/Continuation-Barriers.html ?
<jmd>It just mentions that scm_spawn_thread is called by this function.
<jmd>df_: Great when you know where to look
<df_>jmd: I used this magic device: https://duckduckgo.com/?q=scm_c_with_continuation_barrier
<wingo>also https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html
<wingo>where is appears as well
<wingo>*it
<jmd>Yeah I used that too. For me it just came up with https://www.gnu.org/software/guile/manual/html_node/Threads.html
<jmd>
<wingo>i think what you meant to say was "yeah, you're right, i should have seen it" :-) anyways....
<wingo>i always use info, C-s in info leads me where i want :)
<jmd>I'm on debian which doesn't have the info for Guile
<jmd>and even if I install it manually, it sadly doesn't put in the topdir links. Once I tried fixing that manually and totally broke my system.
<wingo>ACTION goodwill evaporating :P
<rain1>"The lastest guile tarball uses revoked key" ?
<ft>Debian has a separate package that contains the info manual, like guile-2.0-doc
<jmd>ft: Do they now? I thought they were refusing to distribute them?
<rain1>can anyone confirm?
<rain1>thaht seems scary? :P
<rain1>oh yeah debian... where the GNU free documentation license isn't free enough
<df_> https://packages.debian.org/sid/guile-2.0-doc
<janneke>$ apt-file search guile-2.0.info
<janneke>guile-2.0-doc: /usr/share/info/guile-2.0.info-1.gz
<janneke>
<ft>Yea, I can confirm.
<rain1>thanks!
<jmd>df_: Right. They seem to have it now. Thanks
<ft>It's part of the main repository too.
<rain1>jmd: the idea of that patch I wrote is that it should free one from needing to think about GC semantics
<df_>iirc, GFDL is ok with debian if there aren't invariant sections
<df_>otherwise it goes in the non-free repo
<df_>with the amusing side effect that vrms will complain to you about having gnu documentation installed
<jmd>rain1: I see. Will it not also allow memory leaks?
<rain1>haha
<rain1>jmd: well you do need to explicitly remove things (e.g. using delwin)
<jmd>Anyway the bug I have right now seems to be a different one.
<civodul>Guile's manual no longer has invariant sections and such, so there's no reason for it to be in Debian's "non-free"
<rain1>I'm wondering about the revoked signature though
<rain1>ncurses is 12143 lines of c
<rain1>guile-ncurses is 12540 c + 4784 scheme
<rain1>what...? :D
<jmd>rain1: Right. It's bindings for the curses library.
<rain1>jmd ?
<ft>If the bindings have the same amount of lines of code as the original library, that seems like a bad deal. :)
<wingo>rain1: :)
<df_>are you sure the original library isn't simply copied into the source tree?
<rain1>that's a really good question! it's all new code though
<ft>It doesn't afaics. The ncurses/ directory is full of SCM glue code.
<jjk`>,q
<jjk`>(/quit
<civodul>rain1: isn't the C code somewhat generated?
<rain1>it doesn't look like it
<rain1>I've not checked every file though
<rain1>he does a lot of hard work building of a memory management guardians
<jlicht>is there a clean way, in which to patch using patchelf an executable that is compressed and used as an origin? or should I then just make it a package instead?
<jlicht>because decompressing the archive happens somewhere in the middle of the makefile, so I can't patch it after extracting b/c it is already humming along in the build phase
<jlicht>oops, wrong channel :/ sorry!
<amz3`>here is a small snippet eval'ing code provided by the client with the given arguments on some server http://hypermove.net/notes/snippet-eval-make-me-a-sandwich/
<amz3`>this is code is dangerous, but I don't really know how to really get along without it
<amz3`>btw I fixed the design of my blog :p
<amz3`>What I need is to be able to execute queries against my UAV database
<amz3`>instead of trying to come up with a turing complete query language I simply use scheme
<amz3`>AND I will need to make sure that this databaser server is not accessible from outside of the machine...
<amz3`>the snippet is only about the client/server eval thing
<rain1>ill have a look
<rain1>why does the query language need to be TC?
<amz3`>basically because I am lazy
<rain1>lol
<rain1>:D
<amz3`>I don't want to add procedures to the server database for everything thing I will need
<rain1>maybe you could define a language and recognize it before allowing 'eval'
<rain1>something like <safe-sexp> ::= (car <s>) | (cdr <s>) | ... etc.
<rain1>just a really recursive function to ensure the input is acceptable
<amz3`>I could make it so, but like i said I'm too lazy
<amz3`>it's convenient to be able to execute anything server side :p
<amz3`>...
<amz3`>OT, I did not do any post on the mailling on april, so I guess I will need to make two posts on may!
<rain1>well just put it in a Docker container then
<amz3`>haha
<amz3`>it's a joke? no?
<amz3`>maybe...
<amz3`>maybe i should do that
<amz3`>I could also make sure nothing evil is in the environment passed to eval
<amz3`>but I heared that this is not a proper sandbox
<cojy>i thihink even just "read" is unsafe
<rain1>a true sandbox would be great
<stis>hej guilers!
<rain1>hello!
<amz3`>hej!
<amz3`>simple uav database server: done!
<amz3`>i love this language
<amz3`>here is the documentation of the database: https://framagit.org/a-guile-mind/guile-wiredtiger/blob/master/uav.md#clientserver
<amz3`>(it more and more looking like a real database :D)
<amz3`>(it's only lakes immutable in the name :P)
<wingo>ACTION brain rotted by iconv, utf-blah and BOM codepoints
<amz3`>next step, create the crawler logic...
<jmd>amz3`: An immutable database is called a ROM.
<amz3`>jmd: really? like RAM but it's dead, so it's called ROM? something like that?
<amz3`>what does ROM mean?
<jmd>Something like that, yes.
<amz3`>yeah, I'm thinking about something alon the lines of datomic, not a ROM :p
<amz3`>but right now, I don't have a usecase for an immutable database, and did not give much though either
<amz3`>*If* I was going to build a banking application using Guile, I would go straight to an immutable database, but it's not the case :P
<jmd>If a database is immutable, how can it be of any use? how does one enter data?
<cojy>amz3`: persistent is a better word
<cojy>jmd: it just means things aren't overwritten, they are added on
<jmd>cojy: Older versions of Postgres used to do that. But they removed that feature unfortunately.
<amz3`>hmm
<amz3`>ah!
<amz3`>getting the list of links in a (htmlprag) SXML using (sxml xpath) is quite simple: ((sxpath '(// a @ href)) sxml)
<amz3`>neat!
<wingo>it's neat but i always forget how it works :)
<wingo>ACTION still amused by guile's division of data structures into simple and compound
<wingo>in the manual
<wingo>somehow a character set is a simple data structure, for the purposes of the manual :P
<amz3`>i always forgot how it works too, but this time I got it working quickly :D
<amz3`>sxpath document requires some love :)
<wingo>contributions appreciated :)
<amz3`>:p
<amz3`>yeah, that would be really nice
<rain1>what needs done?
<rain1>just docs?
<wingo>yeah
<wingo>could be you find ways the code could be better
<wingo>dunno
<rain1> https://www.gnu.org/software/guile/manual/html_node/SXML-Overview.html#SXML-Overview :D
<amz3`>It's not an top of my priority list, because I first need to conquer the world... ;)
<amz3`>sxpath doc is a not stepping stop of the priority task, right now...
<amz3`>I'm trying to use another program from my scheme code, which takes as stdin a text file and outputs in stdout the processed file
<rain1>we cannot include verbatim the information here ? http://okmij.org/ftp/Scheme/SXML.html
<amz3`>I'm trying to use `(open-input-output-pipe program)` but the program hangs indefinitly after I `(display "some string" port)`
<rain1>maybe you need to close the port too
<amz3`>s/port/pipe
<rain1>it could be waiting for more
<amz3`>yes, but I need to read from the same pipe
<rain1>ah i don't know
<amz3`>I should somehow tell the subprocess that stdin input is finished...
<amz3`>I tried to do (display (eof-object) pipe) but it doesn't work
<rain1>ooh
<rain1>there are great docs inside xpath.scm
<amz3`>thx for the link rain1
<amz3`>look at the tests too :)
<amz3`>(sxml xpath) it's clearly a powerful framework
<rain1>ACTION having a go at this
<rain1>yeah I loved xpath ever since I learned about it in perl!
<amz3`>good luck :)
<rain1>"a nil nodeset is equivalent to #f in denoting a failure."
<rain1>hmm, not so keen on that!
<rain1>maybe it could be forced to always give #f in a later version
<amz3`>Is it possible to provide stdin and retrieve stdout of program using Guile?
<amz3`>here is a paste of my current attempt http://paste.lisp.org/display/315145
<amz3`>using system* and providing string input and redirecting output to a string doesn't work
<amz3`>I'm trying to wrap html2text
<amz3`>I also take solution that replace html2text in pure scheme :)
<amz3`>got it http://hastebin.com/ucenibiniz.scheme
<amz3`>here is the result: http://hastebin.com/ferayoveno.scheme
<amz3`>it extract "relative"
<amz3`>ark!
<amz3`>it extract links and every word bigger than 3
<amz3`>it lakes an unique thing
<amz3`>I mean words can appear multiple time, same for links
<amz3`>it still requires some love, link appear relative to document and stuff
<wingo>good day mark_weaver
<wingo>i am making progress with ports, it seems i can do the whole iconv thing eventually
<wingo>from scheme
<wingo>it's nice to be able to rely on the presence of a port buffer we control; it can algorithmically improve some things
<wingo>like being able to check EOF once for a four-byte utf-8 sequence instead of 4 times
<wingo>or being able to peek without reading then unreading
<mark_weaver>wingo: sounds good!
<wingo>i wonder if we can remove some of the more exotic port things from c, as if we replace them with scheme at boot-time, we can handle them there; and the relevant set of boot-time source code should all be valid utf-8
<cojy>is there any tools for generating ffi bindings from C headers?
<cojy>i found this for scheme48 http://mumble.net/~campbell/darcs/s48-grovel/scheme/ and i know others like dylan and common lisp have this https://github.com/dylan-lang/melange
<wingo>cojy: that would be great but we don't have that right now; civodul used to have a larceny-like system
<wingo>i have been using luajit's ffi recently and it's pretty great
<wingo>a luajit-like ffi for guile would be great
<wingo>ACTION forgot about (ice-9 iconv); neat
<random-nick>doesn't luajit's ffi involve parsing C declarations?
<wingo>yes
<wingo>well, that's part of it anyway
<random-nick>:/
<random-nick> http://i.imgur.com/5gbFE.png
<random-nick>not really relevant to the conversation
<random-nick>but it's funny
<random-nick>hmm, luajit's FFI doesn't actually parse C headers it seems
<random-nick>that's good
<rain1>how does it work?
<random-nick>rain1: you basically give it C function, struct and type declarations that are required for interacting with the library and then it just allows you to interact with the library
<random-nick>it's really simple
<rain1>i like it
<random-nick>rain1: http://luajit.org/ext_ffi_tutorial.html