IRC channel logs

2015-10-25.log

back to list of logs

<daviid>davexunit: can I grab your attention for a few minutes? stexi related quiz
<davexunit>daviid: not sure if I can answer but go ahead.
<davexunit>I'm *very* new to working with stexi
<daviid>in the following file http://git.savannah.gnu.org/cgit/guile-lib.git/tree/doc/guile-library.scm given the definition of *texinfo-epilogue* [line 29], and more specifically the line 34 "(menu ...) generates a guile-library.texi which has a 'bug' [makeinfo triggers a warning], because it does not start a new line before to write @menu here is an extract of the generated guile-library.texi http://paste.lisp.org/+3DGE [see line 4 of
<daviid>extract, line 1998 in the original, but it does not matter]
<daviid>i wonder where to look to debug? because all other occurences of @menu start on a new line, just that 1 fails
<daviid>note that the guile-lib doc is generated using the texinfo modules of guile-lib itself
<daviid> http://git.savannah.gnu.org/cgit/guile-lib.git/tree/src/texinfo
<daviid>davexunit: i'm totally blind wrt texinfo generation too
<davexunit>daviid: look at the implementation of stexi->texi perhaps?
<daviid>ok
<davexunit>I've been doing things the other way
<davexunit>texi->stexi->shtml
<daviid>ah i see
<davexunit>gotta go afk.
<daviid>tx
<davexunit>yw
<rlb>If a module foo contains various generics, but bar is a plain define, can something like (use-module ((foo) #:select (bar))) cause any generic-related conversions in the current namespace?
<daviid>rlb: no
<rlb>excellent - thanks
<daviid>np!
<rlb>Say I have something like (define (atom-add-watch atom ...) ...). Is (define-method (add-watch (ref <atom>)) (atom-add-watch ref ...)) the most appropriate/efficient way to attach atom-add-watch to the add-watch generic function, after the fact?
<daviid>rlb: yes
<daviid>actually what do you mean by " after the fact?"
<rlb>When you already have a non-generic version of something you want to add to a generic.
<daviid>ok, you don't add a non generic to a generic, you add a method, which creates the generic if does not exists, and the core of the method uses your procedure/function ...
<rlb>Right
<daviid>ok then yes
<rlb>I'm just being sloppy.
<daviid>rlb: it's ok, just wanted to make sure we talk the same 'lang' here :)
<rlb>If it helps/matters, I'm exploring the possibility of providing very schemish versions of some of the "interesting" clojure bits, for people who don't want (perhaps either semantically or performance-wise) to use a really clojureish api, and then building a very clojurish api (in support of a clojure dialect) on top of that.
<rlb>So you'd have atom-add-watch and agent-add-watch for the clojure/generic-averse, and then build (add-watch ref) for the clojure-inclined.
<rlb>And you'd indicate which you wanted via the module you use, i.e. (foo atom) or (foo scm atom). Note - all just speculative at this point.
<rlb>Well, the interface distinction is speculative - I have working code for a good bit of functionality now...
<rlb>bbl
<daviid>rlb: cool!
<davexunit>tries out distributed computing with guile-ssh
<davexunit>this is *awesome*
<davexunit>I wonder how I can implement something like scp with this
<amirouche>héllo :)
***amirouche is now known as amz3
<unclejamil>hi guys. Anyone have any advice on the best way to connect to MS sql server from guile on a windows platform? I'm currently using cygwin with freetds/iodbc to connect...
<unclejamil>I was hoping to find something like guile-odbc with some poking around on the net but no such luck.
<davexunit>artyom-poptsov: hey! do you know how I would go about using guile-ssh to connect a remote daemon via a UNIX domain socket?
<davexunit>I'd like to open a connection to a remote Guix store and do some cool stuff, like copying a full system closure and instantiating it.
<jockej>are guile vectors NULL-terminated in C?
<davexunit>jockej: vectors are a scheme object.
<davexunit>so, no.
<jockej>hm, ok. So if I have an array of SCM in C, how can I make a list of them?
<jockej>I was hoping I'd be able to use scm_vector_to_list
<davexunit>I don't know if there's a pre-built function for this purpose.
<davexunit>seems like you should be using another structure
<jockej>yeah, I know, but it's using a lot of Emacs macros :)
<jockej>so I don't really wanna change them
<davexunit>Emacs?
<jockej>yeah, in GuileEmacs
<davexunit>oh
<davexunit>well to build a list, you can iterate over the array and make cons cells.
<davexunit>starting from the last element of the array and moving backwards.
<jockej>yes, that seems like the best thing to do I guess
<jockej>the opposite is done in the macro :)
<jockej>but I guess I shouldn't be concerned with efficiency at this point :)
***mario-go` is now known as mario-goulart
<artyom-poptsov>davexunit: Hi! I'll check if there's a way to do it in scheme, but the first workaround that comes to mind is that you could forward connections to 127.0.0.1:<some-port> to a Unix socket.
<artyom-poptsov>AFAIK OpenSSH since version 6.7 is capable of forwarding Unix sockets.
<davexunit>artyom-poptsov: yes, I discovered that, thanks.
<davexunit>I guess I still don't really know how to do what I want to do with guix, though. :)
<davexunit>I want to connect to the daemon, but I also want to run some scheme code that doesn't involve talking to the daemon.
<davexunit>so, I could connect to a remote repl, and then connect to the daemon.
<artyom-poptsov>Hmm, and probably you could send a piece of scheme code to a RREPL that will do the Unix socket forwarding part.
<artyom-poptsov>It's possible to make many channels in one session, so you can talk to a RREPL and use tunnels at the same time.
<davexunit>yeah, something like that might work
<davexunit>basically, I need to pipe a "nix archive" from the client machine, through the tunnel, to the guix daemon
<davexunit>and then I need to run some scheme code to actually do something with that archive.
<davexunit>in this case, it will be a GuixSD system archive, which then needs to be instanatiated as the current system
<davexunit>your (ssh dist) module will make for a really great platform to build off of once I figure out how to make the tunnels I need.
<davexunit>but I
<davexunit>but I've gotta head out now. thanks for your help and guile-ssh! it's a lot of fun to play with.
<amz3>the elders said: do not use unstable software
<amz3>ACTION did not listen...
<amz3>and now I'm looking for the git revision that works
<rlb>amz3: git bisect to the rescue?
<amz3>ah yes thanks for the tips
<rlb>is test-group known to be broken? (test-group "foo" (test-equal 1 1))
<rlb>here it fails.
<rlb>scheme@(guile-user)> (use-modules (srfi srfi-64)) (test-group "foo" (test-equal 1 1))
<rlb><unnamed port>:1:2: In procedure #<procedure 258ee60 at <current input>:1:2 ()>:
<rlb><unnamed port>:1:2: In procedure struct_vtable: Wrong type argument in position 1 (expecting struct): #f
<rlb>
<rlb>It's not critical since I might want to use test-begin/end anyway, but just wondered.
<rlb>(if I was doing it wrong)
<amz3>I don't use srfi-64
<amz3>I find it non optimal
<amz3>like too much code
<rlb>Unless I just haven't found the right switches, it definitely doesn't seem ideal, but it's "there" ;>
<rlb>And I figured it might be at least somewhat portable.
<amz3>maybe i should retry to adopt it
<rlb>amz3: well don't assume that on my account - I know very little about the testing situation in the scheme world.
<amz3>the other thing I have against it, is that it outputs the error in a file
<rlb>yeah, I did this for now (set! test-log-to-file #f), but that's not ideal either, since it seems to just hide the output altogether.
<rlb>I want it to the console by default
<rlb>(or via flag - plan to see if I can adjust that somehow)
<amz3>I put the tests in the same file as the code, to make easier to copy/paste the file
<amz3> https://github.com/amirouche/Culturia/blob/master/culturia/wiredtigerz.scm#L390
<amz3>the test is a single macro, that does what it should do
<amz3> https://github.com/amirouche/Culturia/blob/master/culturia/tools.scm#L32
<amz3>it's simplistic, but so far no caveat
<rlb>interesting. I'll take a look. Also might see if it might be possible/reasonable to just "improve" guile's srfi-64 handling.
<rlb>But not today's problem.
<amz3>ACTION afk for while
<daviid>rlb: there is unit-test in guile-lib, used by guile-lib, guile-gnome, guile-clutter [which means quitre a lot of examples on how to use it and get it integrated with the autotool chain ...] note that i don't know yest this part, just mentionning as an alternative, maybe ...
<rlb>daviid: ok, thanks - I may stick with srfi-64 for now, since I'm not sure whether or not my tests might eventually have broader use.
<rlb>i.e. not sure if the work I'm doing is going to end up being really guile specific, or there might be bits that are useful more broadly, scheme-wise.
<rlb>so far it's a mix
<daviid>ok, but in case: http://git.savannah.gnu.org/cgit/guile-lib.git/tree/src/unit-test.scm
<daviid>and using goops makes it non portable...
<rlb>right, and thanks.
<artyom-poptsov>rlb: Speaking of test frameworks, there's also Greg: https://www.gnu.org/software/greg/
<rlb>i.e. this is just a (trivial) scheme test for "doto":
<rlb>(test-begin "doto")
<rlb>(test-equal 1 (doto 1))
<rlb>(test-equal + (doto + ()))
<rlb>(test-equal 1 (doto 1 (identity)))
<rlb>(test-equal 1 (doto 1 identity))
<rlb>(test-equal 1 (doto 1 + - / *))
<rlb>(test-equal #(3)
<rlb> (let* ((inc! (lambda (x)
<rlb> (vector-set! x 0 (+ 1 (vector-ref x 0))))))
<rlb> (doto (vector 0) inc! inc! (inc!))))
<rlb>(test-end "doto")
<rlb>
<rlb>Arguably not the most interesting clojure feature (more useful when having to deal with java object messes).
<rlb> http://clojuredocs.org/clojure.core/doto
<rlb>artyom-poptsov: thanks
<artyom-poptsov>Though I'm using SRFI-64 ;-)
<rlb>At a minimum, I'd like to be able to choose the log file dir for srfi-64, and/or mirror the output (perhaps only for failed tests) to the console.
<rlb>I think...
<artyom-poptsov>rlb: You can get the srfi-64 log port like the follows: (test-runner-aux-value (test-runner-current))
<artyom-poptsov>I suppose you can change the port by setting that "aux value" (but I didn't tried it.)
<rlb>OK, I'll probably poke at it later.
<rlb>Interesting. This causes a similar struct error to the one you see with test-group:
<rlb>(test-runner-aux-value! (test-runner-current) (current-output-port))
<rlb>
<rlb>backtrace is kinda useless, though.
<rlb>Ahh, think it's because there's no test-runner outside a test-begin/end. So that's not going to be the way to set a global default log.
<artyom-poptsov>rlb: My guess is that 'test-group' should be used inside 'test-begin'/'test-end' block as well.
<artyom-poptsov>And this is the reason why it fails with the similar error.
<rlb>artyom-poptsov: hmm, maybe not - I think the srfi defines the behavior of test-group in terms of begin/end.
<rlb> http://srfi.schemers.org/srfi-64/srfi-64.html
<artyom-poptsov>Sure, I may be wrong. Let me check.
<artyom-poptsov>Yeah, you're right.
<artyom-poptsov>You could implement a macro upon 'test-group' that will set the log port that you need and then execute a test body, and use the macro.
<artyom-poptsov>Despite that it's not a complete solution, I suppose it will work.
<rlb>right
<artyom-poptsov>FWIW, an example: https://github.com/artyom-poptsov/guile-ssh/blob/master/tests/client-server.scm#L66
<rlb>Is there something like match-lambda that supports recursion?
<daviid>rlb: here is an example, maybe? http://git.savannah.gnu.org/cgit/grip.git/tree/grip/path.scm?h=devel [see remove-dot-segments, line 66 and below]
<rlb>ahh, ok, right - thanks
<daviid>you thank mark_weaver actually :) [see ;;; Commentary:]
<wingo>ahoy :)
<sneek>wingo, you have 1 message.
<sneek>wingo, ArneBab_ says: this could be useful for optimizing Guile: http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/37631.pdf (improving the speed of neural networks on CPUs, from Google research)
<wingo>ACTION wants to make a guile 2.2 prerelease
<wingo>master distchecks fine now
<wingo>takes about 45 minutes i think on -jN on a recentish machine where N>=4
<wingo>we could dist the bootstrap .go files i guess if we were really concerned about build times...
<rlb>ACTION has no opinion there - debs are built from source now
<rlb>(i.e. from git tag)
<wingo>interesting
<rlb>I've done that for emacs and guile for a while now (via git-dpm)
<rlb>Soooo much easier to deal with.
<wingo>ACTION has a new laptop, getting email running on it now so that i can be a proper guile citizen
<rlb>heh - yeah, depending on how you do it, that can be a bit of work.
<rlb>The reason I'd wanted recursive match-lambda was for something like this, under the assumption that any automatic documentation would be better, given the explicit argument names:
<rlb>(define range
<rlb> (match-lambda
<rlb> (() (range 0 +inf.0 1))
<rlb> ((start) (range start +inf.0 1))
<rlb> ((start end) (range start end 1))
<rlb> ((start end step) ...)))
<rlb>
<rlb>I can do it without match-lambda, of course, but it won't be as clear.
<wingo>are you saying that doesn't work or that you would like something else to work?
<rlb>wingo recursion doesn't seem to work with match-lambda, but I might just be doing something wrong.
<rlb>clojure would define it like this
<rlb>(defn range
<rlb> "Some docs about start end step here"
<rlb> ([] ...)
<wingo>i think what you want is match-lambda*
<rlb> ([start] ...)
<rlb> ([start end] ...)
<rlb> ([start end step] ...))
<wingo>ah you are missing docs, ok.
<rlb>hmm, I thought I tried that
<rlb>docs are secondary, it was just crashing.
<wingo>iirc match-lambda matches against its single argument
<wingo>match-lambda* matches against its arguments
<wingo>i always have to look at the source tho
<wingo>in this case lambda* is much better of course :)
<wingo>(define* (match #:optional (start 0) (end +inf.0) (step 1)) "docs here" body ...)
<rlb>wingo: and I've been mostly away from scheme for a while, so don't assume I know what's reasonable these days.
<rlb>for example, that ;>
<wingo>:)
<wingo>it is good too because the compiler knows about it, can generate good code for it, and also good warnings when you call it
<rlb>that sounds terrible
<wingo>i.e. too many args, too few args, etc
<wingo>works with keywords too
<wingo>what sounds terrible?
<rlb>ACTION was joking
<wingo>heh :)
<rlb>(working on the (lazy) sequence abstraction atm)
<rlb>lambda*'s guile specific?
<rlb>(not that that's critical atm)
<atgnag>How can I make ssl/tls requests? web client doesn't seem to support it.
<rlb>What's the preferred way to handle generics and multiple modules? Say module foo and bar both define-method frob. I'd like to have them both export it, so that anyone using either will see it, but the compiler complains. I know I could have a parent module with a define-generic for frob, but I'd prefer not to require people to use two modules instead of one.
<rlb>s/not to/not/
<rlb>if possible
<wingo>rlb: yeah it's guile-specific
<wingo>rlb: re: generics and modules, either you arrange it so both modules define methods on a single generic, or you use the merge-generics thing
<wingo>search the manual for merge-generics
<wingo>it results in a composite object in the module that imports both
<wingo>but it's something the importing module has to decide
<atgnag>I really hope I don't need to make libcurl bindings just to work with ssl…
<rlb>ok, I'd wanted people to just be able to (use-modules (... seq)) and (use-modules (... vector)) independently, but I suppose it's not too big a burden to tell them they have to add a merge-generics.
<wingo>atgnag: use gnutls, it has bindings
<wingo>see guix for an example of how to do https
<wingo>we should document this better
<rlb>For now I just worked around it in my own module via #:select, since I didn't really need to see both.
<rlb>(see either, actually)
<atgnag>There's no example of how to use gnutls with web client, though.
<atgnag>If that's even possible.
<wingo>atgnag: https://github.com/aconchillo/guile-oauth/blob/master/oauth/oauth1/utils.scm#L112
<rlb>wingo: perhaps merge-generics is better than the single generic approach since I'm not sure I want people to have to know that "if you use X, you also have to remember to use Y, and..."
<atgnag>Hmm, I really don't think it should have to be this hacky, but I guess that will work.
<rlb>hmm, or is it fine if foo and bar both use the module providing the shared generic and then both export that generic. Wonder if that still causes a conflict. Perhaps it does, since I think that's indirectly what I was already doing.
<rlb>ACTION will test
<atgnag>wingo: I get unbound variables when trying to ues that function.
<wingo>atgnag: dunno yo, did you (use-modules (gnutls) (web client) (web uri)) ?
<wingo>also ice-9 receive
<atgnag>No, I didn't. That's probably why.
<atgnag>What's ice-9?
<atgnag>Well, that didn't fix it.
<Feuerbach>is there a way to declare pretty-print from https://www.gnu.org/software/guile/manual/html_node/Pretty-Printing.html as the "default printer"?
<wingo>Feuerbach: at the repl you mean? no but that is a good idea
<Feuerbach>yes, at the repl
<ArneBab_>wingo: great to see you here again!
<Feuerbach>how can I run a script without guile being chatty? (it prints several lines starting with ;;; )
<ArneBab_>Feuerbach: be evil: ./script 2>/dev/null
<ArneBab_>kills all error output, too, thought
<Feuerbach>is there really no way to disable that?
<ArneBab_>Feuerbach: multiple people asked here (me included), and I have yet to find a way
<ArneBab_>Feuerbach: if you use the shell-indirection method for scripts, that can be made the default pretty easily, though
<ArneBab_> http://draketo.de/proj/py2guile/#sec-2-2-3-2
<ArneBab_>essentially make it a bash script and exec guile: exec guile -e main -s "$0" "$@" 2>/dev/null
<ArneBab_>follow after that on the next line with !#: That closes the multiline comment which is started by the hashbang (#!)
<atgnag>So, is there a minimal working example of a https-get function?