IRC channel logs

2016-11-20.log

back to list of logs

<nee`>Hello, I think there might be a bug in xml->sxml. When I try to use it in multiple threads strings from different files get mixed up and the parser throws an error. Here is a minimal example: http://paste.lisp.org/display/331979 I used this xml file: http://paste.lisp.org/display/331980
<nee`>I suspect that it's connected to xml->sxml, because I wrote something similiar with guile-json before and didn't have any problems.
<amz3>héllo all
<amz3>taylan: what do you recommend to use to delcare a callback function inside a scheme bytestructure?
<kristofer>good morning!
<kristofer> http://paste.lisp.org/display/332015
<kristofer>I've been trying to hook into the jack server, but I can't figure out why jack-callback crashes the client
<kristofer>do I need to define-wrapped-pointer-type so the gc doesn't take the procedure-pointer out of memory?
<taylan>amz3: functions can't be serialized into bytes, so that wouldn't work
<taylan>amz3: or did you mean it in a different way?
<wingo>meep
<wingo>i wish someone would write a 'parallel and concurrent programming in guile' book, like http://chimera.labs.oreilly.com/books/1230000000929/pt01.html
<wingo>maybe next year someone will get on that ;)
<wingo>i guess pepole should implement more opinionated parallelism and concurrency libraries before such a book can be written tho
<kristofer>amz3: there is procedure->pointer in (system foreign)
<paroneayea>beep boop
<taylan>amz3: my OS crashed so in case you replied to my latest message I didn't see it
<amz3>taylan: how do you declare a pointer in a struct? I think it depends on the architecture so I'm not sure what to use
<amz3>basically I need (bs:pointer ,void)
<amz3>Here is the struct I want to bind: https://github.com/libgit2/libgit2/blob/master/include/git2/checkout.h#L251
<amz3>I'm wondering what do to for notify_cb and notify_payload
<taylan>amz3: hm, not sure what to use for something that should have pointer size. best I can think of is (bs:pointer (bs:pointer uint8))
<taylan>that will make sure that the bytevector pointed to has at least the size of a pointer
<amz3>ok
<taylan>(the uint8 is just a dummy)
<kristofer>I'm trying to get this procedure->pointer to return a 0. I speculate the 0 in guile is different than an int in c. I've tried a range of things, like (define zero (make-bitvector (sizeof int) #x0)) or just #x0, but the procedure->pointer is always non-zero when the callback is executed
<taylan>kristofer: I don't understand. why should procedure->pointer return 0?
<kristofer>the c function that calls my procedure->pointer expects a 0
<taylan>kristofer: do I understand it correctly that you create a C function by using procedure->pointer, and you want that C function to return the C int value 0?
<kristofer>taylan: yes
<taylan>kristofer: I don't think that would work. since procedure->pointer takes a Scheme procedure, the resulting C function will necessarily return a value of type SCM
<kristofer>procedure->pointer specifies a return type.. am I misunderstanding how that works?
<taylan>oh, maybe I'm wrong
<taylan>ACTION reads
<kristofer>(procedure->pointer int (lambda (x) (+ x 1)) (list int))
<taylan>kristofer: you're right. if the scheme procedure returns the Scheme integer 0, then the C function should return 0 I suppose
<taylan>ACTION forgot that the FFI did stuff like that
<kristofer>that's what I gather from the tests. I'm trying to register a callback with libjack, but my callback is returning non-zero and I can't figure out why
<kristofer>or it hangs because of some latency issue and jack boots my client. I don't know how to tell :-/
<taylan>kristofer: have you tried to figure out what value the original Scheme procedure returns? you may be able to do it easily by using the 'pk' function; just wrap an expression in it to debug-output an intermediate value, like (lambda (x) (pk (* x 2))) is effectively the same as (lambda (x) (* x 2)) but outputs the value before returning it
<mistnim>anybody else running guile from org babel? Right now when there is an error in the code it just tells me so without any explanation. Does that happen to you?
<amz3>mistnim: what is org babel?
<mistnim>amz3, you know orgmode?
<amz3>mistnim: ok
<amz3>kristofer: the callback is called by libjack, and that's libjack that expects 0?
<kristofer>amz3: yes
<kristofer>in particular, the jack_set_process_callback
<kristofer>outside of the jack_set_process_callback, my guile jack client connects to jack, sets up the ports properly, and even activates. the callback is literally (lambda () 0)
<amz3>sorry, I never encountered this issue
<amz3>kristofer: did you try to define the procedure instead of using a anonymous lambda?
<kristofer>ACTION wonders if the pointer->procedure is prematurely gc'd
<kristofer>amz3: yes
<kristofer>I thought that might prevent it from being gc'd
<kristofer>I wrap the callback functions with define-wrapped-pointer-type
<kristofer>I might be using that incorrectly too
<amz3>I think you don't need to wrap it
<amz3>just pass the reuslt of procedure->pointer
<amz3>(disclaimer those are wild guess)
<kristofer> http://paste.lisp.org/display/332053
<kristofer>this is the full code+client: http://paste.lisp.org/display/332015
<amz3>that is the procedure you are trying to bind right? http://www.jackaudio.org/files/docs/html/group__ClientCallbacks.html#gafb5ec9fb4b736606d676c135fb97888b
<kristofer>yes
<amz3>ah ok so unwrap be before submiting it to jack
<amz3>that easy to verify
<amz3>what the C side is receiving
<sirgazil>Hi :)
<kristofer>how?
<amz3>sirgazil:
<amz3>sirgazil: o/
<amz3>kristofer: I will create a small C shared library that prints the output of the callback and see what happens
<kristofer>yeah, I thought using a wrapped pointer might prevent GC, but that assumes that the procedure being GC'd is the problem
<amz3>sirgazil: are you working a web framework? :)
<sirgazil>amz3: well, I call it that, I use it on my website. I'm trying to use the concepts form Django, but for static sites.
<sirgazil>*from
<kristofer>sirgazil: for guile?
<sirgazil>kristofer: yes, it's written with guile, but is not for the general public, I'm not a trained programmer. I model my programs with a machete :)
<sirgazil>they work or they work
<kristofer>sirgazil: have you investigated haunt?
<kristofer>for static sites?
<guile-guest3>hello
<sirgazil>Yes, and I will probably move to it in the future. But currently, the code I have works for me :)
<kristofer>in my guile web adventure I've found both haunt and guix-web to be inspirational
<kristofer>inspirations*
<guile-guest3>I am getting this error while compiling guile 2.0.13 on macOS Sierra
<guile-guest3> CCLD libguile-2.0.la Undefined symbols for architecture x86_64: "_clock_getcpuclockid", referenced from: _scm_init_stime in libguile_2.0_la-stime.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
<guile-guest3>can anyone give me any hints please
<sirgazil>kristofer: sure. They are written by a trained programmer :)
<guile-guest3>i am not too familiar with it
<amz3>guile-guest3: AFAIK nobody use guile on macos
<amz3>sirgazil: don't be modest...
<guile-guest3>i need it to support one of the dependencies of another program ....
<sirgazil>amz3: :)
<sirgazil>I was recently trying the Gamepad API for web browsers, and did an experiment with that and SVG: http://sirgazil.bitbucket.org/static/blog/video/dualshock-knockoff-tester.webm
<sirgazil>And I was wondering what would you use in guile to do something similar.
<amz3>hmmm
<amz3>dunno
<amz3>kristofer: I made a small experiment and procedure->pointer does return an integer
<amz3>kristofer: http://hastebin.com/udaqekoced
<amz3>kristofer: look at the bottom
<amz3>sirgazil: I was experimenting with scheme in the browser :D
<amz3>sirgazil: also the app I am prototyping might interest you
<amz3>sirgazil: it's a palette creator
<amz3>wait I will put it online in a minute
<amz3>Actually the easiest way is to: git clone https://framagit.org/forward/ohmypalette.git && cd ohmypalette && python3 -m http.server
<amz3>wip ^^'
<daviid>is there an option somwhere so that repl evaluation would not print the full results for (long) lists and (very big) vectors?
<wingo>would be nice!
<wingo>you can set the repl-printer somehow
<wingo>ACTION just ran a test that spawned 1e6 fibers that all were trying to write a single message on the same channel, then the main fiber read out 1e6 messages
<daviid>wingo: hey! yes, I have a proble wrt guile-cv, because anything kills emacs! and it is very easy to forget to (define image (im0load ...)) boum!!!!
<ft>Could that also be used to print integers in base 16 or something else?
<wingo>took about 23 seconds, max heap size 433 MB, 4.5 seconds to spawn then the rest to read and do the context switches
<daviid>wingo: the repl-printer? you mean write my own?
<wingo>i'm pretty satisfied with that for now, until we do native compilation anyway
<daviid>* im-load
<wingo>daviid: yes you could use truncated-print or whatever that thing is
<wingo>search the manual for truncate
<daviid>wingo: right, thanks!
<wingo>:)
<wingo>clearly indicates both that having 1e6 threads running concurrently is fine from a memory POV, and that the fibers channel mechanism isn't terrible, even with the concurrent ml overhead
<wingo>compares OK to haskell's thing; around 5x or 10x slower but i don't know how much of that is related to bytecode vs native code
<wingo>similar memory overhead
<wingo>and no need to tune per-thread stack sizes
<daviid>I can't find repl-printer in the source, where is that defined?
<daviid>pfut! repl-print in (system repl common) I guess