IRC channel logs
2016-08-24.log
back to list of logs
<davexunit>sapientech: macros are not procedures. apply calls a procedure with the given argument list. <sapientech>davexunit: okay cool i was thinking along those lines, so i was suprised to see some code that was trying to do that... <davexunit>'macro' doesn't match the pattern (macro param1 param2 ...) <sapientech>davexunit: for testing purposes, lets say i wanted to feed a bunch of different macros the same inputs, any idea for the best way to do that? <amz3`>ah there is a way to do that, let me find an example <amz3`>I think it's not possible with define-macro, at least I am not aware, but if you define-sytax you can feed different forms the macro so that it match different syntax <sapientech>amz3`: thanks for the info! and yes i am working with define-macro <amz3`>the first case takes only one argument ((_ g) (Zzz g)), the second case takes several arguments <amz3`>sorry my irc client dropped somekind of explanation, I think you got it <amz3`>I made good progress today, I am happy! <rekado_>I'm trying to read from a bytevector port with (get-bytevector-n port 56), but the resulting bytevector is 59 bytes long. <rekado_>argh, no, I think I'm just confused. Never mind! <HotLava>What is a good way to get the output of a shell command in guile? <HotLava>I tried (define ls2 (with-output-to-string (lambda () (system "ls")))), but it seems to just return an empty string? <davexunit>'system' is for the purpose of running a shell command and getting its exit code <davexunit>you want open-pipe or open-pipe* from (ice-9 popen) <amz3>HotLava: what is the command you want to bind? <amz3>HotLava: here is an example of calling html2text with text input from scheme and retrieving the output <amz3>this is a bit more involving that just getting the output <HotLava>davexunit, thanks a lot, i was hoping for a slightly higher level interface, but this will also work <HotLava>i doubt guile wants to have my half-baked hacks in its standard library ;) <HotLava>amz3, i want to parse aptitude/dpkg output for some small script <davexunit>hmm, I have an interesting problem that is revealing how little I really know about macros. <jbdatko>What does the '%' mean in front of some variables? Like, from the guile reference manual, the load-path vairable is `%load-path`. <davexunit>jbdatko: it's just a naming convention. usually reserved for globals. <davexunit>I'm trying to write a macro that rewrites procedure application e.g. (+ 1 2 3) into some other form, but I would like it to play nice with other macros and it doesn't. <davexunit>for example (quote 1 2 3) isn't a procedure application, so I'd like my macro to leave it alone. <davexunit>guess I'll need an equivalent of quote/unquote <paroneayea>I guess I'll either try guile-ncurses or guile-gnome <paroneayea>see, if we had guile-emacs, it would be easy to write an emacs mode leveraging the things I already have! <amz3`>on my side I need to provide better machinery for wiredtiger multithread <amz3`>it seems like I can't do it without breaking my current code :/ <amz3`>the main problem I stumbled upon (outside the fact that working in a multithread settings is not easy) is that I pass around a context everywhere <paroneayea>amz3`: do you really think you'll need multithread support anyway? <paroneayea>amz3`: more interesting would be if it can cooperate the new "suspend on port i/o" stuff for the guile asynchronous stuff in new guile <paroneayea>if users need true parallelism, they can always break out processes and do message passing :) <amz3`>what is the difference between (with-mutex mutex body ...) and (with-input-from-file filename thunk) <amz3`>with-mutex takes a `body ...', where `with-input-from-file' takes a thunk <davexunit>besides the fact that they do entirely different things, yes. <amz3`>my questions is specifically about the thunk vs body ... <amz3`>another difference it makes sens to pass 'with-input-from-file' to procedure as argument, where it doesn't makes sens to do such a thing with `with-mutex` <amz3`>if with-mutex was procedure I mean, It could be passed as argument <amz3`>but there is no interest in making a proc <davexunit>oftentimes the procedure version is named "call-with" rather than just "with" <davexunit>with-foo being syntactic sugar for call-with-foo <stis>Map is {1-a,2-b,3-c}, X is {1,2}, mapset(X,Map,Y). <stis>\\me is eating my owwn dog food <stis>ACTION is eating my own dog food <stis>next step is to avoid enable = and == to know about sets, currently to test set equality I need to have a special operator <stis>I plan to make a guile class of the set and then guiles internal hash and equal? will know about it, this will enable = and == do do what we want. <stis>a cool thing about the set is the hash of the set. <stis>two elements e1, e2 lead to the hash (xor (hash e1) (hash e2)) <stis>xor beeing distributive and commutative and idempotent works great to enable a scalable hash <stis>which means that sets of sets are pretty darn fast <stis>so if e, with hash eh, belongs to set S, with hash hS, then the new set hash of the set with e removed is (xor he hS) <stis>and becaise the order of (xor he1 he2 he3 ...) is unimportant and (xor e1 e1 e) = e, we are golden <stis>I have one todo remaining though, the empty set should have a special hash value, currently it is 0