IRC channel logs
2023-10-04.log
back to list of logs
<ekaitz>hi! can I evaluate guile code in an empty environment that only contains a set of functions defined by me? <ekaitz>but can I create a module and send it to eval? <ekaitz>flatwhatson: exactly, that's what i need! good catch! <ekaitz>flatwhatson: oh but this doesn't let me create an environment myself, only capture the one I currently have <flatwhatson>yeah, i guess you'll need to create that environment and then capture it! <ekaitz>but how do I forget stuff like call-with-input-file? <ekaitz>maybe create a #:pure module and return the-environment of it? <ekaitz>i could also use a sandbox but I think that might be too much for this case <flatwhatson>ekaitz: hmm, probably eval-in-sandbox is the right tool here? <ekaitz>yeah...because #:pure doesn't let me do anything <flatwhatson>seems like the sandbox module stuff is just sugar over first-class modules <flatwhatson>so you could (let ((m (make-module))) (module-add! m <ekaitz>flatwhatson: OH i spent a lot of time looking for modules like those but I couldn't find <ekaitz>thank you, this is what I actually need <ekaitz>local-eval in contrast doesn't let me (define ...) <ekaitz>and I can generate a #:pure module if I want for it <ekaitz>in SXML how do I make it not add entities like & ? <ekaitz>I'm talking about this for example: <ekaitz>(sxml->xml (xml->sxml "<t>\"HELLO\"</t>")) <ekaitz>I talked about this the other day with RhodiumToad i think, but i didn't realize of this case <efraim>I'm looking through the manual, it looks like string-index and string-skip are the same <mirai>ekaitz: some characters have to be escaped <mirai>things like >, < and & have to be escaped if they're not within a CDATA section <mirai>the double-quote doesn't have to be escaped if its character data (i.e. <foo>"hi"</foo> is ok) but it does for attribute values depending on whether you used a single or double quote for opening <mirai>but <t>"HELLO"</t> should mean the same thing as <t>"HELLO"</t> <ekaitz>mirai: and if i'm trying to output some html...? javascript doesn't need that kind of scaping <mirai>the disappointing answer is: XML ≠ HTML <ekaitz>haha mirai yeah, but sxml should work with html too <mirai>and HTML5 isn't SGML (au contraire de HTML4) <mirai>but there are certain HTML things that are illegal in XML <mirai>I should mention that there's XHTML and XHTML5 <mirai>which is HTML but with valid XML syntax <ekaitz>should I take a look to them and generate XHMTL5? <ekaitz>> In 2012 at the moment of writing, it was clear that W3C decided to abandon XHTML for HTML 5. <mirai>if you go with the XHTM* way then you should be able to use the standard XML tools <ekaitz>let me read further just in case <mirai>> The XML syntax for HTML was formerly referred to as "XHTML", but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG). <ekaitz>but i can't generate a CDATA block with sxml either, can I? <mirai>no idea. Guile's SXML docs aren't too good here <mwette>I think you can. Why not write xml w/ CDATA and send through xml->sxml <mwette>I think it might be something like (*CDSECT* "string") <mwette>Also, you could convert &<; to < by post-processing the sxml tree, looking for strings and send them through a simple state machine to convert. <mwette>Just tried. "<x><![CDATA[\"hello\"]]></x>" ==xml->sxml==> (*TOP* (x "hello")) <RhodiumToad>xml->sxml can _read_ cdata sections, but guile doesn't include the upstream bug fix to read them correctly, so it corrupts them in some cases <RhodiumToad>you can generate arbitrary output inside sxml->xml output by putting procedures (or applicable objects) into the sxml tree <RhodiumToad>I have a proof-of-concept example to output cdata that way if anyone is interested <ekaitz>(sxml->xml (lambda () "hola \"")) => "hola \"" <ekaitz>does the manual mention this? i've been searchin like crazy... <ekaitz>RhodiumToad: but if I put the lambda inside some structure it disappears...? <ekaitz>(sxml->xml (text ,(lambda () "\""))) <RhodiumToad>the lambda shouls output to the current output port, not return a string <ekaitz>RhodiumToad: great! working!! thanks a lot! <RhodiumToad>(sxml->xml `(foo (bar (baz ,(lambda () (display "<![CDATA[foo<>bar]]>")))))) <ekaitz>yeah! I managed to do it :) thanks again <ArneBab>mbakke: I did not try representing G-expressions yet. What I do for other quoted expressions is to just prefix the line with `. So maybe use ~ as ~(...)? <lilyp>on the one hand, you can use javascript to do whatever, on the other it's like "namespaces? what are namespaces?" <lilyp>which gets annoying if you want to do inline svg, mathml and rdf for no particular reason <haugh>rlb, as-> makes a lot of sense in clojure, where the multi-value considerations can be neatly handled with all the data-oriented destructuring <haugh>maybe it composes well with the other stuff in (lokke syntax); are there docs? <haugh>honestly my only gripe with `chain' is reordering values