IRC channel logs


back to list of logs

<sapientech>hi all, really interested about this question: i have a macro that creates add a bunch of new definitions to the local environment,
<sapientech>i was wondering if i could call this macro in the procedure, and return the local environment, and be able to use that environment in the outer environment
<sapientech>i was able, of course to return specific procdedures that were created from the macro, but i would like to return them all!
<sapientech>and particularly, it would be nice for them to be wrapped in their own environment
<sapientech>ive been looking in the guile manual, particularly in a section on environments, which states that there are three procs that return envs: null-env, interactive-env, and a module-type env.
<sapientech>is interactive-env what im looking for? it didn't seem to be quite what im looking for
<sapientech>additionally, it reference the on-the-fly-evalutation section, but it was fairly sparce
<amz3`>still 8 628 349 items to donwload from HN and it will be done
<amz3`>out of 12 M
<rekado_>I'm missing match support for bytevectors
<rekado_>would be very nice to be able to use something like string-match on a bytevector without having to convert it first.
<davexunit>rekado_: I don't think that would be good. a bytevector is an arbitrary sequence of bytes.
<davexunit>it may not be a string at all
<davexunit>and if it was, who knows what encoding it is in
<davexunit>what's the issue with using utf8->string first?
<dsmith-work>Morning Greetings, Guilers
<artyom-poptsov>Hello, dsmith-work
<OrangeShark>hey amz3 have you been looking at those hacker news post on web crawling?
<rekado_>davexunit: I actually meant matching byte sequences in a bytevector.
<rekado_>I just wrote this because it allows me to parse a POST request payload without having to convert it to a string first.
<rekado_>the POST payload of a file upload is not guaranteed to be a string, so it has to be split up first so that its different parts can be processed separately.
<rekado_>my final problem is about writing a bytevector to a file.
<rekado_>"display" won't work because it prints the representation of the bytevector, so I think I need to use "format", but what is the right invocation to print the contents of a bytevector?
***heroux_ is now known as heroux
<rekado_>ah, "uniform-vector-write" is what I was looking for.
<davexunit>rekado_: specifically, 'put-bytevector' writes a bytevector to a port
<lloda>that was deprecated ages ago, shouldn't be in the manual. (I sent a patch to remove it). Use put-bytevector instead
<lloda>^ what davexunit said
<rekado_>okay, thanks
***DeeEff_ is now known as DeeEff
***karswell` is now known as karswell
<rekado_>The naive multipart payload parser that I just wrote is way too slow :(
<rekado_>when a request payload arrives at the Guile web server is it completely loaded into memory or is it streamed from the web browser?
<rekado_>I assumed that Guile would automatically load chunks of the payload into a buffer and then reading individual bytes would be almost as fast as reading bigger bytevectors.
<davexunit>reading byte by byte is going to be slow
<davexunit>you should read several bytes at a time
<rekado_>can I let Guile handle this for me somehow with setvbuf?
<davexunit>guix uses that
<davexunit>I don't know how it works, though
<rekado_>ERROR: In procedure setvbuf: Wrong type argument in position 1 (expecting port that supports 'setvbuf'): #<input: r6rs-bytevector-input-port 5578a7ed4820>
<rekado_>too bad :(
<davexunit>are you reading from a bytevector?
<rekado_>the grafts code in Guix reads 1MB chunks at once and then scans through them with a loop.
<rekado_>I hoped I could avoid this explicit looping
<davexunit>okay, the web server docs say that the body of a request is a string or bytevector
<davexunit>so the whole body is read into memory
<rekado_>hmm, but shouldn't it be fast then to move around byte for byte (moving around a pointer)?
<davexunit>rekado_: try using the profiler and see where you are spending most of your time
<davexunit>see section 7.19
<davexunit>statprof will take some of the guessing out of this
<rekado_>davexunit: thanks for the hint on statprof! I didn't find it when looking up "profiling" in the index.
<davexunit>yeah, it should be easier to find in the manual
<rekado_>statprof confirms that it's all those get-u8 and put-u8.
<davexunit>get-u8 reads from a port
<davexunit>I thought you had a bytevector?
<rekado_>yes, I use a port on a bytevector
<davexunit>just use u8vector-ref or whatever
<davexunit>that will be faster for sure
<rekado_> (open-bytevector-input-port payload)
<rekado_>yeah, will do that.
<davexunit>no port abstraction
<davexunit>guile 2.2 will probably unbox a lot of that stuff for you, too
<davexunit>not sure if you're using 2.1 or 2.0
<rekado_>2.0, actually, but I can switch later.
<rekado_>I really like the port abstraction.
<rekado_>makes things easier to think about.
<rekado_>ACTION goes afk
<davexunit>rekado_: I think it would be cool if the message body could be read in directly from the socket, rather than having to be read in as a bytevector first
<amz3`>rekado_: is your code somewhere so that I can have look at it?
<amz3`>8M items to go
<amz3`>by the way, my program that fetch all HN items is leaking
<amz3`>leaking memory that is
<amz3`>it leaks less than 100MB *per day* but it leaks
<amz3`>here is the source code if someone wants to have a look
<amz3`>paroneayea: you use gdbm in pubstrate?
<paroneayea>amz3`: for now, as a quick prototype. I have a generic methods using interface so I can plug in something else as a store
<paroneayea>there's also an in-memory-only store
<amz3`>paroneayea: you can have several backends?
<paroneayea>amz3`: for now, you can write a new backend, though the application only runs with one at a time
<paroneayea>it's partly because the store is not the most important part for now, and I'm hedging my bets on the solution
<paroneayea>that'll change of course as it becomes not just a "demo"
<amz3`>do you consider wireditger?
<paroneayea>amz3`: I plan to look at it
<amz3`>cool :)
<amz3`>paroneayea: there is a tutorial where I use wiredtiger like a RDBMS
<amz3`>it's good feet
<amz3`>it's not because I *try* to do fancy things with wiredtiger, that it can't handle tabular data...
<paroneayea>amz3`: neat
<amz3`>you can see my ascii-art skills in that article ;)
<amz3`>be warned that I'm bored tonight
<amz3`>basically my article describe a database for a multitenant blog engine
<amz3`>which looks like a microblog app
<amz3`>the thing is that I understand that in Activity Stream there's several kinds of objects in "streams", here it only handle posts
<amz3`>ah! I found a bug in a backtrace x)
<amz3`>I mean the backtrace algorithm
<amz3`>I reuse variable names, and the backtrace wrongfully follow the variable name origin and sets the error on the first occurence of it in the proc
<amz3`>the thing is that I erase the variable content inside the proc, so it can not be the original value that is failing
<amz3`>here is a snippet
<amz3`>the error happens on 'start' variable
<amz3`>the error I get from guile is: ome/amirouche/src/guile/culturia/src/conceptnet.scm:79:19: In procedure add-entry:
<amz3`>/home/amirouche/src/guile/culturia/src/conceptnet.scm:79:19: In procedure struct_vtable: Wrong type argument in position 1 (expecting struct): #t
<amz3`>the actual error happens on the `edge-add!' call
<amz3`>so at this point in the procedure, `start' variable value comes from the 'let' not the `start' variable passed to the proc
<amz3`>I'll make a proper snippet if I can
<amz3`>the error is different from what I was thinking
<amz3`>basically, the error is said to happen at the correct location
<amz3`>but the snippet in the backtrace says something else
<amz3`>here is an exemple
<tfm>What is the correct way to read a global variable from one of my .c files? I think I need to call dynamic-link, but I'm not sure which argument to give it to get to my C file. Would it be a case of calling it without arguments and I can only access the variable in question while the program runs?
<tfm>tl;dr Would (define foo (dynamic-pointer "FOO" (dynamic-link))) be enough to get to a global FOO defined in bar.c, or does dynamic link need an argument?
<amz3`>tfm: it needs an argument
<amz3`>dynamic-link without argument is for linking with stdlib
<tfm>What would the argument be to link it to an object file? A relative path to bar.o?
<amz3`>it requires a shard object like not a object file
<tfm>I'll need to look into how .so files work then. Thank you.
<mark_weaver>tfm: 'dynamic-link' without an argument should work to access symbols that are already linked with the current-running executable, iirc.
<mark_weaver>see sction (Foreign Variables) in the guile manual for info on how to access C variables
<zv>is there any way to get expected/actual without test-{eq,equal,eqv}?
<zv>i looked at the macro definitions in srfi-61 and it was pretty hairy
<zv>err, srfi-64?