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>I am stuck at fulfilling the bdw-gc requirement ..
<guile-guest7>I installed gc-7.2g from http://www.hboehm.info/gc/gc_source/gc-7.2g.tar.gz
<guile-guest7>I organize packages using GNU Stow
<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>I configure guile using
<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>what am I missing?
<guile-guest7>(where STOW_PKGS_TARGET is /home/kmodi/stowed)
<Apteryx>guile-guest7: have you considered the proot trick? It seems you could use a guix pack with it without having to build anything from source: https://guix-hpc.bordeaux.inria.fr/blog/2017/10/using-guix-without-being-root/
<guile-guest7>thanks, I'll try that out
<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>Also I don't have 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.
<sneek>Will do.
<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>llooda: thanks!
<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?
<Apteryx>Here's what I mean by that: http://paste.lisp.org/display/358456
<OrangeShark>Happy Friday
<bavier>OrangeShark: indeed, happy Friday
<happy_gnu[m]>Hi \\o/
<happy_gnu[m]>What Emacs packages do you prefer to work with Guile?
<happy_gnu[m]>I only have autocomplete
<happy_gnu[m]>What else do you recommend me
<ft>Geiser
<happy_gnu[m]>Oh I also have geiser :) I forgot that
<OrangeShark>rainbow delimiters
<OrangeShark>paredit
<amz3`>+1 rainbow delimiters
<amz3`>+1 week end
<amz3`>Apteryx: here is the better-than-pipe thingy, it's the underlying procedure used by open-pipe https://lists.gnu.org/archive/html/bug-guile/2016-09/msg00008.html
<amz3`>sneek: later tell wingo we need to push forward this bug https://debbugs.gnu.org/cgi/bugreport.cgi?bug=15228
<sneek>Will do.
<amz3`>sneek: later tell wingo people keep asking that question
<sneek>Will do.
<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`>s/from/form/
<happy_gnu[m]>Rainbow delimiters is pretty cool :O
<amz3`>yeah
<amz3`>apparently artanis can process form data, I will extract that from artanis later :)
<happy_gnu[m]>And paredit is just perfect
<happy_gnu[m]>I am using it
<happy_gnu[m]>Just for fun deleting stuff
<happy_gnu[m]>And creating
<happy_gnu[m]>A lot of s-expressions
<manumanumanu>ArneBab: Really, delimited continuations are _cool_. just look at wingo's fibers.
<dustyweb>o/
<manumanumanu>ArneBab: I implemented the coroutine generator from the generator srfi (125??) using both call/cc and prompts, and the difference is quite something
<manumanumanu>even at top level
<ArneBab>manumanumanu: sounds good
<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
<ArneBab>manumanumanu: that sounds great
<Apteryx>amz3`: thanks for the link!
<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"?
<Apteryx>s/as/has
<mwette>Apteryx: try scm-reader
<mwette>oops, I use (define scm-reader (language-reader (lookup-language 'scheme)))
<mwette>language-reader is in (system base language)
<Apteryx>OK! While searching I stumbled on this: https://www.gnu.org/software/guile/manual/html_node/Scheme-Read.html. I'll try those options. Thanks!
<davexunit>Apteryx: use 'load'
<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>I'm not sure what you are trying to do
<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?
<davexunit>np
<m3tti>hi
<m3tti>how could i use guile to make tcp connections
<mwette>scm-reader will not eval. I use a loop basically this:
<mwette> (call-with-input-file file
<mwette> (lambda (iport)
<mwette>
<m3tti>0
<manumanumanu>Apteryx: why not basically just use read?
<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
<manumanumanu>mwette: read reads one sexp at the time as well
<mwette>ah yes, I thought is was different. So that should work.
<manumanumanu>or datum, of course
<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>Apteryx: https://pastebin.com/PK9HWnfC
<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
<Apteryx>eh, no worries.
<manumanumanu>Apteryx: for clarity, something like this: https://pastebin.com/xb5wpW6K
<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
<manumanumanu>(cons line (loop (read port)))
<Apteryx>maybe "line" should be copied under the if so that's the final returned value?
<manumanumanu>nope
<Apteryx>ah, decidely no.
<Apteryx>hm, OK. Still a bit mysterious to me :) I'll give it a shot.
<manumanumanu>Apteryx: consider this factorial function: https://pastebin.com/sn6mbP9C
<mwette>1: (let iter ((out '()) (in '(a b c))) (if (null? in) (reverse out) (iter (cons (car in)) (cdr out))))
<manumanumanu>mwette: you forgot the accumulator in the last cons
<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>ya ya
<mwette>1: (let iter ((out '()) (in '(a b c))) (if (null? in) (reverse out)
<mwette>and (cdr out) -> (cdr in)
<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)
<manumanumanu>now I need to go to bed. gnight
<Apteryx>good night!
<Apteryx>ACTION studying examples of mwette
<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 '())))