IRC channel logs
2017-10-13.log
back to list of logs
<guile-guest7>I am on RHEL 6.6, but do not have admin rights.. so I was trying to build all the required libs from source <guile-guest7>So after installation and stow, I have /home/kmodi/stowed/lib/pkgconfig/bdw-gc.pc which is a symlink to the actual install location <guile-guest7>CFLAGS="-I${STOW_PKGS_TARGET}/include -I${STOW_PKGS_TARGET}/include/gc" \\ LDFLAGS="-L${STOW_PKGS_TARGET}/lib" \\ PKG_CONFIG_PATH="-L${STOW_PKGS_TARGET}/lib/pkgconfig" \\ ./configure --prefix="${guile_install_dir}" make <guile-guest7>but still I get this error: checking for which bdw-gc pkg-config file to use... bdw-gc checking for BDW_GC... no configure: error: Package requirements (bdw-gc >= 7.2) were not met: No package 'bdw-gc' found <guile-guest7>Looks like I'll need to spend a weekend or two to understand all that.. got confused with guix pack vs proot <guile-guest7>At the moment I simply build my packages in my $HOME like ~/stow/pkgs/PKGNAME/VERSION and just stow everything to ~/stowed <guile-guest7>I believe Guix will do something like that, but with pre-built packages in its database? <Apteryx>sneek: later tell guile-guest7, then you'll at least need to build proot -- in the same page it details how to build a statically linked proot on a 2nd machine and then transfer the binary to your server. <Apteryx>What do we have in Guile as finalizers? <Apteryx>I want to close some ports at the end of some procedure, wether it went well or not. <Apteryx>or maybe I'm thinking this to hard and can rely on garbage collection? <Apteryx>How can I convey 3 states? In Python I could use None/True/False and None being falsy it would work as a boolean, but I could still extract extra info when I needed it. In Guile '() (empty list), is not falsy, which makes breaks this. Or is there a better None in Guile than '()? <llooda>Apteryx: I'd use any symbol, e.g. #t #f 'neither. For the other stuff are you looking for dynamic-wind maybe? <mwette>there may be concept of nil in guile (not part of scheme) to support elisp <sneek>Welcome back mwette, you have 1 message. <sneek>mwette, ArneBab says: ah yes (no terminator but newline). I need to add that for a general tutorial. <davexunit>mwette: there is but it's not recommended to use it in scheme code. <davexunit>there's no getting around that in Scheme the only falsy value is #f <davexunit>if you want a ternary system, I would make unique objects to represent them and write the necessary operators that use them <davexunit>but I wouldn't use a symbol for the third value. I'd allocate something fresh so that eq? could never be #t by accident <Apteryx>ACTION goes to read about dynamic-wind <Apteryx>davexunit: OK. I'm not there yet (at the level where creating my own DSL is natural) but I'll keep this on mind. Thank you! <Apteryx>Interesting. My string ports are closed upon entering a dynaminc-wind. Should this be expected? <bavier>OrangeShark: indeed, happy Friday <amz3`>sneek: later tell wingo people keep asking that question <amz3`>also, we need to parse url encoded forms or whatever the name is for data that is POST'ed from an HTML form otherwise, classic web dev is impossible in Guile <amz3`>maybe I am wrong, does anyone know how to parse request body from a POST'ed from using Guile? <amz3`>apparently artanis can process form data, I will extract that from artanis later :) <manumanumanu>ArneBab: Really, delimited continuations are _cool_. just look at wingo's fibers. <manumanumanu>ArneBab: I implemented the coroutine generator from the generator srfi (125??) using both call/cc and prompts, and the difference is quite something <ArneBab>is the difference speed or elegance or both? <manumanumanu>ArneBab: speed. It could also be done with only one call-with-prompt, instead of two call/cc <manumanumanu>And once the complete continuation starts getting larger, the difference will be a lot bigger. With delimited continuaions, you never save more than you need <Apteryx>What's the best way to parse a result file I made when it as one sexp per line? So far I'd read the whole file as a string, split it per line and use eval-string. I guess there might be something more "native"? <mwette>oops, I use (define scm-reader (language-reader (lookup-language 'scheme))) <mwette>language-reader is in (system base language) <Apteryx>davexunit: seems close! Each line are formatted like this: ("a" "b" "c"). When I eval or use load on that I get: Wrong type to apply: "a", which makes sense. If I put a quote to say it's a list like '("a" "b" "c"), I get: Wrong number of arguments to #<procedure eval (_ _)>. Hmm. <davexunit>okay so what you have is not scheme source code <davexunit>but I'm going to assume that evaluating that file is not what you want <Apteryx>I tried saving a serialized version of a list of records to a file, one per line. Now I'm trying to load the file and get them back. <davexunit>okay, so if the format is set in stone then open a file, and repeatedly call 'read' until you reach the end of file <davexunit>or, wrap the whole file in parens and read that to get a list <Apteryx>OK. So this was my mistake! I should have used a list. Thanks for pointing it! <Apteryx>I don't need quotes when working with files, right? <m3tti>how could i use guile to make tcp connections <mwette>scm-reader will not eval. I use a loop basically this: <Apteryx>mwette: isn't scm-reader the same as the native 'read'? <mwette>(language-reader 'scheme) is like read but reads one sexp at a time <mwette>ah yes, I thought is was different. So that should work. <Apteryx>mwette: OK, sweet. I'll use a named let, and pass back a list that will get consed to with each line's result. <manumanumanu>Apteryx: I don't know if you know that, but a neat trick in guile is to not use an accumulator, since guile doesn't have a stack limit <manumanumanu>that is actually faster than doing it the conventional way, with an accumulator <mwette>Ah. `read' does not let you specify the context. I need to check if I need that. <mwette>named let can use the stack if you (cons xxx (iter x)) instead of (iter (cons ...)) <manumanumanu>mwette: jesus christ, don't look at that code. it is wrong and not what I intended to do <manumanumanu>mwette: the last line should be (cons line (loop (read port))) <Apteryx>manumanumanu: thanks for sharing. It's good to assume I know nothing about Guile, eh! I don't get it though. I would think your example would return the last line only, instead of a list (I want the later). <manumanumanu>Apteryx: my code is wrong. I didn't even read it through <manumanumanu>Apteryx: I just wish someone would have told me a lot earlier about the expanding stack :) It is such a cool thing <Apteryx>nice! so this is what mwette was talking about. It suses the stack instead of a variable (accumulator)? Which is faster since it's already using that much of a stack depth? <mwette>manumanumanu: I hadn't looked, but I guess you knew what you were doing. Thanks for posting the example. <manumanumanu>Apteryx: it is faster since you don't explicitly need to call reverse or reverse! at the end (if you want to keep the order) <manumanumanu>if you don't care about the order, I suspect an accumulator will be faster <mwette>I think it depends on how many bindings you introduce in the named let and other stuff inside the loop. <Apteryx>Interesting. I'm not sure why the returned value would be the list of cons'd read expressions instead of '() though? Given that (if (eof-object? line) '() ...) is going to be evaluated last. <manumanumanu>the only time it, to my knowledge, isn't faster is when jumping in and out of the loop with continuations, since restoring a large stack is more expensive than just a stack with an accumulator on it <manumanumanu>Apteryx: because the result is the whole call stack it conses the line with the result of the next iteration <Apteryx>maybe "line" should be copied under the if so that's the final returned value? <Apteryx>hm, OK. Still a bit mysterious to me :) I'll give it a shot. <mwette>1: (let iter ((out '()) (in '(a b c))) (if (null? in) (reverse out) (iter (cons (car in)) (cdr out)))) <mwette>2: (let iter ((in '(a b c))) (if (null? in) '() (cons (car in) (iter (cdr in))))) <mwette>1 and 2 should give same answer if I did it right <mwette>1: (let iter ((out '()) (in '(a b c))) (if (null? in) (reverse out) <manumanumanu>Apteryx: the factorial procedure is not faster than using an accumulator, but it works the same way as the list one. each return value of a procedure is dependant on the return value of the next procedure application until (= n 1) <Apteryx>factorial is easier to grasp, it just churns until it reaches a single value. <Apteryx>OK, my brain now agrees with the code. Thanks :) <Apteryx> Basically this for #2: (cons 'a (cons 'b (cons 'c '())))