IRC channel logs

2017-09-25.log

back to list of logs

<lukas__>nvm I found it under nala's github : https://github.com/NalaGinrut/guile-tjit
<lloda>lukas__: please let us know if you manage to compile & test it, I tried it a while ago and I couldn't, I can't remember why rn
<amz3>o/
<dustyweb>hiya
<OrangeShark>hello
<dustyweb>civodul: looks like weak hash tables haven't left your nightmares yet :)
<civodul>not at all!
<civodul>today, several times i was like "yeah, got it"
<civodul>the minute after i realize i still don't understand what's going on
<manumanumanu>Ahoy!
<manumanumanu>I hear weak hash tables! Every time I hear "how would you introduce a memory leak in [GC'd language of your choice]" I always think of 1. weird threading behaviour (java has loads of pitfalls) and 2. weak circular references
<manumanumanu>I haven't tried it in guile though
<manumanumanu>How would you leak memory in guile?
<civodul>manumanumanu: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28590 :-)
<manumanumanu>hehe
<reed_>Hi all, I have written a function in 'c', which I have been able to call from the guile repl by following the methodology in the 'tortoise tutorial' https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html. If I wanted to add the function to a module am I right to look at this part of the documentation: https://www.gnu.org/software/guile/manual/html_node/Modules-and-Extensions.html#Modules-and-Extensions ?
<reed_>It seems there is a couple of ways to access 'c' code from guile and I want to make sure I'm doing it in a some what canonical way
<Muto>I have Guile 2.2 & 2.0 installed, I'm trying to get the Guile-Gnome library, but during the output of './configure --prefix=/usr' I get the error: "found development files for Guile 2.2, but /usr/bin/guile-2.0 has effective version 2.0"
<lloda>reed_: there are like 3 ways of doing it. One is as in that page which is 'extending' (1). Another is to link your C modules with libguile which is 'embedding' (2). And finally there is the FFI (3).
<lloda>I think modern preference is (3) if you can, (1) if you cannot, and (2) is somewhat discouraged (but every case is different and it might be better sometimes). I started using Guile long ago so I use all three. If I was starting now I would use just (1) & (3).
<lmat>How do I transform a list using a function?
<lloda>lmat: https://www.gnu.org/software/guile/manual/html_node/List-Mapping.html#index-map
<lmat>lloda: That is clearly what I want, but there is lacking documentation... what does map return? What is the difference between map and map-in-order?
<lmat>I kinda want to think that map applies proc to each argument and returns a new list which is the result.
<lmat>And what about the type of the arguments? Should they be list elements or lists?
<lmat>(Maybe I was supposed to learn this in Scheme class 1; I'm noob ^_^)
<reed_>lloda: Thank you for your detailed response! In the 'extending' documentation they say "When loaded with (use-modules (foo bar)), the load-extension call looks for the foobar-c-code.so (etc) ". What exactly is meant by the 'etc'? Does that mean it could be foobar-c-code.o as well?
<lmat> https://www.gnu.org/software/guile/manual/html_node/SRFI_002d1-Fold-and-Map.html has Scheme Procedure: map f lst1 lst2 (which is already more suggestive), and it has a good bit of prose to help.
<dsmith-work>Monday Greetings, Guilers
<cmaloney>greeets
<amz3`>o/
<llooda>reed_: I think it just means that the extension could be different depending on the system. For exmaple on the Mac it's .dylib. .o files are not suitable for dynamic linking I don't think.
<llooda>
<llooda>lmat: yeah the Guile manual is mostly for Guile and not really for Scheme.
<lmat>llooda: Is map a scheme keyword?
<llooda>yes.
<lmat>llooda: thanks!
<llooda>well, no. Not a keyword.
<llooda>but a standard function.
<llooda>Here's a Scheme reference. http://scheme.com/tspl4/control.html#./control:h5
<dsmith-work>lmat: "map" (or something really close to it) is available in many languages that are to some degree "functional".
<lmat>dsmith-work: okay.
<lmat>llooda: thanks
<llooda>lmat: np. maybe look through http://scheme.com/tspl3/ better as it's older and more standard. tspl4 has many r6rs isms. I just don't want to confuse you :-/
<lmat>llooda: Thank you; good idea.
<llooda>more examples in the Guile manual would be a good thing for sure
<dsmith-work>The + example from http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_642 sums it up nicely.
<dsmith-work>Pun wasn't intended, but I'll take it.
<lmat>Where can I find a list of standard scheme functions?
<lmat>For instance, googling "elt" site:scheme.com/tspl3/ was not helpful.
<lmat>Oh crap, I think elt is a declared object in my code :'( (what's that called? a variable?0
<OrangeShark>lmat: for standard scheme functions, you can look at the scheme standards like r5rs and r6rs. There is a new standard r7rs as well which guile doesn't fully support yet. Guile has a section of the manual dedicated to r6rs.
<OrangeShark>but to see what functions are supported in guile, best bet is to just look at the guile manual, specifically section API reference and Guile Modules. There is also a procedure index too if you know the name of it.
<ArneBab>benq: fixed the bug with partial unindent. See https://bitbucket.org/ArneBab/wisp/src/52d72f6f9d00366a632b1f8b0bbbc264bfca2137/tests/partial-indent.w and https://bitbucket.org/ArneBab/wisp/src/52d72f6f9d00366a632b1f8b0bbbc264bfca2137/tests/partial-indent.scm
<ArneBab>what I love about autotools: make distcheck.
<lmat>OrangeShark: thanks
<ArneBab>fixed the bug, did the release: wisp 0.9.5, now with standalone language/ → https://bitbucket.org/ArneBab/wisp/downloads/wisp-0.9.5.tar.gz
<ArneBab>sneek: later tell mwette: this release (wisp 0.9.5) also does the first step towards providing a wisp tutorial for beginners: It makes it easy to create a wisp project when you have vanilla Guile installed. And I wrote an article today which describes how to create a wisp project: http://www.draketo.de/proj/with-guise-and-guile/wisp-project.html
<sneek>Okay.
<lmat>How do I print something out during guile execution?
<lmat>(I need to debug my script...)
<OrangeShark>ArneBab: nice tutorial. I wonder if there is a way to simplify the usage of other languages in guile. I feel like always having to do "-x '.w' --language wisp" every time is a bit annoying.
<ArneBab>OrangeShark: That’s something I’d like to see. But we’re not there yet …
<ArneBab>(or at least I don’t know how I can do that)
<amz3`>lmat: use 'pk' procedure, mind the fact that 'pk' returns it's last argument, for instance (pk 1 2 3) will print ;; (1 2 3) and return 3
<lmat>amz3`: thank you
<amz3`>lmat: pk == peek i guess
<lmat>ahh
<ArneBab>OrangeShark: and thanks ☺
<ArneBab>OrangeShark: with the header I already simplified the process a bit: You can simply copy the header
<amz3`>lmat: the fact that it returns the last argument is very useful to avoid the need to create a "new line" in the code to inspect a value, you can just "nest" the value you need to inspect with 'pk'...
<lmat>amz3`: yeah.
<OrangeShark>ArneBab: wonder if something like languages registering extensions like .w to guile. So when guile is given a foo.w, it knows this is wisp source code.
<ArneBab>I’d like to have that, especially because after compilation, the language does not matter anymore: If the language could be be switched based on the extension, developers wouldn’t even have to know the language in which some file is written.
<ArneBab>That would be a complete multi-language environment.
<dustyweb>hi hi
<OrangeShark>ArneBab: yup, would be pretty much invisible for users.
<ArneBab>We could use javascript libraries (which stick very strictly to the syntax), elisp, lua, wisp and scheme together.
<dustyweb>ArneBab: wisp stuff, whoo
<dustyweb>ArneBab: what's up with <<header>> ?
<dustyweb>is that meant for like ;; foo
<dustyweb>maybe ;; header goes here
<ArneBab>But I’m not sure whether I see all potential pitfalls (i.e. from switching language rapidly)
<dustyweb>would be clearer if so?
<ArneBab>dustyweb: <<header>> is the first code block in http://www.draketo.de/proj/with-guise-and-guile/wisp-project.html#sec-3
<OrangeShark>there might be a couple of rough edges communicating between languages. It might be interesting to explore.
<dustyweb>ArneBab: I'd suggest inserting the example header, then a comment below it like
<dustyweb>;; ^-- switch out with the header determined above
<dustyweb>ArneBab: at first I was like "did ArneBab add new wisp syntax"?
<dustyweb>:)
<ArneBab>dustyweb: I now explained that <<header>> is noweb syntax for including the header.
<ArneBab>dustyweb: no new syntax, just plain org-mode ☺
<dustyweb>oic
<dustyweb>noweb noproblems
<ArneBab>
<ArneBab>dustyweb: I use noweb, because I want to put the focus on the point that the header is a template you can simply copy in without changes.
<dustyweb>ArneBab: tbh I think it adds an additional layer of complexity for the average user to follow
<dustyweb>noweb is not very well known outside of some very small communities
<dustyweb>so you're adding a new thing to learn for many users
<dustyweb>I'd go with the minimum viable number of new concepts to learn in a tutorial
<ArneBab>maybe you’re right … I can add specialized tangling blocks which pull both together.
<ArneBab>I wish my wisp-mode recognized multi-line comments …
<dustyweb>yeah, that's fine to do on your "source" end, though I would just not mention it on your exported HTML :)
<ArneBab>dustyweb: realized that. Thank you!
<dustyweb>later!
<dustyweb>ACTION going to find food
<ArneBab>bbad