IRC channel logs

2016-08-19.log

back to list of logs

<sapientech>hi all, whats the best way for module A to export a procedure imported from module B?
<ijp>depends on how many there are
<ijp>just putting in the export list works fine for small numbers
<mark_weaver>sapientech: I believe you need to use #:re-export to export bindings that were imported from elsewhere
<mark_weaver>e.g. see module/ice-9/control.scm
<daviid>sapientech: you may want to look at 're-export-public-interface', here http://git.savannah.gnu.org/cgit/grip.git/tree/grip/reexport.scm (guile-gnome has such a module as well, see the comment in this file...)
<mark_weaver>unless the number of re-exports is very large (and sometimes even then), I think it's preferable to explicitly list the exports.
<mark_weaver>but I suppose that's a question of style
<joolean>Hello Guilers! Long time no see.
<ijp>b
<spauldo>question for anyone familiar with guile-sdl2:
<spauldo>I'm needing access to the SDL renderer drawing functions. I'm not seeing them anywhere, so I'm assuming they're not implemented.
<spauldo>Things like SDL_RenderDrawLine() and whatnot.
<spauldo>Anyway, can anyone familiar with it confirm that they're not there, or give me a pointer to what I'm missing?
<amz3>davexunit: ^
<amz3>I now have 855 crawled urls! woohoo!
<amz3>I made a minor tweak to the program that dumps hackernews, now it iterates the API backward starting with the most recent content, so tonight I have a dump of recent discussion and stories on HN hopefully
***spauldo is now known as spauldo-afk
<rekado>I'm trying to use Guile's web server with the Fine Uploader JavaScript library. The Guile code should handle uploaded file chunks.
<rekado>I cannot seem to figure out how to read the uploaded chunk from the request, though.
<rekado>(read-request-body request) seems to never return
<rekado>same with just (read-request request)
<rekado>* (read-request (request-port request))
<rekado>ah, never mind, my code was throwing away the request body in an earlier step...
<amz3`>Peer-to-peer Agent for Reciprocated Search http://aurelieherbelot.net/pears/
<davexunit>spauldo-afk: they indeed are not implemented, yet.
<davexunit>mainly because I don't use those functions. of course I'd like guile-sdl2 to provide complete bindings, so I'd be happy to see a patch that adds new wrapper procedures.
<davexunit>OrangeShark: guile-commonmark doesn't support inline html right?
<davexunit>I'm trying to figure out how to embed a video into a markdown post
<davexunit>I can hack around that for now by abusing the ![]() image syntax and post-processing the SXML to detect videos
<davexunit>that's pretty much the only thing that doesn't work with my blog migration right now. I'm very close to being able to roll out the new Haunt-powered site. guile-commonmark really saved the day here.
<dsmith-work>Happy Friday, Guilers!!
<OrangeShark>davexunit: ya, guile-commonmark doesn't support inline html or block level html.
<davexunit>OrangeShark: thanks
<OrangeShark>I am thinking of adding HTML, but it won't follow the commonmark spec because they allow malformed HTML to be parsed
<davexunit>OrangeShark: I think just parsing it with the xml parser that comes with guile would be fine, IMO.
<davexunit>and if it's malformed the document will fail to parse. oh well.
<davexunit>either that or use htmlprag, which requires adding a dependency to guile-commonmark
<davexunit> http://www.nongnu.org/guile-lib/doc/ref/htmlprag/
<davexunit>guile-lib is fairly ubiquitous, though.
<OrangeShark>davexunit: I will look into that, thanks
<davexunit>like maybe having guile-commonmark read in everything between <...> as a string and then have htmlprag try to make sense of it.
<OrangeShark>I believe the intention for commonmark to allow malformed HTML was to simplify parsers and to allow markdown to be written between html tags
<davexunit>wait, you're supposed to detect markdown inside the html???
<davexunit>the spec makes me think otherwise: "Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping."
<OrangeShark>well the thing is, you can write a lone <div> tag and then the next line have markdown, the finally a </div> on the next line
<davexunit>I don't see any examples of that, but if that's really the spec then that's *terrible*
<OrangeShark> http://spec.commonmark.org/dingus/?text=%3Cdiv%3E%0A%0A%23%23%23%20Hello%0A%0A%3C%2Fdiv%3E
<OrangeShark>example of it
<OrangeShark>there needs to be an empty line
<davexunit>ugh
<OrangeShark>ya, I am not too happy about it
<davexunit>I wonder how other people deal with this
<OrangeShark>you can see the AST
<davexunit>personally, I'd be inclined to say "screw the standard"
<OrangeShark>well HTML parsing says it only for parsers that output in HTML, I don't output HTML :P
<OrangeShark>so I can ignore it or implement my own
<davexunit>then maybe just using htmlprag on html sections is good enough
<OrangeShark>I could easily just consider html blocks like other blocks where to open a block, you need an opening HTML tag, to close the block, you need a closing HTML tag
<OrangeShark>on a new line
<OrangeShark>sort of like the github style code fences
<davexunit>yeah, that could work
<davexunit>I guess whatever is easy enough to implement but doesn't stray toooo far from the spec would be fine
<OrangeShark>ya, I think that is how the original markdown does it
<OrangeShark>actually it seems pretty ambiguous on how it suppose to be in markdown
<davexunit>would be awesome to have something like this for Guile http://beautifulracket.com/
<davexunit>would be hard to beat the typography, given that this is the guy that wrote "practical typography"
***spauldo-afk is now known as spauldo
<spauldo>davexunit: I'll look into it over the weekend. I'm a guile noob though, so I can't guarantee my code will be useful.
<davexunit>spauldo: honestly, it's less guile knowledge and more C knowledge.
<davexunit>and Linux knowledge.
<davexunit>I just find the kernel interfaces for making virtualized network devices to be very hard to understand
<davexunit>oh, thought we were on #guix
<davexunit>sorry
<spauldo>Heh, was wondering why I'd need kernel knowledge for guile-sdl
<spauldo>it's like, "wow, I really am missing something here."
<davexunit>yeah sorry I thought this was a conversation in #guix about missing container features
<davexunit>spauldo: but yeah, there are *plenty* of existing bindings that you can crib from
<amz3>stis: http://www.puttypeg.net/book/
<davexunit>and hopefully write the wrappers that you need
<amz3>stis: I tried to read your blog post, but I did not understand the intent
<spauldo>yeah, seen those. That was plan B, but like I said, I'm new to guile and have only used C bindings from the C side.
<davexunit>spauldo: okey dokey.
<davexunit>well if you ever feel up to the task, I welcome your patches. :)
<spauldo>OK, thanks for the info - if I get time this weekend I'll add those and send you a patch.
<davexunit>some functions are easy to wrap, some require dealing with new foreign data types.
<spauldo>I think SDL_Rect is the only new type I'd need. Basically I just want to implement the drawing commands. I'm wanting to write a graphing system so I can visualize the stuff in my Calc II class.
<ijp>spauldo: are you a CS major? they really to stop making calculus a requirement
<spauldo>yeah, I'm CS. My situation is weird, though. Basically, it's not required for the degree, but I have to take discrete math from a different university, and that university has Calc II as a prereq for discrete math.
<spauldo>I like math, though, so it's no big deal.
<stis>amz3: document a nice design of set functionality for set's, basically it shows what operations oneneed to do in order to implement an advanced union and intersection etc
<stis>show a representation and indicate why it is closed e.g. no need to have extra representations, and how to implement the union intersection complement etc
<stis>It's really a well thought out design to handle extra features that comes with a key value pair in stead of a pure set
<stis>amz3: I havenot seen this topic anywhere else. Anyway what about your link?
<amz3>stis: it's book (with an extract) about math/geometry and language representation
<amz3>stis: the math level is low but It might be of intereset to you, the first chapter is "number and sets"
<amirouche>héllo!
***amirouche is now known as amz3`
<amz3`>did you know that ycombinator (the editor of hackernews) made favorites/bookmarks private?
<amz3`>Now you know :)
<davexunit>so I'm super excited about the potential of this project http://www.mattkeeter.com/projects/ao/
<amz3`>It's on hackernews https://news.ycombinator.com/item?id=12319406
<dsmith-work>davexunit: yes!
<amz3`>does it do animations?
<amz3`>does compute a mesh from scheme instruction? or it is a trick?
<amz3`>basically can you dump the code that generates the things in a format that is efficient for a real time application?
<davexunit>it's a CAD tool and it seems to support many rendering methods
<davexunit>you could design things to 3D print or something
<ijp>that's kinda cool
<dsmith-work>Looks like it generated some file that was actually rendered in blender.
<amz3`>you can't animate? :(
<amz3`>dsmith-work: where do you see that?
<davexunit>amz3`: it's not an animation tool
<amz3`>davexunit: I'm wondering whether you can get the result in a format other than a picture
<davexunit>yes
<amz3`>really, which format it is?
<dsmith-work>"Ever wonder what you'd get if you cut a sphere from a Menger sponge? Here's an example designed in Ao, exported as a mesh, and rendered in Blender:"
<amz3`>ohh!!
<davexunit>"In a concession to the outside world, Ao does have a few export function"
<amz3`>I don't understand concession
<davexunit>it's just a funny way of saying that Ao has export procedures for other tools
<dsmith-work>Instead of forcing other tool to read Ao formats.
<amz3`>that's awesome
<davexunit>"a concession to the outside world" means that he made a "compromise" (joking) to export in alternative formats
<amz3`>ah!
<amz3`>:p
<davexunit>which allowed things like rendering an Ao model with Blender for a pretty image
<amz3`>It the same world in french!
<davexunit>but you could also imagine this exporting in a format that a 3D printer could understand
<dsmith-work>Indeed
<davexunit>I'd like to try to use this because I currently don't know any CAD tools
<amz3`>ah ok, I'm not much interested by 3D printer right now, I'd rather build a tree renderer from an L-system for instance
<davexunit>the only thing I saw that I liked was implicitcad because it had a programmatic api, but this is even better!
<amz3`>L-system are math formula that declarively describe the shape of trees and other stuff. It's somekind of factorial pattern... I don't recall the name right now of the pattern
<amz3`>fractals
<amz3`>it's a fractal algorithm for designing fractal patterns like it trees, flower and database...
<amz3`>there is some kind of fractal b-tree if i recall correctly
<amz3`>sorry!
<amz3`>talking about Ao (and Guile), the author says «From a development perspective, I can play more easily with new algorithms without a cumbersome UI.»
<amz3`>that's exactly my point of view regarding Guile
<davexunit>yeah, UIs can't really handle abstraction very well
<amz3`>in the previous quote, the "UI" is Guile
<amz3`>the UI of Ao is guile
<davexunit>that's the killer feature of programming. we can give a name to something repetitive and stop doing the repetitive thing.
<amz3`>davexunit: doing some inkscape has always been painful, but I don't know much about drawing programmatically
<amz3`>or GIMP for that matter, a lot of repition, lake of precision... but it's a lot of knowledge to draw programmatically I think
<davexunit>I've been wanting to learn a CAD tool so I can better calculate things for projects that I do at my house
<amz3`>ah ok
<amz3`>I could also 3D print a mechanical spider to crawl my house to wipe everything for me
<davexunit>amz3`: yeah, programming doesn't really fit with drawing or painting
<amz3`>except fractal drawing
<amz3`>I look for a nice nature-like fractal
<davexunit>well that's a mathematically defined thing
<davexunit>drawing and painting is good precisely because it's not procedurally generated
<amz3`> https://sv.wikipedia.org/wiki/Fil:Dragon_trees.jpg
<amz3`>davexunit: yeah you are right
<amz3`>fractals looks nice tho
<amz3`>:)
<davexunit>agreed
<davexunit>different types of art :)
<davexunit>some suited to a computer, some not. :)
<amz3`> http://www.mattkeeter.com/projects/ao/jit.html
<davexunit>very interesting
<davexunit>I wonder if rather than replacing + outright if it would be possible to use a generic procedure instead...
<amz3`>generic procedure is GOOPS terms?
<amz3`>generic procedure as in GOOPS terms?
<amz3`>I am definitly trying this
<davexunit>yeah
<davexunit>you can use that aspect of GOOPS without using classes and all that
<djcb``>i want to use scm_shell to start a "prepared repl", i.e. with some things set up for the user
<djcb``>is that possible without manipulating argv?
<DeeEff[m]>you could just load somethign from the user's `~/.guile` file
<DeeEff[m]>s/somethign/something/
<amz3`>regarding #ao, I added instructions to install in a pull request. The REPL works, but you can't watch files for changes I submitted an issue
<davexunit>djcb``: I'm not familiar with guile's C library, but when doing meta module stuff in Guile itself I use the 'module-use!' procedure
<davexunit>after creating a module with the (undocumented!) make-fresh-user-module procedure
<amz3`>(also you'll see the pullrequests for a gcc-5-... branch to fix the compilation failure)
<amz3`>otherwise it seem to work :D
<amz3`>REPL works I mean you can define stuff and show them
<davexunit>I couldn't get it to build in Guix because cmake can't find glfw
<amz3`>bummer
<djcb``>DeeEff, davexunit: thanks
<davexunit>djcb``: editing the user's .guile would be a bad idea, IMO.
<davexunit>there's surely better ways to do things.
<davexunit>I just don't know how to use scm_shell so I can't really say what that way is.
<djcb``>what I'd like to do is start the guile repl with some modules loaded and some context initialized
<DeeEff[m]>well, providing users a default ~/.guile file would be fine
<DeeEff[m]>of course document the crap out of why certain things are needed
<davexunit>djcb``: it's possible without any ~/.guile hacks, because I've done it, and Geiser, the emacs integration for Guile, also does it.
<davexunit>I wish I just knew where it fits in with scm_shell
<djcb``>so, practically, I'm using guile to access mu (the e-mail index / search engine)
<djcb``>and would like to do e.g. "mu guile" and have all the libs loaded, aatabase initialized etc.
<djcb``>davexunit: ah, that's a good starting point; i'll have a look at geiser
<cbaines>Does anyone have any advice on whether to use vhashes or hash-tables? I have some code using hash-tables, but I'm trying to rewrite it using vhashes to make it more functional, but the equivalent of hash-set! seems to be vhash-delete, followed by vhash-cons, which is a bit ugly?
<ijp>can't you just use vhash-cons without the vhash-delete
<cbaines>I tried that in the repl, and it didn't work
<cbaines>This also looks to be intentional, as vhash-fold* copes with multiple values per key
<cbaines>Whereas, I want to ensure only having one value per key
<stis>cbaines: it's possible to wrap the fold in such a way to make a fold with only unique values, you do that by using a temporary vhash of visited objects.
<stis>it's a bit expensive though.
<stis>you can use temporary mutation for just the fold by havig a visited field in the value of a ey value pair
<cbaines>For the moment¸ I have a vhash-set function, which just does the vhash-delete and vhash-cons
<stis>yah that can wro as well, the best solution depends on the usage scenario.
<stis>mainly lookup and you are golden.
<stis>ao is soo cool. I wish it was stable and I could have used it when doing CFD earlier in my life.
<stis>lots of set theory there ;)