IRC channel logs
2016-07-31.log
back to list of logs
<mark_weaver>r7rs-wip is my work, although taylan rebased it recently. <mark_weaver>I agree that detecting cyclic code would be good. that would have to go in the macro expander, I think. <mark_weaver>because before macro expansion, it's not yet what is code and what is data. <mark_weaver>relatively few of us have worked with the psyntax code in recent years, just wingo and me, I think. it would be good if more people would learn :) <ijp>I do want to do some experimenting with the expander, but it's not a priority <mark_weaver>the first step to understanding psyntax is to read the paper that is cited in its comments near the top. <ijp>I have a rough idea of how it works from the beautiful code article <mark_weaver>*nod* I haven't read that article; maybe it covers the needed concepts. <paroneayea>speaking of cycles, I learned about the tortise and hare style of detecting cycles by seeing "tortoise" and "hare" show up as locals in the guile debugger today while debugging some code in a map :) <linas>on rare occasions, guile from current git prints "madvise failed: Cannot allocate memory" from libguile/vm.c:893 <linas>rare == very rare, haven't seen this in many months <defanor>hello. i'm looking for a graph library suitable for directed and weighted (and possibly cyclic) graphs, and particularly for shortest path search between two given points. is there one for guile? <ijp>maybe in guile-lib, but I suspect most graph libs are custom made <defanor>what about cairo, are there bindings for guile 2+? i've only found some old ones (for 1+) so far <ijp>1.9.91 supposedly works with 2 <brendyn>How can I simply open a text file in guile? <amz3>brendyn: use with-input-from-file <defanor>+ (info "(guile)File Ports"), or API Reference > Input and Output > Port Types > File Ports <brendyn>Hmm there is very little in the manual about it <brendyn>How can I input the file if it has no arguments? <defanor>the function description explains that -- current-input-port and current-output-port are getting set <mark_weaver>brendyn: because thunks, like all other procedures, capture their lexical environments. <brendyn>(with-input-from-file "foo.txt" (lambda () (display "I'm a silly thunk"))) <defanor>it would make a bit more sense with (with-output-to-file "foo.txt" (lambda () (display "I'm a silly thunk"))), but yeah <mark_weaver>'read-line' or 'read-string' from (ice-9 rdelim) are other useful examples <mark_weaver>read-string reads the entire file as a single string <mark_weaver>best avoided if the file could be huge, but otherwise convenient <defanor>what would it do if a file is a pipe, btw? read until it's closed? <brendyn>Wow, I've finally managed to implement cat after 3 hours <brendyn>Well, not actually cat. Just displaying a text file <brendyn>Are (list-tail '(...) 1) and (cdr ...) the same thing? <mark_weaver>brendyn: (list-tail '(...) 1) and (cdr '(...)) are the same <brendyn>Well when I swap them I get ERROR: In procedure cdr: Wrong type (expecting pair): filenames <mark_weaver>brendyn: give me enough information to reproduce this on my end please <brendyn>My code has all turned to spaghetti now <mark_weaver>i.e. what expression led to that error, and what are the relevant free variable bindings, etc. <mark_weaver>it avoids most uses of 'car', 'cdr', 'list-tail', etc. <mark_weaver>no, for pattern matching and deconstructing list structure <mark_weaver>'with-input-from-file' is called incorrectly from 'iter'. only one argument is passed, no thunk. <mark_weaver>the second clause of the 'cond' is wrong, should be (else (let* ...)) and without the extra layer of parens <mark_weaver>you're also using the name 'file' for a variable that actually contains a string <brendyn>Well it's hard to invent symbol names <mark_weaver>I guess I should just rewrite this and show you how it can be done more elegantly <paroneayea>I wouldn't suggest a minifree x200 for anything opengl related <paroneayea>there's a bug in the graphics driver that makes opengl start to slow down dramatically after a short time <mark_weaver>also, the [(] hack of quoting the ( can also be done as \\\\( <brendyn>paredit.el keeps intercepting my \\ so I typed that <brendyn>Alright, I'll try understand this, then I have to complete the regex bit <mark_weaver>paredit does intercept the \\, but it does the right thing there. what is the difficulty? <brendyn>Currnently it just returns all the DownloadEpub('C1277') bits <brendyn>Like when I typed the first line it would go #!/usr/bin/guile \\^M <mark_weaver>right, it's true that paredit interferes with the \\ in the shebang, but it seems to do the right thing when inserting \\\\( into the regexp string <brendyn>Basically there are these javascript download links on a site that I can't get with wget. in the webpage it has buttons like onClick = DownloadEpub('C1277') where DownloadEpub concatenates some things to make the url as per http://haodoo.net/d.js <brendyn>Since I have all the html files I wantet to recreate all those links and download the books. <mark_weaver>in the scheme world, we usually prefer to convert html to sxml using a package called htmlprag. <brendyn>Would it be better to replace the regex with some proper scheme code? <mark_weaver>sxml is an S-expression notation for XML that's convenient to work with in scheme, and elegantly avoids issues around proper parsing and quoting within XML/HTML <brendyn>I guess that would work unless there were malformed files <mark_weaver>htmlprag aims to tolerate typical HTML in the wild, iirc. <ijp>it might be an idea to rewrite htmlprag to use the html5 parsing algorithm <mark_weaver>although I've not had occasion to use htmlprag myself. for my use cases, it sufficed to simply use xml->sxml <mark_weaver>we use SXML in the generation of the web pages for Guile and Guix, and I've used it for parsing RSS feeds <brendyn>Hmm ok, how do I load this into guile? <ijp>I think it's in guile lib, which I don't remember if I packaged <brendyn>(xml->sxml "<br>") doesn't work, so I'll probably need the other library <ijp>I may be the only person that use pre-post-order for that <mark_weaver>brendyn: anyway, having said all this, it might be that in this particular use case, it's easier to just use regexps, even if not as robust. <mark_weaver>if it's easy to generate the URLs based on strings found by that regexp <brendyn>It's probably not the best regex anyway. <brendyn>It seemed impossible to make the regex start matching after a string instead of before <brendyn>Like this just returns C1277 in python <mark_weaver>where 'type-prefix-table' should be filled appropriately <brendyn>I don't understand how match works yet <mark_weaver>when the pattern is (argv0 . file-names), that means that the car is bound to 'argv0' and the cdr is bound to 'file-names'. <mark_weaver>and the second pattern is _ which means match anything without binding it to a variable <davexunit>ijp: honestly, I don't know how to use pre-post order. it's probably the "right thing", though. <mark_weaver>actually, I guess the first pattern will always match in this case, so the second pattern is useless. <mark_weaver>but this is a very simple pattern for matching argument lists when you don't want to do proper option parsing. <brendyn>I think you made an error in string-append, maybe <mark_weaver>that indicates that the 'type-prefix-table' lacks an entry for the type code in that case. <mark_weaver>I told you above that 'type-prefix-table' needs to be populated <mark_weaver>when 'assoc-ref' fails to find an entry, it returns #f <mark_weaver>you could also just use 'match' directly, instead of using 'assoc-ref' with an explicit table. <mark_weaver>e.g. (match type (("Updb" "updb-") ("Pdb" "pdb-") ...)) <mark_weaver>'match' raises an exception when none of the patterns match <brendyn>Actually, this looks similar to the original Javascript <brendyn>No worries. I'm trying to add an affix now :p <brendyn>Wow, this make-regexp magic is great <brendyn>It's like the regex has 3 different kinds of results somehow <brendyn>This one works reasonably well. For some reason it outputs a bunch of #<Unspecified>, so I'll figure that out tomorrow. <daviid>cmhobbs: guile-gnome installs its modules in $prefix/share/guile-gnome-2 <daviid>cmhobbs: in order to make this path 'known' to guile, just (use-modules (gnome-2)) <daviid>cmhobbs: (gnome-2) is installed in (%global-site-dir) <daviid>cmhobbs: for info, someone mentionned KisĂȘ: it is now part of GNU, but the name name changed, it is now GNU Foliot <cmhobbs>daviid: i was doing that use modules line but it says it can't find gnome-2 <cmhobbs>it's just not in my guile load path, i don't think <daviid>cmhobbs: you said you're on debian, using guile-2.0 package right? did you install as root? it could be thgat you missed a reported error at install time <daviid>of course I'm just shooting here. where did you install guile-gnmome?