<davexunit>so the 'define-module' and other top-level forms are within that 'begin' <davexunit>but if I remove them from the begin, the compiler things I'm compiling a procedure application form or something. <davexunit>not sure how to properly construct a whole module that actually has the symbols available to it that it should. <davexunit>compilation succeeds, which means that the symbols were available at compile time. <mark_weaver>davexunit: I think you need to arrange for the 'define-module' to be outside of the begin. <davexunit>mark_weaver: yeah, but I'm currently unsure how to do so. <davexunit>because I need to compile to an expression, not a list of expressions. <mark_weaver>the issue surely has to do with the fact that the 'define-module' sets the current module, and the macro expander needs the current module to be set correctly when expanding code. <davexunit>I guess I would need to compile this in multiple passes <davexunit>but it's not obvious to me how to do that, because there isn't a 1:1 correlation between top-level scheme expressions and what the reader produces <mark_weaver>ArneBab_ had the same issue with wisp, and I suggested a hack, but it's suboptimal. <mark_weaver>basically the idea is that the reader that you tell guile about has a built-in buffer, a list of top-level forms. <mark_weaver>so the *real* reader can return a list of top-level forms, but the buffered reader has a buffer, and each time it's called it does this: if its buffer is empty, it calls the *real* reader until its result is not empty, and then sets the buffer to be that result list. and then it returns the first element from its buffer, and removes it. <mark_weaver>but that falls apart for things like 'define-module'. <davexunit>I will add a dummy instruction to define the module <davexunit>basically, my reader processes an XML file and produces a big list of lists with information about regular variables, structs, and procedures. <mark_weaver>davexunit: you're implementing this as a 'language' in guile? <mark_weaver>see the definition of 'include' in ice-9/psyntax.scm <mark_weaver>most of the complexity there is due to trying to be clever about where to look for the file. <mark_weaver>but the basic idea is that you can read a file and run 'datum->syntax' and then return that syntax object wrapped in 'begin'. <mark_weaver>and if you do it this way, you don't need to generate the entire file, so you don't need to worry about generating the 'define-module' <mark_weaver>you could pass the name of the XML file, and it could generate the code you want. <Jookia>So I have this: `(do-thing ,((lambda () 'test))) = (do-thing test), but I want it to be (do-thing 'test) <Jookia>Is there a better way to quote these things <davexunit>Jookia: so you want (do-thing (quote test)) ? <davexunit>you don't need lambda for this, but: `(do-thing ,((lambda () ''test))) <Jookia>davexunit: In reality '(lambda () 'test)' is an access to a record, so I can't edit inside it <davexunit>is it really significant in what you are doing? <Jookia>Yes, I'm trying to return a function call to be eval'd to inserted in to a script <davexunit>unless you are writing something along the lines of a REPL <Jookia>I'm not using a macro because I forgot about them <Jookia>Can the output of macros be inserted in to an sexpr? <davexunit>so as long as the result of the expansion is valid in the context you use it in, you can do whatever you want. <davexunit>(define-syntax-rule (push! var val) (set! var (cons val var))) <davexunit>with this, the code (push! foo 1) expands into (set! foo (cons 1 foo)) <davexunit>a situation like this called for a macro because there is no way to accomplish with a plain procedure. <davexunit>for most situations, procedures are the proper means of abstraction. <Jookia>Yeah, I'm use to higher-order functions being the 'highest' abstraction in functional programs <davexunit>but every now and again you'll encounter a situation where you want to extend the syntax of the language. <davexunit>another example: if 'let' were not available, it could be trivially implemented using a macro. <davexunit>(define-syntax-rule (let ((name value) ...) body ...) ((lambda (name ...) body ...) value ...)) <davexunit>well, trivial once you understand how ellipsis works. <Jookia>Interesting, can define-syntax-rule employ #:key ? <davexunit>but it makes me think of another example: procedure definition is just sugar for (define name (lambda args body)) <davexunit>or maybe more accurately, it *could* be implemented this way. I actually don't know how Guile does it. <Jookia>I'm not sure if define-syntax-rule is the right tool here because there's processing to be done in the function rather than just expanding <davexunit>it's a good practice to figure out how to do the thing you want to do *without* macros first. <davexunit>so you'll want to write the procedures that do the operations you are interested in. <davexunit>and then evaluate if new syntax will benefit you <davexunit>in that case, just using regular quasiquotation is what you want <Jookia>That's what I thought but I've added a platform flag that isn't being quoted properly <Jookia>... Though I could just re-quote it since I know it'll be quoted. ***Korhoset is now known as Stanislav_Excell
<amz3>the dynamic-link* I posted on the mailling is different, it doesn't use ice-9 match ***Armand is now known as Guest16639
<davexunit>alright, I generated wrappers for the Vulkan API functions.