IRC channel logs

2018-04-30.log

back to list of logs

<dadinn>hi all
<dadinn>i am quite new to guile, would need some help.
<dadinn>how can I create an imperative code block? I see that function bodies implicitly work like that, but for now what I am doing is (let () (dothis) (dothat) (andthat))
<dadinn>I suppose this is not how it should be
<ngz>(begin (dothis) (dothat) (andthat))
<OrangeShark>dadinn: ^ begin
<dadinn>OrangeShark: cool, thx!
<OrangeShark>dadinn: ngz was the one who responded first, you should thank them :)
<OrangeShark>it returns the last expression just like lambdas and let
<dadinn>ngz: thanks!
<dadinn>also another one I can't find, how to apply a function to a list, using the list as varargs
<dadinn>I was looking for something like `apply`
<dadinn>e.g. (apply add (list 1 2 3 4 5))
<ngz>This should work.
<ngz>(apply + (list 1 2 3 4 5)) => 15
<dadinn>ah, ok... couldn't find it in the docs by googling, so wasn't sure :)
<dadinn>i ran into an issue with getopts-long, using a predicate to validate the option value. The docs say it should be a procedure taking a single argument, yet I get the error saying:
<dadinn>ERROR: Wrong type to apply: (lambda (v) (not (file-exists? keyfile)))
<dadinn>ERROR: Wrong type to apply: (lambda (v) (not (file-exists? v)))
<dadinn>the docs say something about quasiquoting, but I am not sure what it means
<dadinn> https://www.gnu.org/software/guile/manual/html_node/getopt_002dlong-Reference.html
<dadinn>"you may need to use quasiquotes to get it into grammar"
***fibratio` is now known as fibration
<amz3>héllo guilers
***chrislck1 is now known as chrislck
<OrangeShark>hello amz3
<davexunit>amz3: I'm not sure. I wrote that before fibers was a thing, but perhaps it uses a Guile IO function that is written in C and therefore cannot be suspended.
<amz3>tx for the feedback, I will seriously give it some more time
<amz3>btw, I am wondering how to run a parser combinator over a scheme port, any ideas?
<davexunit>there's no good way to do it because you need to be able to backtrack
<davexunit>so you need some abstraction in front of the port that lets you do it
<davexunit>IIRC I used streams, but I know it's inefficient, so making something custom with performance in mind would be the way to go, I think.
<davexunit>for guile-syntax-highlight I took a different approach: just use strings.
<davexunit>read the entire source file, then parse it
<amz3>I was thinking about that in the context of websocket, I did not read the specification yet. Are messages prefixed with length or something like that in order to be able to load the whole message in memory and simply use vanilla parser combinators?
<davexunit>what are "vanilla parser combinators"?
<davexunit>my websocket abstraction handles reading all the messages. from the user's perspective they get one of two things: a string or a bytevector, depending upon what type of websocket message was sent (text or binary)
<amz3>vanilla, like your guile-parser-combinators, that doesn't support port per IIRC
***gour_ is now known as gour
<gour>evening, what are options to build desktop gui apps using guile?
<amz3`>guile-gnome
<amz3`>there is an example app called gnu foliot
<gour>amz3`: is that gtk2 or gtk3?
<gour>it seems that guile-gnome is gtk2
<OrangeShark>gour: yes it is only gtk2
<gour>ok, thanks