<nalaginrut>The network policy became tight in China, maybe I have to find/build a new mailing list rather than googlegroup... <slucx>nalaginrut: Are you chinese? <davexunit>someone wrote a little blog post about their first guile script and it made it to the front page of hacker news. <civodul>in short we'd need a way to add the contents of select .go files to the 'guile' binary <davexunit>so I wrote a very simple static file web server the other day. has anyone else written such a thing for guile? it's quite short, but I'd like to release it in some form for others to use/improve. <civodul>davexunit: wasn't there one in the examples wingo wrote back then? <davexunit>civodul: there could be and I overlooked it. <civodul>would be worth adding it to examples/web <davexunit>the only external requirement of my server is the 'file' program, in order to guess at mime types. <davexunit>okay, so submitting it as an example would be the right thing to do, cool. <davexunit>I wanted a replacement for 'python -m SimpleHTTPServer' that I use frequently. <civodul>or maybe that could even be a module under (web ...)? <civodul>so one can do guile -c '(@ (web server simple) serve)' *davexunit adds to TODO list <nalaginrut>davexunit: Artanis could handle static files and the MIMEs properly <davexunit>nalaginrut: artanis is far more robust than what I'm after. ;) <davexunit>I am curious at how you do mime type detection. it seemed to me to not be worth it to write myself, and let 'file' do it. <davexunit>file actually inspects the contents of a file. I was just doing regexp matches on file extensions before. <nalaginrut>davexunit: I generated a list from /etc/mime.types, then generate a hash table when init Artanis server <davexunit>civodul: that sounds like a really cool hack for the hurd <nalaginrut>although there's way to query from /etc/mime.types, I think my approach is faster <davexunit>nalaginrut: I think I will take this table and make some tweaks so I can remove the dependency on 'file' <davexunit>though 'file' is still more robust so I'm tempted to continue to use it, but eliminating a point of failure is more worth it. <davexunit>civodul: so some of the compiled guile source files need to be shoved into the guile binary because the hurd bootstrap doesn't have a file system to read from? <nalaginrut>davexunit: Thanks! I'm fighting for it these days, my wife band my PS4 unless I released Artanis first ;-( <nalaginrut>till now, all the related things are build with Scheme, except configure.ac and Makefile <nalaginrut>the site is built with Hyde of Chicken Scheme, a very cool static page generator <nalaginrut>after Artanis-0.0.1 released, I'll concentrate on compiler hacking, guile-lua <davexunit>nalaginrut: I see that you an experimental sexp->sql converter? <davexunit>what are your feelings about it? I'm having trouble reconciling the differences in sql syntax amongst the various databases, and the handling on infix, postfix, prefix syntax. <civodul>davexunit: exactly; but that would also be helpful for Guix, in fact <davexunit>yes. I want an sexp represtation of SQL so that I can use quasiquote and automatic escaping of input to prevent SQL injection. <nalaginrut>yes, but there's extra tools to prevent SQL-injection in SQL-mapping <nalaginrut>and it could let you define your function for detecting/eliminating SQL-injection issue <nalaginrut>well, if you ask it seriously, I confess there'd be a powerful server-core in Artanis, it's in TODO <davexunit>I'm personally stuck on one problem that blocks sly 0.1 from being released. <nalaginrut>davexunit: I want to write a MMO game with sly when there's new server-core <davexunit>sly would be a good choice for the client. :) <davexunit>I need a release so that I can start seeking contributors. I need lots of help optimizing, for one thing. <nalaginrut>nowadays, we have websocket in HTML5, so a pure http server is not enough in Artanis <civodul>davexunit: for the bootstrap procedure; currently we have to have a complete Guile tarball available to begin with (info "(guix) Bootstrapping") <davexunit>civodul: so instead, we could have a minimal guile? <nalaginrut>civodul: I'd love to see scheme@(guile-user)> when bootup ;-D <nalaginrut>in principle, we may implement Bash front-end in Guile, but maybe a sexpr-sh is better, hmm... <nalaginrut>last time I asked about minimal Guile is 2010, IIRC, the answer is "impossible" at that time <nalaginrut>guile -c "(use-modules(artanis artanis))(init-server)(run)" you'll get a simple HTTP static page server *nalaginrut should add this simple HTTP server to "hello world" chapter... <civodul>davexunit: more precisely, a Guile that doesn't need to access the file system <civodul>nalaginrut: that's already possible when booting the Guix distro :-) <nalaginrut>I wish Hurd could be run on ARM, respberryPI, dunno, I should ask <mark_weaver>porting gnumach to a new architecture will be a pain <davexunit>if developing for hurd could be made easier by using guile for the bootstrap and such, it just might attract some new devs. <mark_weaver>civodul: what's the use case you have in mind? (for guile that needs no filesystem) <nalaginrut>mark_weaver: are you saying gnumach only? or any kind of BSP? <mark_weaver>nalaginrut: I don't understand your question. I'm just saying that porting gnumach to a new architecture is by far the biggest difficulty in porting hurd. ***Guest52575 is now known as Fuuzetsu
<nalaginrut>mark_weaver: I know it's painful to port a kernel to a new platform. But I guess you mean it's especially hard for gnumach? or I misunderstood <nalaginrut>civodul: it's better to get rid of prerequisite of POSIX lib function for minimal mode <nalaginrut>so that the game using Guile as scripting could be ported to M$ platform easier <nalaginrut>I convinced a friend to write his new game with Guile, but then he found he has to use cygwin on Win, so he picked tiny-scheme <mark_weaver>nalaginrut: I didn't mean to imply that gnumach would be harder to port than any other kernel. but porting _any_ kernel is probably non-trivial. <nalaginrut>if it's possible to replace tiny-scheme with Guile-minimal-mode, it's better not to let users use cygwin <slucx>nalaginrut: Is there a book about datestruct descript by scheme? <slucx>nalaginrut: learn datastruct and scheme at same time <slucx>nalaginrut: yeah, I have a book <nalaginrut>slucx: but maybe you just want to learn data structure in Scheme, no especially for FP data structure <mark_weaver>"Purely Functional Data Structures" by Chris Okasaki is quite good. <mark_weaver>the book has ML and Haskell code, but it can be adapted to Scheme easily enough. <davexunit>I need to learn haskell just so I can adapt the code in these papers to scheme. <mark_weaver>slucx: merge sort is better suited to functional programming, and also far more efficient on large inputs. <jmd>mark_weaver: But a merge sort depends upon qsort <slucx>mark_weaver: I just try to write it with scheme <mark_weaver>in general, it's better to avoid 'set!' when practical <jmd>(or some other kind of sort) <slucx>mark_weaver: I just begin learn scheme. <jmd>Well that is how merge sort works. <mark_weaver>jmd: the base case can be: a singleton list is already sorted. <slucx>mark_weaver: do not use 'set! ? why? <nalaginrut>hmm...seems I just have <<Algorithms, a functional programming apporach>>... <mark_weaver>jmd: I've written merge sort several times without using any other sort. <mark_weaver>it may be common to use some other sort for lists below a certain size, as an optimization, but it's certainly not required. <jmd>mark_weaver: Well, yes it can be, but then you loose some of the advantages that the merge sort might bring. <mark_weaver>slucx: well, it's much easier for both the compiler and humans to reason about programs when the value of a variable doesn't depend on what time it is. <jmd>In your implementation, the singleton sort is the special case of the qsort. <mark_weaver>jmd: well, that's seems a strained way of looking at it. <mark_weaver>jmd: that page calls your method "tiled merge sort", mentioned in the "Optimizing merge sort" section. <jmd>That's the way most implementations I have seen work. <mark_weaver>that page happens to mention that perl switched to using merge sort as the default in version 5.8. <mark_weaver>slucx: fwiw, guile's compiler is able to optimize much better when most local variables are never 'set!'. <nalaginrut>davexunit: indeed, we should have Scheme version for it <davexunit>nalaginrut: I've been having a tough time figuring out how to implement a data structure called the "relaxed radix balanced tree". reading the paper about it and trying to decipher haskell/ocaml snippets makes my head hurt. <slucx>mark_weaver: (set! bigger (cons x bigger)) , how not to use set! ? <nalaginrut>davexunit: I face the similar pain, many papers about FP compilers are in Ocaml/ML/haskell <nalaginrut>it's not the worst case, they like to use Ocaml dialects <nalaginrut>when God created lambda, I don't know why people don't use it as the meta language <davexunit>I think I need to grok finger trees and write an implementation before I can understand rrb-trees. <mark_weaver>slucx: well, there's no reasonable way to write 'quicksort' without 'set!', but in general, the usual approach is to make a recursive procedure, and pass the new values to the recursive call, instead of using 'set!'. <nalaginrut>davexunit: please post something on your blog when you done your rrb-tree <mark_weaver>slucx: this depends on the fact that in scheme, calls in "tail position" are really GOTOs with arguments. <nalaginrut>davexunit: btw, I found it's wrong implementation in rb-tree in guildhall when I'm writing rbtree <nalaginrut>in deletion, but it's ok since people often use insertion <mark_weaver>slucx: also, I recommend looking at 'match' from (ice-9 match). It can be used to replace most uses of 'car' and 'cdr', and could also be used to more efficiently check whether the list as 2-or-more elements. <nalaginrut>each time I see dsmith I thought it's Friday today... <slucx>mark_weaver: yeah, I will lean the library of scheme soon <slucx>mark_weaver: I just learned the base syntax of scheme <davexunit>nalaginrut: I tried to write a persistent b-tree implementation, but I got stuck. <mark_weaver>slucx: sounds good. I just wanted to point out 'match' because it's relatively new and not mentioned in most scheme documentation, and yet it has been a great help in our efforts to make code more readable. <nalaginrut>davexunit: I would recommend not try to be functional first time ;-D <davexunit>I really like destructuring record types with it. <slucx>mark_weaver: I am searching the documents of it. <nalaginrut>davexunit: it's complicated structure, so not easy to be functional <slucx>I have to go sleep now, night, mark_weaver nalaginrut <nalaginrut>davexunit: for handling record-types, it's nice to use 'match' <davexunit>nalaginrut: then maybe I should just go straight to finger trees. afaict, they are the basis for the immutable vectors you see in clojure. <davexunit>and by using a branching factor of 32, they achieve something called "amorized constant time" access to elements. <mark_weaver>davexunit: hmm, I didn't expect to do better than log(n) <davexunit>the rrb-tree builds from that to improve the time complexity of other operations like appending. <mark_weaver>but log base 32 (n) is close enough to constant for most purposes :) <davexunit>mark_weaver: it is log(n), but the large branching factor makes it effectively constant time access. a vector with 1 billion elements only requires 6 hops down the tree to fetch any given element. <nalaginrut>hah, I know why you dropped the name guile-2d, since it support 3d now ;-D <mark_weaver>still, they shouldn't use the term "amortized constant time", which has a precise meaning. <davexunit>I think I've misread. they say "effectively constant time" in the rrb-tree paper. <davexunit>and then "2-3 finger trees achieve a lgN time for indexing and update <davexunit>while at the same time maintaining an amortized constant time <davexunit>nalaginrut: yeah, I want persistent vectors for sly. <davexunit>vlists are good, but the data structure that clojure uses has some additional advantages, from what I've read. <mark_weaver>one word of warning: in my experience, improvements in asymptotic time complexity usually come with a significant increase in the constant factor. <davexunit>so many games are based on a 2d grid that I would like a persistent array that performs adequately. <mark_weaver>it's tempting to go for the algorithm or data structure that has the best O(...) on as many operations as possible, but the next result if often slow as molasses in practice. <mark_weaver>this is why GMP uses something like 6 different multiplication algorithms, depending on the size of the numbers. <davexunit>though I think that clojure's persistent vector is a good example of it being a good solution in practice. <davexunit>but perhaps the rrb-tree is a bridge too far. <nalaginrut>well, when the code is down to fancy engineering for performance, it's not elegant anymore... <davexunit>this blog post also helped me understand what these papers were going on about in simple terms. <davexunit>(I've stolen a bunch of things from Elm for use in Sly) <davexunit>it is haskell-like, but it's a new language. <mark_weaver>davexunit: fwiw, I think that learning some Haskell would be time well spent for anyone who's interested in purely functional programming. most of the relevant papers assume knowledge of Haskell, and besides it's a beautiful and elegant language. <nalaginrut>I think I got its point, it generate js as backend with common HTML5 operations <davexunit>mark_weaver: yeah, I should. I just don't really like Haskell... <davexunit>it's hard for me to like any language that isn't a Lisp. <dsmith-work>davexunit: I share that sentiment. Howver, haskell really is elegant. <davexunit>I also like dynamic languages, not static ones. <nalaginrut>I could fall in love with C, but no more, for static imperative lang <dsmith-work>I'm liking detecting errors as early as possible, like at compile time. We use a lot a python, and there can be a blatant horrible bug that you will never see unless you eactually try to execute it. <davexunit>yeah, that's a nice advantage to static typing, but I don't like the programming environment that it creates. <nalaginrut>dsmith-work: I've heard that new python will add type annotation, but I don't think types solve all problems ;-P *dsmith-work is ever so slowly learning Haskell <nalaginrut>"more testing" is similar to "write it better", we often write accurate test when we encountered problems <nalaginrut>IMO, more testing is useful to avoid introduce new bugs <dsmith-work>A lot of this python code is in an embeedded environment. We usually have to go through something like a "Compile" cycle, as we need to build a filesystem and boot the device to run the code. <daviid>dsmith-work: thank you. will read now. while trying hard by myself, i started a chat on #autotools, but so far they can not help me either <daviid>dsmith-work: many thanks, I'm reading now <daviid>dsmith-work: it's been years now here is what i don't understand, and therfore don't know how to fix, both for guile-gnome and guile-clutter: <daviid>when i "git clean -dxf", autogen.sh/configure, then search for <daviid>so, "make" creates a file, let's call it blue.la, within which i can read "dependency_libs=... /usr/lib/x86_64-linux-gnu/libcairo.la ..." _but_ before running "make", i can not find, in any file of the guile-gnome tree, 1 occurrence of the word "libcairo". so, which file of the autotool chain and which variable/command will tah tfile run to create that dependency ? <daviid>Here is the content of the generated, by libtool, libgw-guile-gnome-cairo.la file, which has the 'false' dependency toward "/usr/lib/x86_64-linux-gnu/libcairo.la", which does not exists: http://paste.lisp.org/+33TO/2 <daviid>if i manually change libcairo.la to libcairo.so, it will proceed and fail in pango, then manually changing in pango, proceddees and fails in gtk ... until i can compile <daviid>it must be g-wrap, will look to it, have to go afk for a while, bbl