IRC channel logs

2018-04-01.log

back to list of logs

<buenouanq>What's the proper way to load a custom module?
<buenouanq>I'm getting weird errors.
<buenouanq>;;; WARNING: compilation of .../test.scm failed:
<buenouanq>;;; ERROR: no code for module (sxml html)
<buenouanq>yet I can still use what (sxml html) exported
<buenouanq>so I'm sort of confused.
<daviid`>buenouanq: there is no sxml hmtl module in guile
<daviid`>buenouanq: https://dthompson.us/rendering-html-with-sxml-and-gnu-guile.html
<daviid`>if you installed from the above, you need to tell guile where to find the module ... see %load-path and GUILE_LOAD_PATH in the manua ...
<buenouanq>daviid`: that's the file I'm trying to load
<buenouanq>I have saved it in the folder I'm working in.
<buenouanq>the above errors come from using (load "./sxml-html.scm")
<buenouanq>and even though it says there is no code, sxml->html still works as expected/desired.
<buenouanq>but if I do the recommended (add-to-load-path (dirname (current-filename))) it fails to run at all
<daviid`>buenouanq: first you should solve the (sxml html) module not found, by installing (see the link I pasted above) and telling guile - %load-path or GUILE_LOAD_PATH - where you did install ... fire a repl and ,use (sxml html) should work
<daviid`>then you can further work on your scheme file ...
<buenouanq>I'm trying to do exactly that and it's not working is the thing.
<daviid`>buenouanq: if the file exists, it is somewhere, like /your/path/sxml/html then you must add "/your/path" to the list of path in %load-path, then it will work
<buenouanq>I have dt"s library saved as a file in the same directory the script I'm working on is in.
<daviid`>/your/path/sxml/html.scm I ment
<buenouanq>but (add-to-load-path (dirname (current-filename))) dosen't work
<daviid`>buenouanq: that won' work indeed, read what I just wrote
<daviid`>you should read or re read about what are modules, hw to define and use them in the manual ...
<buenouanq>/your/path in this case is the value of (dirname (current-filename))
<buenouanq>I've read it a bunch of times, there's obviously something that's not clicking.
<daviid`>buenouanq: try to add it manually, till it works
<buenouanq>t.. that's exactly what I'm talking about doing
<buenouanq>I can get it to load with (load
<daviid`>you should not load
<buenouanq>it throws the errors, but still works
<daviid`>that is not the way tu use modules, and load has nothing to do with %load-path ...
<buenouanq>with add-to-load-path it throws the errors and refuses to even run
<daviid`>do as I say: manually like (add-to-load-path "/your/path")
<daviid`>,use (sxml html)
<daviid`>you may also check, by entering %load-path, and verify that "/your/path" is in the list
<buenouanq>ERROR: no code for module (sxml html)
<buenouanq>is the problem that it has to be named ./sxml/html.scm
<buenouanq>because right now it's ./sxml-html.scm
<daviid`>buenouanq: that won't work, you have to spel the fullpathname
<daviid`>buenouanq: again, do as I say
<daviid`>(add-to-load-path "/your/path")
<buenouanq>I need it to be relative though...
<daviid`>then %load-path, check it's i the list, then ,use (sxml html)
<daviid`>buenouanq: impossible
<daviid`>guile won't accept it, i told you already
<buenouanq>full explicity path, same error
<buenouanq>s/y//
<daviid`>then the file does not exists
<daviid`>buenouanq: we do that, guilers, million of times, there is something you don't understand and/or miss spell ...
<daviid`>if the file exists: /your/path/sxml/html.scm, then it wil work, if you do as i say ... as it is explained in the manual .... anything else will fail
<buenouanq>ok, relative paths do in fact work - the problem was what I said above
<buenouanq>it has to be ./sxml/html.scm
<buenouanq>which has something to do with module naming conventions I guess
<buenouanq>so if I wanted to have the file be ./sxml-html.scm I would have to change the name of the module and use (use-modules sxml-html)
<daviid`>yes, that is how module are defined (sxml html) means there is a file sxml/html.scm
<buenouanq>or (use-modules (sxml-html)) rather
<buenouanq>ok, this is just what I didn't understand
<daviid`>buenouanq: that is why I suggested you re read the manual about what modules are, how to define and use them .. you shoud really do that first
<buenouanq>I figured adding something to the load path would read anything in it and being defin-module calls it (sxml html) it would be found
<buenouanq>I have it all open and have gone through it many times - There are things that just don't make sense until I talk through them like this. Hope the room doesn't mind the activity ( ._.)
<buenouanq>and thank you for responding
<daviid`>np, welcome
<daviid`>buenouanq: re read this section 6.20.4 Modules and the File System
<daviid`>and 6.18.7 Load Paths ...
<Labu>Hello All
<manumanumanu>Labu: Hello!
<mwette>buenouanq: This is what I use: `(add-to-load-path (getcwd)) (use-modules (sxml html))'
<manumanumanu>ArneBab: so, I made the transducers portable, added som stuff, and the address is now https://bitbucket.org/bjoli/scheme-transducers
<manumanumanu>the speed benefit of them isn't too big in guile, but in chez...whoosh! They are flying!
<manumanumanu>I suspect the function calling overhead in guile is quite a bit larger, and the GC benefits aren't as noticeable.
<chrislck>if A and B are both either numbers or #f (denoting absence of numbers), there's a beautiful symmetry to coding their addition
<chrislck>(define (myadd A B) (if A (if B (+ A B) A) B))
<chrislck>^_^
<chrislck>this works on any combination of A B being numbers or #f
<mwette>chrislck: check out "The Maybe monad"
<lispsps>is the guile manual the best place to learn guile?
<cmaloney>depends on what you're looking to learn
<cmaloney>but it is a good manual
<manumanumanu>lispsps: what programming have you done before?
<lispsps>hello worlds and fizz buzzes in C
<lispsps>now I'm reading SICP
<mwette>lispsps: SICP should be a great start
<manumanumanu>yeah
<manumanumanu>and guile's manual is a complement. Have guile's procedure index as a bookmark in your browser: https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html
<lispsps>ok thanks
<lispsps>if I would want to create for an example a game or a chat in guile, is the manual or that procedure table right place to start looking for libraries and stuff?
<manumanumanu>lispsps: the manual can be a little sparse on examples, but yes. There isn't a good way to find external libraries, but googling generally works if you don't mind ignoring some results from the playstation game Tekken.
<daviid>there is a good way :), here http://sph.mn/c/view/g2
<daviid>I see that the list is missing https://dthompson.us/projects/chickadee.html - Chickadee is a game development toolkit for Guile Scheme built on top of SDL2 and OpenGL.
<amz3>héllo all
***hugh_marera_ is now known as hugh_marera
***hugh is now known as Guest42496
<Labu>hello amz3
***francesco__ is now known as Franciman
<Franciman>do guile regex support sre syntax?
<Franciman>does*
<civodul>Franciman: nope!
<civodul>(ice-9 regex) provides POSIX regexps
<civodul>but SRFI-115, which provides SRE, should work fine with Guile
<Franciman>thanks
<Franciman>I didn't see srfi-115 in the list of srfis
<civodul>it's not (yet) in Guile proper
<civodul>but you can take the reference implementation from srfi.schemers.org
<Franciman>perfect, thanks
<Franciman>I think it's very useful
<Franciman>especially because I just wrote: \\\\\\\\\\\\\\\\
<Franciman>lol
<Franciman>to say \\\\