IRC channel logs

2017-04-26.log

back to list of logs

<joe42>Hello all. I want to learn to program. And I would really like to begin with guile. Aside from the resources on the website, where might one learn programming techniques?
<davexunit>joe42: Structure and Interpretation of Computer Programs is a classic and it uses Scheme as the teaching language: https://sarabander.github.io/sicp/html/index.xhtml
<paroneayea>catonano: ,expand at the repl
<Deuk_Neukem>So is there any way to call libc from guile?
<Deuk_Neukem>In particular prctl on whatever libc you link to your linux
<davexunit>Deuk_Neukem: yes, you can use the FFI
<Deuk_Neukem>davexunit, yeah I found that, it's not very understandable, it uses terms like "dobj" but doesn't tell me where it's explained what that i
<davexunit>you can call (dynamic-link) to get the dynamic library object for libc
<Deuk_Neukem>So how do I pass it C ints and constants from the libc?
<Deuk_Neukem>I mean I just need to do prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0) really
<davexunit>what you are calling a constant isn't a constant
<davexunit>it's a preprocessor macro
<davexunit>so you'll need to find the value of PR_SET_CHILD_SUBREAPER and pass the function that value from guile
<davexunit>what is the return type of prctl?
<Deuk_Neukem>davexunit, int
<davexunit>(pointer->procedure int (dynamic-func "prctl" (dynamic-link)) (list int int int int))
<davexunit>I'm just assuming all args are ints here
<Deuk_Neukem>Ahh
<Deuk_Neukem>And you can jut use scheme numbers for that?
<davexunit>yes the FFI will do the translation
<brendyn>davexunit: someone said Hi to you in another channel 'from SICP'
<davexunit>brendyn: thanks
<davexunit>must not be a channel I'm in
<brendyn>davexunit: I'm interested in playing around with your guile-sly or chickadee. guile-sly doesn't compile on Guix anymore. I'm not sure what the difference between the two are
<davexunit>chickadee is what I'm putting efforts into now, so I'd recommend that one. need to make another release of it.
<davexunit>chickadee is very general purpose
<brendyn>I'd like to make a Game of Life clone in it. Is it suitable for that?
<davexunit>yeah
<brendyn>Ok, this should be great for me to learn Scheme
<davexunit>it's early days still, so maybe not all of the graphical primitives that you would want will be there
<davexunit>currently I'm working on scripting stuff
<davexunit>and things like tweening for flashy animations like this https://files.dthompson.us/random/tween-test.gif
<brendyn>Cool. I'm just figuring out how to load chickadee into my repl in emacs
<davexunit>I just pushed a commit that fixes a pretty terrible bug in the game loop
<davexunit>brendyn: you won't want to do everything from the repl directly because you need to start a game loop and that loop doesn't terminate
<davexunit>so you'd just be sitting there twiddling your thumbs
<brendyn>btw the https link to your git repo doesn't work, but the git:// one does
<davexunit>yeah, I know.
<davexunit>gotta fix that.... some day.
<brendyn>build failure... ERROR: In procedure stat: Wrong type argument in position 1 (expecting open file port): #f
<Petit_Dejeuner>Anyone here managed to compile Chickadee-0.2.0? I've got guile-sdl2-0.2.0 installed, but I still get the following errors when running make on chickadee. https://pastebin.com/raw/AWZNyC7X . It seems like sdl2 compiled incorrectly, but I didn't get any complaints from it.
<brendyn>Petit_Dejeuner: I failed too but with different errors :P
<Petit_Dejeuner>brendyn: I've been keeping track of all the stuff I had to do to get it working. I'll link you a copy.
<brendyn>Petit_Dejeuner: I'm using the Guix definition from the git repo
<Petit_Dejeuner>That probably makes things a lot easier.
<Petit_Dejeuner>ACTION needs to learn guix.
<brendyn>Yeah but the Guix definition davexunit provided seems incomplet. I'm not sure yet.
<paroneayea>oops, I tried to set a breakpoint at the repl but it broke the breakpoint
<Petit_Dejeuner>btw, maybe not the best place to ask, but how well does guix work on non guix based systems?
<paroneayea>Petit_Dejeuner: you can run guix on any gnu/linux distro
<brendyn>I'm using it on Parabola atm
<paroneayea>outside of that....
<lfam>Hi! I'm another person here to report that Guix works great on non-GuixSD GNU/Linux distros. I use it on Debian and NixOS, and it's very nice
<Petit_Dejeuner>Hm, I'll go ahead and install it then.
<rlb>wingo: fwiw, I was able to reproduce the sqrt/expt failure on one of our powerpc porterboxes: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20017#26 (expt 2 1/2) and (sqrt 2) are definitely not the same there right now.
<lfam>Petit_Dejeuner: Please feel free to ask for help and share feedback on #guix or the mailing list <help-guix@gnu.org>
<rlb>I'll try an upstream 2.0.14 build there next.
<Petit_Dejeuner>Thank you.
<brendyn>Petit_Dejeuner: I just scrapped the guix definition. If I go `guix environment -f guix.scm' then `./bootstrap; ./configure; make' then it compiles
<brendyn>But then I wonder how to actually load it...
<rlb>2.0.14 fails in the same way.
<rlb>I'll test C sqrt() on jessie and sid. Just saw something suggesting that might be relevant.
<paroneayea>hey davexunit
<paroneayea> https://lists.gnu.org/archive/html/guile-user/2017-04/msg00036.html
<paroneayea>what do you think?
<paroneayea>it avoids the dot notation alist mushing together with lists as value problem
<paroneayea>and cuts out the @
<rlb>Looks like that might be it https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855606
<rlb>i.e. powerpc libc sqrt() version that was broken.
<rlb>OK, very likely - I tested against the libc version uploaded at the end of that report, and the test passed.
<brendyn>Petit_Dejeuner: Any luck yet?
<Petit_Dejeuner>brendyn: I got guix working a little while ago. Now I'm just reading the documentation.
<CharlieBrown>I wish I could find my flash drives... :-( Can I use a microSD card instead? It's in an SD adapter.
<brendyn>I've been struggling with chickadee. It compiles when I run ./configure; make manually, but I get all sorts of problems when I try to compile it with Guix
<Petit_Dejeuner>brendyn: I was getting something weird about guile-2.2 being unbound in the guix.scm file, I thought it was because guile-2.2, so I tried changing it to just guile, but guile itself is unbound.
<Petit_Dejeuner>Which is weird because it's bound for guile-sdl2's block of the guix.scm file.
<brendyn>Petit_Dejeuner: Are you using chickadee from git?
<brendyn>git clone git://dthompson.us/chickadee.git
<Petit_Dejeuner>yes, the release version I had downloaded didn't seem to have a guix.scm, so I ended up using the git version
<Petit_Dejeuner>I did a pull too
<brendyn>Then the other thing to consider is your version of Guix being older
<brendyn>I have Guix from git too
<brendyn>Maybe guix pull is sufficient?
<Petit_Dejeuner>That could be it. I installed the binary release.
<Petit_Dejeuner>I tried guix package -i guix, but I can try guix pull too.
<brendyn>Guix only recently started switching to guile-2.0, so we're in rough waters atm.
<Petit_Dejeuner>Well hopefully after this is stable there will never be a major guile update ever again.
<Petit_Dejeuner>Oh, that sounds kind of bad.
<brendyn>...
<Petit_Dejeuner>I mean, just no more Python3 Perl6 stuff.
<wingo>morning
<Petit_Dejeuner>morning
<brendyn>speak of the devil
<Petit_Dejeuner>Anyway, I'll let you know what happens after I try updating guix.
<brendyn>sure
<Petit_Dejeuner>That made guix work a lot better, but now I'm struggling to load the environment.
<brendyn>What's happening?
<Petit_Dejeuner>Eh, I tried to do a clean build, and now I'm recompiling guile.
<Petit_Dejeuner>So my history is lost behind a wall of compile messages.
<brendyn>lol
<nikita1>morning
<pksadiq>Hi. If anybody hearing. The link to contribute (get involved!) at https://pragmatique.xyz/download/ is broken. Hope someone shall see fix it.
<davexunit>paroneayea: I wrote to the list but mark and I avoided this direction because vectors are very inconvenient.
<davexunit>more details on the list
<paroneayea>davexunit: gotcha, cool thanks
<bookug>
<brendyn>'note: build failure may have been caused by lack of free disk space'
<brendyn>Guile gave me an error message I can understand. It must have become sentient.
<paroneayea>davexunit: yeah I think you're right
<davexunit>paroneayea: it's a bit of tough call, Racket clearly gets away with doing this just fine, but it just doesn't feel 100% right.
<paroneayea>ACTION imagines a day where Guile has something along the lines of Clojure's immutable hashmaps and immutable vectors by default exposed in the reader/writer... would result in a lot nicer quasiquotable stuff
<davexunit>unquote-splicing only works with lists, which is one of the big things.
<paroneayea>ACTION nods
<paroneayea>davexunit: https://gitlab.com/dustyweb/guile-sjson/issues/3 on the other hand seems like an easy win?
<paroneayea>esp since it is true that #nil does cause problems in guile scheme
<paroneayea>if that change would be made, now's the time to do itt
<davexunit>wait you use #nil?
<davexunit>isn't that for elisp only?
<davexunit>I'm unsure what the proposed change is here.
<paroneayea>davexunit: I think I use #nil because (ice-9 json) did
<paroneayea>for null
<davexunit>oh no
<davexunit>well that was bad of me
<paroneayea>so the suggestion is to use the keyword #:null instead
<davexunit>why not the symbol null?
<paroneayea>that would also work!
<davexunit>'(@ (foo . null))
<davexunit>symbols are otherwise not allowed
<paroneayea>davexunit: ok... I'll work on that change.
<davexunit>I want that on my desk by lunch!
<paroneayea>ha
<manumanumanu>So, I just found he -L command line flag. Is there any convenience function or repl command that lets me import a module from a file without using guile -L . or manually adding to the load path?
<manumanumanu>ACTION keeps forgetting -L .
<manumanumanu>I could just make my own and add to .guile
<amz3`>io #guile!
<manumanumanu>I am getting an unhelpful error: unknown location: syntax: bad `syntax' form in form syntax
<manumanumanu>it is an r6rs library form. Any idea what I should look for?
<manumanumanu>ice-9/boot-9.scm:230:17: In procedure map1: [newline] ice-9/boot-9.scm:230:17: Syntax error: [newline] unknown location: syntax: bad `syntax' form in form syntax
<daviid>manumanumanu: it is most probably a syntax error in your own code
<manumanumanu>daviid: yes,that I already know
<daviid>manumanumanu: so, no one here can help you until you post the code somewhere :)
<manumanumanu> https://pastebin.com/1EzJKCN4
<manumanumanu>it is an older chez library I ported from ikarus
<daviid>paroneayea: i grabbed guile-sjson, then configure: error: could not locate guile aclocal macros
<daviid>
<manumanumanu>daviid: this is runnable without any of the other files: https://pastebin.com/zcGxTVJz
<paroneayea>daviid: did you run ./bootstrap.sh ?
<paroneayea>daviid: I guess I should have that pre-run and etc in the tarball
<paroneayea>ACTION is an autotools newb
<daviid>paroneayea: yes. so, this is a 'typical' aclocal problem, which I avoid by adding guile.m4 to all my project, and i advise others to do so, because, users might even not have guile installed ...
<paroneayea>daviid: aha
<daviid>paroneayea: just added this
<daviid>AC_CONFIG_AUX_DIR([build-aux])
<daviid>AC_CONFIG_MACRO_DIR([m4])
<daviid>to your configure.ac, then mkdir m4, copy guile.m4 from the guile src tree, and of course it pass now ... à bon entendeur salut! :):)
<daviid>manumanumanu: i can load the code from your last paste, no error here
<daviid>of course i can't from the first, it depends on other module libs ...
<daviid>paroneayea: why sjson by the way, I trioed to figure out from emails the readme, but i still fail to undrstand whhat is diff from json and (ice-9 json) ?
<daviid>paroneayea: sorry to bother you with what may appear ridiculous quizz :), not very familiar with json and never used (ice-9 json) either, yet ...
<daviid>paroneayea: and :), if it can't make it to (ice-9 json), may be we can(should?) make a guile-lib module?
<manumanumanu>daviid: haha. sorry for wasting your time. pebkac
<paroneayea>hi manumanumanu
<paroneayea>daviid: does it matter where I add it in configure.ac?
<paroneayea>ah I'll copy guile-squee
<paroneayea>daviid: anyway, added, thanks! The next release will do better
<paroneayea>daviid: and the main benefits of it is a) immutable structures (either through lists or fashes) b) quasiquotable json generation
<paroneayea>"sxml, but for json"
<paroneayea>why not in (ice-9 json)? it maybe should still go in there
<daviid>paroneayea: this is great, but why not patching (ice-9 json) then?
<paroneayea>daviid: mainly because I needed it for several projects and kept copying it into them
<paroneayea>daviid: probably I should push it back up again
<paroneayea>the main challenge might be that I also support fashes now
<paroneayea>and that would mean getting fash up into guile proper
<paroneayea>which maybe it should be in there anyway
<paroneayea>I'd love to have (ice-9 fash)
<paroneayea>daviid: I'll work on getting it upstream into guile proper in a few weeks
<daviid>paroneayea: ok, i don't know that fash will be part of ice-9 'tomorrow' though
<daviid>paroneayea: maybe we should make fash and sjson part of guile-lib, that can be done now and release pressure on ice-9 ...
<paroneayea>I dunno, what's the benefit of it being a separate package, since that's already been done?
<daviid>paroneayea: imo, sjson is a very good candidate for guile-lib, unless it makes it to ice-9, which is unlikely because of fash ... these 2, fash (fectors...) and sjson would be much better part of guile-lib, which, imo, exactly for these very generic functionalities, that could well be in guile core, but not yet ... guile-lib is the right place, but hey, just my idea, to centralise good lib modules in guile-lib rayhter trhan everyone of
<daviid>us sprerading on gitlab, hub, ... and users having to grab (and know it exists, where...)
<daviid>paroneayea: I hope I'm not annoying you! I'd love to have ytou, davexunit, janneke 'on board' guile-lib, the board of reviewers with veto right :), and help me to blow a fresh wind on guile-lib, so user gets confident about guile-lib again (they think it has been abandonned...), redesign its web pages ... add plist as well, goops extensions ...
<daviid>and rework its manual as well
<paroneayea>daviid: I support more work on guile-lib, and the goops stuff is probably a good fit there
<paroneayea>the sjson stuff seems like more time / effort mostly just because it's already been done as a separate package, and may be pushed to go up to guile anyway
<paroneayea>so at the very least, we should see how probable it is to go in guile proper still first
<daviid>paroneayea: yes, lets see how probable it is to go in guile proper still first, if not, I still think it better be in guile-lib, it is easy for me to add it to guile-lib and release... of course you could become a guile-lib commiter and do it too, but till you're up and running, I can do it...
<daviid>going afk a bit, bbl ...