IRC channel logs

2016-02-15.log

back to list of logs

<mark_weaver>Korhonen: I guess you're right that it would be nicer is 'compose' accepted zero arguments and returned 'values' in that case.
<mark_weaver>*nicer if
<Korhonen>mark_weaver, so any plans of changing it?
<lloda``>Korhonen: I don't see the logic why (compose) should return 'values'. Can you explain?
***lloda`` is now known as lloda
<taylan>lloda: 'values' is an identity function
<taylan>and I guess the identity function is the identity element of the compose operation, like 0 is to + and 1 is to *
<taylan>indeed our (+) returns 0 and (*) returns 1. fun.
<taylan>in fact values is the identity function over the domain of multiple values (maybe abusing terminology here), and apparently 'compose' can compose functions that take/return multiple values.
<taylan>Korhonen: BTW you can always send a patch to guile-devel :)
<lloda>taylan: I see, that makes sense
<amz`>the potluck is tomorrow?
<Korhonen>taylan, well, adding a base case for that to return values seems like a very trivial change.
<Korhonen>One assumes that patching the diff takes more time than just writing it.
<taylan>Korhonen: git makes these things very easy. after you make a commit on top of the stable-2.0 branch, you can just run 'git format-patch -1' and it will put a .patch file into the working directory. you can then attach that to a guile-devel email, and it's similarly easy for the maintainers to apply the patch/commit from the mail and push it upstream.
<Korhonen>Somehow I feel collective effort would be spared by just editng the source manually for them since it's really just adding a case of one line.
<Jookia>Apologies for REALLY newb question, the manual is hard to search through on a slow machine- How do I get the nth element of a list?
<taylan>Jookia: (list-ref lst n)
<Jookia>Thanks so much!
<taylan>Scheme tends to be highly consistent with its procedure names. list-ref, vector-ref, hash-table-ref, bytevector-ref ...
<taylan>np :)
<Jookia>I'm really new to Lisp and most my experience is in Guix development
<taylan>feel free to ask whatever. there's also the #scheme channel, though it's not much more active than here.
<Jookia>Perhaps my biggest question is how to handle digging through code? Is there a way to figure out what the type of something is?
<taylan>hmm, not in general
<Jookia>I often find myself hitting runtime type errors, does everyone get this?
<Korhonen>taylan, well, except that sometimes for lists the list- prefix is there, and other times it is not
<Korhonen>map, vector-map
<taylan>indeed
<taylan>Jookia: hmm, can't say it tends to be an issue for me
<taylan>well, once while working on a piece of Emacs Lisp, I found it terrible how buffers are sometimes referred to by name (string), and sometimes you have a reference to the buffer object itself... it was a pathological case I'd say.
<alezost>mark_weaver: thanks for the pointer!
<sneek>alezost, you have 1 message.
<sneek>alezost, mark_weaver says: we have a 'which' procedure in (guix build utils), which is available by default in our build-side code, e.g. from within phases of packages
<alezost>I mean this ^^^
<nalaginrut>ACTION has done a cripple GTP lib for potluck, maybe we can play Go game with Guile someday
<Jookia>(Why did I quit #guile?) Anyways, for representing key-value data what are the idiomatic ways? Records, key-value, ...?
<ArneBab_>Jookia: hash-maps, alists, vhashes
<ArneBab_>(to add)
<ArneBab_>I’m not yet as versed in that as I’d like to be, though
<Jookia>I see, I found the appropriate section in the manual after tweaking my searx
<mark_weaver>Jookia: alists or property lists
<mark_weaver>avoid hash-maps and vhashes in guix
<Jookia>why's that?
<mark_weaver>hash tables are not well suited to purely functional programming, and in fact tend to force the code around it to be imperative in nature.
<mark_weaver>vhashes might be reasonable to use in some code within guix
<mark_weaver>but probably not in package recipes, and they are probably not suitable for passing data from the client side to the build side because of serializability issues
<Jookia>Ah, I see
<Jookia>"> (define (t) '(("host" . "127.0.0.1") ("port" . 8118))) > (assq "host" (t)) $4 = #f" but without it being defined it works
<mark_weaver>Jookia: use 'assoc' instead of 'assq'. but there's also 'assoc-ref' which is more convenient and what we usually use in guix code.
<mark_weaver>I have to go afk
<stis>tja guilers!
<Jookia>tja?
<stis>Jookia: swedish slang for hey
<Jookia>awesome
<eiro>anyone know how to avoid the start message of the guile repl ? it's boring when you use --listen and nc
<mkeeter>Is there any way to get a list of a module's exports?
<ArneBab_>mkeeter: basics: http://draketo.de/proj/py2guile/#sec-2-2-3-2-2
<ArneBab_>mkeeter: example: (use-modules (system vm program)) (module-map (lambda (x y) x) (module-public-interface (resolve-module '(ice-9 popen))))
<mkeeter>@ArneBab_ thanks. I don't see module-map anywhere in https://www.gnu.org/software/guile/manual/html_node/Modules.html– is it just an undocumented secret?
<ArneBab_>I’m not sure — I learned about it by asking and my info does not find it.
<ArneBab_>It’s not really undocumented, though (at least for pretty loose definitions of being documented), since it’s in py2guile.
<ArneBab_>(I need to go to bed, though — happy hacking!)
<mkeeter>Alright, I'll that to my list of standard places to check
<mkeeter>Thanks for the help
<Korhonen>mkeeter, so tell me, where do you stand on this issue, should a variadic compose functin when given zero arguments return the identity function or should it be an error?
<mkeeter>Interesting question. I'd say the identity function, to match (+) and (*) which give 0 and 1 respectively.
<Korhonen>mkeeter, I concur, a lot of schemes do that, just let it return values in fact since that is the identity function of variadic multiple-value return, but Guile doesn't which surprised me.
<Korhonen>Interestingly, the standard doesn't mandate expt to be variadic
<Korhonen>I guess the thing is that values is both the left and right identity of composition and there is no such value for exponents
<Jookia>Say I want to run getenv, regex then, match - these functions may return a #f. is there a way to chain them while also uisng their return values?
<mkeeter>Monads? :P
<Korhonen>With short circuit?
<mark_weaver>Jookia: you can use 'and-let*' from SRFI-2
<Jookia>mkeeter: Is there a maybe monad? Korhonen: Oh? mark_weaver: Interesting
<Korhonen>I find option values to be more elegant I must say than how Scheme does it.
<Korhonen>filter-map in particular, what if you genuinely want to return #f.
<mark_weaver>*nod*
<Korhonen>Well, I suppose concatmap is the truly general solution anyway.
<Jookia>Does Guile support HTTP CONNECT tunneling?