<daviid>wleslie: how is/was hacking today? <daviid>it seems we are gaining new users lately <wleslie>quite good. I'm working on a little python binding to libfirm this morning, rather than the myriad of things I should be doing <daviid>wleslie: yes, it happens... to all of us :) <wleslie>how are you hacking today? I've been wondering, is there some big personal project that motivated you to bring clutter to guile? <daviid>wleslie: I did bring clutter to guile, andy did [wingo] <daviid>wleslie: i have ideas for 2 projects, but nothing i can talk about yet <wleslie>ah. well still, you're very regular at patching bugs (: <daviid>wleslie: yes, I wish I was a lot faster, but i have a lot of other things to do <daviid>I wish we had clutter 1.24 already <daviid>that means a much more recent glib bindong, guile-gnome ... a lot to do still ***davidh` is now known as davidh
<koz_>Does Guile have bindings to programmatically work with recutils? <rekado>do you know if there's any effort to make Guile more attractive for scientific computing? I suppose it would require more bindings to libraries such as GSL and GLPK. <rekado>so tired of seeing so much Python at work. <lloda`>most of the bindings I've written are private though :-/ <civodul>because of employer restriction or something? <koz_>Yay, someone else using NAB! :) <koz_>This might sound like a stupid question, but how does one write Guile bindings to a C lib? It'd seem nobody's written librec bindings, and I might have to. <koz_>Well, it seems like bindings are indeed needed. I guess I should RTFM a bit first. <lloda`>civodul: some of the stuff yes. For other things... I did the embedded route at first (a mistake, in hindsight) and they depend on my embedding of Guile. Or they were done pre-FFI and they need a build system, etc. <lloda`>FFI makes distribution so much easier <civodul>let's hope you can convince your employer to give back by freeing the relevant parts :-) <civodul>did you make official releases of the FFTW and CBLAS bindings? <lloda`>FFTW wraps only the complex-complex dft and CBLAS has a bug with reverse strides <lloda`>need to find some time to make them fit for release <lloda`>these are the 'release' posts fwiw <JeanLouis>is there procedure to read file at once? Or I have to make it (I can). <JeanLouis>aha yes, still i have to open port for that right? <davexunit>(call-with-input-file "foo.txt" read-string) <JeanLouis>(define new (call-with-input-file "~/releases.json" read-string)) -- I got it, thanks much. Why is ~ not interpolated to $HOME ? <JeanLouis>it works with /home/user/releases.json but not with ~/releases.json ***karswell` is now known as karswell
<davexunit>(string-append (getenv "HOME") "/releases.json") would be the equivalent Guile code <amz3`>I did not know that trick "davexunit | (call-with-input-file "foo.txt" read-string" <JeanLouis>now trying to search in guile info about reading hash tables... any clue? <davexunit>you can retrieve a value from a hash table with hash-ref <JeanLouis>maybe there is some system to embed guile in text, that I can process only parts of it within a text? <JeanLouis>maybe there is something like "eval" from Perl in Guile? Then I can make regular expression search and evaluate guile code <davexunit>yes, the general rule is: if you think you need eval, you probably don't. <civodul>maybe the manual should explain why eval is evil, and give typical examples of where and how it can be avoided <JeanLouis>civodul: I intend to make something like <html>{(guile code)}</html> and to eval that, it will be like templating. <davexunit>JeanLouis: string-based templating is problematic. <davexunit>JeanLouis: in the specific case of web pages, check out SXML <JeanLouis>my text <html>{(guile code)}</html> is not intended to be on public servers, rather in the database, from where it is later converted to static pages. Is that contrary to insecurities told on that URL? <Jookia>strings aren't guile code, sexprs are <davexunit>it's still problematic because it's inelegant <davexunit>you lose basically all of the advantages of s-expressions by stuffing them in there like that. <davexunit>the ` is the quasiquote syntax, and the , is the unquote syntax, which allows evaluating arbitrary expressions within a quoted form. <JeanLouis>davexunit: thank you, I learn from this. I only want to replace Perl, obviously I can replace some Perl templating module easier in Guile than in Perl. <JeanLouis>davexunit: there are 2 things I intend: to get this <html>{$variable}</html> in Guile, I think it is simple, regexp matching and checking if variable is known string, if yes, replacing, if not replacing with empty. <JeanLouis>the 2nd thing, would be to make it evaluate any Guile code. Is this 2nd thing wrong too much? <davexunit>I'd encourage you to not go down this road at all <davexunit>I can write the equivalent template using SXML as follows <JeanLouis>not that I understand anything from that line <davexunit>we can parameterize templates further by making procedures that return SXML <JeanLouis>returning SXML is for me returning HTML basically. <davexunit>the sxml->xml procedure will transform that s-expression into text <JeanLouis>yes, that is not helping me, my works are simply text, usually written in Markdown. And there are variables inside like {$variable}. <JeanLouis>I don't construct HTML tag by tag, Markdown will be doing that. I only convert variables. Does that fit in your design? <davexunit>if you insist on string-based templating then I cannot help you <JeanLouis>you tell me that, but I don't know if I insist on string-based templating <Jookia>JeanLouis: Variables inside Markdown?! <davexunit>JeanLouis: your works are not simply text, they are programs <davexunit>given that they have code that is to be evaluated in them. <davexunit>I suggest that you treat them as real programs rather than trying to do string-based text substitution. <JeanLouis>ok davexunit: I could treat all text as program, but does that mean I have to put text in ()? not so good <davexunit>string-based templating is inflexible and prone to escaping issues <Jookia>you could quasiquote your markdown <davexunit>Jookia: that would require a sexp->markdown transformer. <davexunit>someone posted one on guile-user but it's not exactly something that has been released and is easy to get started with at this time <Jookia>davexunit: I mean with string-append -> markdown -> HTML <Jookia>One interesting thing to think about is what variables you're including <Jookia>I'd imagine you'd just have a function taht returns some markdown/marked up sexpr or whatever with the variables spliced in. Though I'm not sure what Guile uses in place of Markdown <Jookia>JeanLouis: Because usually people don't write text with variable replacements <JeanLouis>Jookia: that kind of variable replacements is basically in all templating engines <Jookia>Is markdown a templating engine? <JeanLouis>I have templating engine, it replaces variables in HTML template, but also in the text works that later enter the HTML template. <amz3`>JeanLouis: maybe you can do this as a two phase process: 1) preproces files as text and replace occurrences of {$variable} using regex 2) render the markdown using markdown renderer <Jookia>JeanLouis: Anything that takes input can be a function <JeanLouis>amz3`: yes, that is exactly what I have now working in Perl. I will replace all with Guile. But need to learn it. <Jookia>Input being variables to replace <JeanLouis>Jookia: I guess you tell me that because of security? <JeanLouis>I have now in Perl like this {&main::youtube(12345)} and it gives me youtube embeded in HTML <JeanLouis>of course, someone can change my source, and destroy everything by changing youtube function. <Jookia>Security issues usually come from not understanding the flow of data, state and processing in your code <Jookia>Right now you have some global bucket of variables you can add to your markdown <davexunit>JeanLouis: perhaps the Skribe syntax available in guile-reader will be of interest <JeanLouis>in Guile, I think like this: {(function("value")} -- to be evaluated and put back in text. <amz3`>JeanLouis: I recommend you port the current Perl the way it works to learn some Guile <amz3`>after that you can fiddle on how to make it better <JeanLouis>davexunit: I read guile-reader documentation and I don't get easily the concept of what it does really, I don't know definition of "reader" yet. <davexunit>JeanLouis: a reader processes text, something human readable, and builds a machine-readable representation <JeanLouis>basically, it can find my variables and process? <davexunit>JeanLouis: up to you. I've done about all I can to warn you about string-based templating systems. <JeanLouis>davexunit: only I did not understand you fully. <JeanLouis>how would you replace variables which are less than 0.01% in the whole text? <JeanLouis>I would treat whole text as string, and replace the matching variables, yes. <davexunit>if your needs are so simple that you just need to do that, then just go for it. <davexunit>I've learned through experience that my needs are much more than that, and inventing a new templating language is counter-productive. <JeanLouis>after that, comes markdown, and after that, markdown is included in HTML template, and written on disk as static HTML file. <JeanLouis>davexunit: sure, you give me clue there is somethng ready, I wish to know what is ready? Tell me what shall I do? <civodul>it details the argument that davexunit gave <amz3`>JeanLouis: how many files do you have? <Jookia>davexunit: My favourite part of 'my needs are simple' is that they end up not being simple later <davexunit>Jookia: yes, I think this is often the case. <davexunit>what was once simple becomes increasingly complex. <davexunit>and hacks upon hacks are built on top of it. <JeanLouis>civodul: I have read that. It relates probably to those people putting templating engines on servers. I put only static files on servers, exactly for security and speed. <JeanLouis>davexunit: I think I can convert my templates into Guile using SXML, and insert inside the text, that first got variables by doing regexp replace somehow. <davexunit>JeanLouis: there's more to it than security. <JeanLouis>they have so little of {$variables} inside. How else can I change that? <davexunit>so do whatever gets you to your goal the fastest. <davexunit>if you were starting from scratch I'd recommend not using string-based templates <JeanLouis>no, no, I wish to make new website revision system, that other people can use. <JeanLouis>it shall be based on text with some variables, evaluated -> HTML with some variables evaluated -> static file <davexunit>the real power of using Scheme for your templates is that you can create abstractions for arbitrarily complex markup <JeanLouis>if you have suggestion, let me know, or show me your example, of your template <davexunit>here's a simple example of something I do frequently on websites <davexunit>I often want to wrap some arbitrary content with the same header/footer/etc. <davexunit>so I write a procedure that accepts an sxml object and produces a full HTML document by wrapping it in the header/footer I wanted. <JeanLouis>davexunit: do I understand right, you have template as scheme code, and that certainly makes it powerful? <davexunit>I can do arbitrarily complex transformations on data to produce my documents <davexunit>specifically because it is *just* Scheme code <JeanLouis>only imagine, you have each month 5-10 templates and you don't need special things, just title, description, page_content, footer... <davexunit>this style doesn't always fit right, particularly when writing prose, which is where the Skribe syntax comes in. <JeanLouis>and I am not yet on HTML building. I am right now on learning how to convert Perl regexps to Guile/scheme, that I can simply convert variables in the text. <JeanLouis>so when I say "templating engine" it is not just for HTML, it is for anything, it simply evaluates variables inside. <davexunit>you can do anything you want in Scheme provided that you have a procedure that can serialize a data structure as appropriately formatted text. <JeanLouis>too difficult to understand what you mean, but I appreciate your efforts. Only that I am 4th day in Guile <JeanLouis>text as text, actually, it does not matter, I guess it will be read from postgresql database, variables replaced, and given to some SXML function to put HTML together. <JeanLouis>I have also template types, so it would be possible to say it is this {$variable} type or SXML type or whatever someone uses <JeanLouis>and variables would come from a hash, not straight from guile. So if hash value does not exist, nothing much insecure is happening ***Korhoset is now known as Bobbejaantje
<davexunit>paroneayea: I'm planning on giving 8sync a try sometime soon. I have a project that may benefit from it. <davexunit>when doing GPIO programming with Linux, each GPIO pin has a file associated with it's current value (0 or 1). you can poll() or select() on those file descriptors. <paroneayea>davexunit: and just today I was working on the haunt based 8sync site in between guix pulls :) <paroneayea>davexunit: we should move from select to poll or epoll <paroneayea>davexunit: give the irc bot a try, it's fun to live hack <davexunit>I don't know how you've done things, but I'm hoping that I can extend 8sync to work with the GPIO library I'm working on. <paroneayea>davexunit: if you can use select/poll it's probably possible. <davexunit>that way I could write a userspace driver for say, a game controller, in pure Guile :) <paroneayea>davexunit: baseically anything that supports a file-ish binary port should work (socket stuff, file stuff...) <paroneayea>davexunit: you know how it goes... I've been meaning to put in more 8sync time, but have been caught up in everything else... <paroneayea>but I've been looking forward to you seeing if you think the design makes sense! <davexunit>I've been meaning to get haunt 0.2 out for months... <davexunit>ACTION names his next guile library "despair" <paroneayea>or maybe with alternatives to them! de-sexpression-pair <paroneayea>convert alists to various functional datastructures <davexunit>paroneayea: hehe I was just thinking about something along those lines <paroneayea>davexunit: well naming is the hard part of CS so you've already got a winner <paroneayea>davexunit: I mused to myself earlier today: maybe I should just replace jquery with elm-generated code in mediagoblin <paroneayea>that would be a lot more fun and a heck of a lot easier to package. <paroneayea>it'd be either awesome or terrible or some terrific combination of both I'm sure. <janneke>davexunit: yay, /me wants 8sync and websocket as guix package <paroneayea>janneke: yeah having 8sync with websocket support would be great. <janneke>figured you weren't ready to create a guix package yet? <paroneayea>janneke: are you the one who sent me the guix patch for 8sync? <paroneayea>janneke: maybe we should call it guix.scm or guix-env.scm, do you think? <janneke>paroneayea: yes, that was me...davexunit's websockets would be next :) <janneke>paroneayea: i was wondering about that <paroneayea>and then the email was marked as read and I forgot about it <janneke>paroneayea: i'm not sure what to call it, but now would be a good time to try to standardise it <janneke>i have been using package.scm, because that's what the manual seems to suggest <paroneayea>yeah davexunit uses guix.scm, I've been using guix-env.scm, and now we have package.scm :) <paroneayea>maybe we should all settle on guix.scm. I guess I like guix-env.scm because it makes it clear it's for environments. <janneke>yes... it would help packagers/developers if we suggest a standard <paroneayea>anyway, I should make an 8sync release and get it in guix, I suppose <paroneayea>it's super alpha but it would be nice to have people try it <janneke>paroneayea: yes, i very much like to try it <janneke>we are (isn't everyone?) building servers/daemons in javascript <janneke>and i want to get a feel for what guile/8sync can do for me <paroneayea>janneke: and I'd like to see what people think once they try it ;) <paroneayea>janneke: one thing holding back 8sync still though <paroneayea>is we need to get tls/ssl support proper into guile! <paroneayea>8sync could bundle the guix hack with it but iirc there are problems with it <janneke>yes, that doesn't block me from testing it, but it would block me from deploying it <paroneayea>could be a good time to stress test 8sync as a sane or not-sane project :) <paroneayea>civodul: well I'm already registered under gnu for gsoc <paroneayea>so I imagine there's no extra work to add me as a possible mentor <civodul>ACTION hopes wingo & davexunit & whoever is in that is registered as a GNU mentor :-) <paroneayea>civodul: I'll mark myself more formally as a possible mentor there <janneke>i would appreciate a comment on my GUILE_LOAD_COMPILED_PATH problem/patch <janneke>probably should have called it rfc rather than patch? <civodul>janneke: i think your suggestion is good <civodul>however! i think we cannot really change that <civodul>instead we could arrange for 2.0 and 2.2 to silently ignore invalid .go files <civodul>but yeah, for instance "guix build guile-reader --with-input=guile=guile-next" fails unexpectedly <janneke>i am not attached to the solution i proposed, but want to really solve this <civodul>basically because Guix's 'ld' wrapper runs on Guile 2.0, and it encounters 2.2 objects, and boom <janneke>i would like to run guile scripts of any major version, without any hassle <civodul>scm_primitive_load_path could catch exceptions from scm_load_compiled_with_vm <civodul>rather scm_load_compiled_with_vm could take a Boolean telling whether to throw upon error or not <civodul>and scm_primitive_load_path would keep searching upon scm_load_compiled_with_vm failure <civodul>i'd really like to incrementally switch to 2.2 as well <davexunit>paroneayea: I use guix.scm because the packages aren't *only* for environments. mine can be built/installed with 'guix build -f' and 'guix package -f' <davexunit>I originally used package.scm, but jao proposed guix.scm when I asked if he would be interested in a package file for geiser. <davexunit>I liked the idea, so I went for that instead. <davexunit>I would love some help with guile-websocket BTW, for anyone web developer that wants web socket support in their Guile applications. <davexunit>civodul: I often wonder if we should snarf the base64 and SHA modules from Industria to include in Guile core. <davexunit>I never want to depend on someone having industria installed since it's not a Guile package so I always just snarf the modules I need into my projects. <davexunit>civodul: I just read the "Add an extensible event loop" GSoC project for Shepherd. if I may nitpick, it's not true that it's impossible to have a REPL server without resorting to multiple threads because there is (system repl coop-server) <davexunit>though I don't think something like 8sync can work with it <davexunit>because we don't expose the client sockets. you are expected to periodically poll the REPL server. <davexunit>paroneayea: do you think 8sync could be adapted to work with something like this? <paroneayea>davexunit: so, the irc client does use the coop-server stuff you wrote <paroneayea>and it does it by setting itself up to poll every N times per second <paroneayea>davexunit: as for something better that doesn't use that <janneke>davexunit: sent a minor doc patch to guix-devel re: guix.scm/package.scm <paroneayea>I guess if the sockets were easy to access as ports <paroneayea>davexunit: yeah it took me like 10 minutes to add it <davexunit>I'm not sure if we really would have wanted to design it such that the client sockets were exposed even if we had known about this event loop stuff. <davexunit>but it's good that we can just poll every so often. <paroneayea>davexunit: yeah I set it up so that it polls (/ 1 30) secs :) <paroneayea>I figured if that framerate is good enough for mario sunshine <JeanLouis>even if I did install glibc-locales, I get this: substitute: warning: failed to install locale: Invalid argument <davexunit>JeanLouis: you need to set some environment variables, but I think you meant this message for #guix <davexunit>paroneayea: I should try to hook up my websocket server to 8sync <davexunit>would be really cool to have a single-threaded program capable of handling many clients